X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus_cycle_popup.c;h=e1ea8488874fbc159d75f3423bf894b21505e95e;hb=677fb4264412007f6d830e5899c9b1fa41b4c95b;hp=08016fe37195c8db9e96592592e2b29b910db036;hpb=3bd4397b6ec5212bfe53a36892746962dc45dbeb;p=chaz%2Fopenbox diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index 08016fe3..e1ea8488 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -102,7 +102,8 @@ static ObIconPopup *single_popup; static gchar *popup_get_name (ObClient *c); static gboolean popup_setup (ObFocusCyclePopup *p, gboolean create_targets, - gboolean refresh_targets); + gboolean refresh_targets, + gboolean linear); static void popup_render (ObFocusCyclePopup *p, const ObClient *c); @@ -220,7 +221,7 @@ void focus_cycle_popup_shutdown(gboolean reconfig) g_free(t->text); XDestroyWindow(obt_display, t->iconwin); XDestroyWindow(obt_display, t->textwin); - g_free(t); + g_slice_free(ObFocusCyclePopupTarget, t); popup.targets = g_list_delete_link(popup.targets, popup.targets); } @@ -246,11 +247,11 @@ static void popup_target_free(ObFocusCyclePopupTarget *t) g_free(t->text); XDestroyWindow(obt_display, t->iconwin); XDestroyWindow(obt_display, t->textwin); - g_free(t); + g_slice_free(ObFocusCyclePopupTarget, t); } static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets, - gboolean refresh_targets) + gboolean refresh_targets, gboolean linear) { gint maxwidth, n; GList *it; @@ -279,7 +280,10 @@ static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets, and count them */ maxwidth = 0; n = 0; - for (it = g_list_last(focus_order); it; it = g_list_previous(it)) { + for (it = g_list_last(linear ? client_list : focus_order); + it; + it = g_list_previous(it)) + { ObClient *ft = it->data; if (focus_cycle_valid(ft)) { @@ -313,7 +317,7 @@ static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets, g_free(text); } else { ObFocusCyclePopupTarget *t = - g_new(ObFocusCyclePopupTarget, 1); + g_slice_new(ObFocusCyclePopupTarget); t->client = ft; t->text = text; @@ -392,7 +396,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) gint ml, mt, mr, mb; gint l, t, r, b; gint x, y, w, h; - Rect *screen_area = NULL; + const Rect *screen_area = NULL; gint i; GList *it; const ObFocusCyclePopupTarget *newtarget; @@ -697,15 +701,11 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) p->last_target = newtarget; - g_free(screen_area); - XFlush(obt_display); } -void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows, - gboolean all_desktops, gboolean dock_windows, - gboolean desktop_windows, - ObFocusCyclePopupMode mode) +void focus_cycle_popup_show(ObClient *c, ObFocusCyclePopupMode mode, + gboolean linear) { g_assert(c != NULL); @@ -716,7 +716,7 @@ void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows, /* do this stuff only when the dialog is first showing */ if (!popup.mapped) { - popup_setup(&popup, TRUE, FALSE); + popup_setup(&popup, TRUE, FALSE, linear); /* this is fixed once the dialog is shown */ popup.mode = mode; } @@ -749,22 +749,15 @@ void focus_cycle_popup_hide(void) popup_cleanup(); } -void focus_cycle_popup_single_show(struct _ObClient *c, - gboolean iconic_windows, - gboolean all_desktops, - gboolean dock_windows, - gboolean desktop_windows) +void focus_cycle_popup_single_show(struct _ObClient *c) { gchar *text; g_assert(c != NULL); /* do this stuff only when the dialog is first showing */ - if (!popup.mapped) { - Rect *a; - - popup_setup(&popup, FALSE, FALSE); - g_assert(popup.targets == NULL); + if (!single_popup->popup->mapped) { + const Rect *a; /* position the popup */ a = screen_physical_area_primary(FALSE); @@ -774,7 +767,6 @@ void focus_cycle_popup_single_show(struct _ObClient *c, icon_popup_min_width(single_popup, POPUP_WIDTH); icon_popup_max_width(single_popup, MAX(a->width/3, POPUP_WIDTH)); icon_popup_text_width(single_popup, popup.maxtextw); - g_free(a); } text = popup_get_name(c); @@ -831,14 +823,15 @@ static ObClient* popup_revert(ObClient *target) } ObClient* focus_cycle_popup_refresh(ObClient *target, - gboolean redraw) + gboolean redraw, + gboolean linear) { if (!popup.mapped) return NULL; if (!focus_cycle_valid(target)) target = popup_revert(target); - redraw = popup_setup(&popup, TRUE, TRUE) && redraw; + redraw = popup_setup(&popup, TRUE, TRUE, linear) && redraw; if (!target && popup.targets) target = ((ObFocusCyclePopupTarget*)popup.targets->data)->client;