From: Dana Jansens Date: Thu, 10 May 2007 16:04:08 +0000 (+0000) Subject: don't make interactive desktop cycling switch until you release the mods. this is... X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=9a3f05a780f8cbfeb68626552d25c48ab0245ca3;p=chaz%2Fopenbox don't make interactive desktop cycling switch until you release the mods. this is needed because otherwise focus moves around during the grab and applications get confused. :| change the pager popup to resize based on the layout so the squares can be bigger --- diff --git a/openbox/action.c b/openbox/action.c index bcd1b60f..5cc0bb21 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1546,8 +1546,7 @@ void action_desktop_dir(union ActionData *data) data->desktopdir.inter.final, data->desktopdir.inter.cancel); if (!data->sendtodir.inter.any.interactive || - !data->sendtodir.inter.final || - data->sendtodir.inter.cancel) + (data->sendtodir.inter.final && !data->sendtodir.inter.cancel)) { if (d != screen_desktop) screen_set_desktop(d, TRUE); } @@ -1566,8 +1565,7 @@ void action_send_to_desktop_dir(union ActionData *data) data->sendtodir.inter.final, data->sendtodir.inter.cancel); if (!data->sendtodir.inter.any.interactive || - !data->sendtodir.inter.final || - data->sendtodir.inter.cancel) + (data->sendtodir.inter.final && !data->sendtodir.inter.cancel)) { client_set_desktop(c, d, data->sendtodir.follow); if (data->sendtodir.follow && d != screen_desktop) diff --git a/openbox/popup.c b/openbox/popup.c index bf682aaf..f341e092 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -39,6 +39,7 @@ ObPopup *popup_new() self->x = self->y = self->textw = self->h = 0; self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg); self->a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label); + self->iconwm = self->iconhm = 1; attrib.override_redirect = True; self->bg = XCreateWindow(ob_display, RootWindow(ob_display, ob_screen), @@ -172,7 +173,7 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text) h = self->h; texth = h - emptyy; } else - h = texth + emptyy; + h = texth * self->iconhm + emptyy; if (self->textw) textw = self->textw; @@ -182,7 +183,8 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text) emptyx = l + r + ob_rr_theme->paddingx * 2; if (self->hasicon) { - iconw = iconh = texth; + iconw = texth * self->iconwm; + iconh = texth * self->iconhm; textx += iconw + ob_rr_theme->paddingx; if (textw) emptyx += ob_rr_theme->paddingx; /* between the icon and text */ @@ -322,6 +324,12 @@ void icon_popup_delay_show(ObIconPopup *self, gulong usec, popup_delay_show(self->popup, usec, text); } +void icon_popup_icon_size_multiplier(ObIconPopup *self, guint wm, guint hm) +{ + if (wm != 0) self->popup->iconwm = wm; + if (hm != 0) self->popup->iconhm = hm; +} + static void pager_popup_draw_icon(gint px, gint py, gint w, gint h, gpointer data) { @@ -492,3 +500,9 @@ void pager_popup_delay_show(ObPagerPopup *self, gulong usec, popup_delay_show(self->popup, usec, text); } + +void pager_popup_icon_size_multiplier(ObPagerPopup *self, guint wm, guint hm) +{ + if (wm != 0) self->popup->iconwm = wm; + if (hm != 0) self->popup->iconhm = hm; +} diff --git a/openbox/popup.h b/openbox/popup.h index 0bf2f500..f96ad664 100644 --- a/openbox/popup.h +++ b/openbox/popup.h @@ -49,6 +49,8 @@ struct _ObPopup gint h; gint minw; gint maxw; + guint iconwm; /* icon width multiplier. multiplied by the normal width */ + guint iconhm; /* icon height multiplier. multipled by the normal height */ gboolean mapped; gboolean delay_mapped; @@ -120,6 +122,7 @@ void icon_popup_delay_show(ObIconPopup *self, gulong usec, #define icon_popup_text_width_to_strings(p, s, n) \ popup_text_width_to_strings((p)->popup,(s),(n)) #define icon_popup_set_text_align(p, j) popup_set_text_align((p)->popup,(j)) +void icon_popup_icon_size_multiplier(ObIconPopup *self, guint wm, guint hm); ObPagerPopup *pager_popup_new(); void pager_popup_free(ObPagerPopup *self); @@ -138,5 +141,6 @@ void pager_popup_delay_show(ObPagerPopup *self, gulong usec, #define pager_popup_text_width_to_strings(p, s, n) \ popup_text_width_to_strings((p)->popup,(s),(n)) #define pager_popup_set_text_align(p, j) popup_set_text_align((p)->popup,(j)) +void pager_popup_icon_size_multiplier(ObPagerPopup *self, guint wm, guint hm); #endif diff --git a/openbox/screen.c b/openbox/screen.c index 51f226a5..9ac0ea98 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -641,6 +641,11 @@ void screen_desktop_popup(guint d, gboolean show) a = screen_physical_area_monitor(0); pager_popup_position(desktop_cycle_popup, CenterGravity, a->x + a->width / 2, a->y + a->height / 2); + pager_popup_icon_size_multiplier(desktop_cycle_popup, + screen_desktop_layout.columns / + screen_desktop_layout.rows, + screen_desktop_layout.rows/ + screen_desktop_layout.columns); pager_popup_max_width(desktop_cycle_popup, MAX(a->width/3, POPUP_WIDTH)); pager_popup_show(desktop_cycle_popup, screen_desktop_names[d], d); @@ -650,13 +655,15 @@ void screen_desktop_popup(guint d, gboolean show) guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear, gboolean dialog, gboolean done, gboolean cancel) { - guint d, r, c; - - d = screen_desktop; + guint r, c; + static guint d = (guint)-1; + guint ret; if ((cancel || done) && dialog) goto show_cycle_dialog; + if (d == (guint)-1) + d = screen_desktop; get_row_col(d, &r, &c); if (linear) { @@ -772,7 +779,12 @@ show_cycle_dialog: screen_desktop_popup(d, TRUE); } else screen_desktop_popup(0, FALSE); - return d; + ret = d; + + if (!dialog || cancel || done) + d = (guint)-1; + + return ret; } void screen_update_layout()