show the focus cycle popup's icons in linear order when cycling in linear order (bug #2319)

This commit is contained in:
Dana Jansens 2010-04-16 18:41:08 -04:00
parent 56fface3a4
commit b05ac359b8
3 changed files with 24 additions and 15 deletions

View file

@ -37,6 +37,7 @@ typedef enum {
ObClient *focus_cycle_target = NULL; ObClient *focus_cycle_target = NULL;
static ObCycleType focus_cycle_type = OB_CYCLE_NONE; static ObCycleType focus_cycle_type = OB_CYCLE_NONE;
static gboolean focus_cycle_linear;
static gboolean focus_cycle_iconic_windows; static gboolean focus_cycle_iconic_windows;
static gboolean focus_cycle_all_desktops; static gboolean focus_cycle_all_desktops;
static gboolean focus_cycle_nonhilite_windows; static gboolean focus_cycle_nonhilite_windows;
@ -87,7 +88,8 @@ void focus_cycle_reorder()
{ {
if (focus_cycle_type == OB_CYCLE_NORMAL) { if (focus_cycle_type == OB_CYCLE_NORMAL) {
focus_cycle_target = focus_cycle_popup_refresh(focus_cycle_target, focus_cycle_target = focus_cycle_popup_refresh(focus_cycle_target,
TRUE); TRUE,
focus_cycle_linear);
focus_cycle_update_indicator(focus_cycle_target); focus_cycle_update_indicator(focus_cycle_target);
if (!focus_cycle_target) if (!focus_cycle_target)
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
@ -126,6 +128,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
} }
if (focus_cycle_target == NULL) { if (focus_cycle_target == NULL) {
focus_cycle_linear = linear;
focus_cycle_iconic_windows = TRUE; focus_cycle_iconic_windows = TRUE;
focus_cycle_all_desktops = all_desktops; focus_cycle_all_desktops = all_desktops;
focus_cycle_nonhilite_windows = nonhilite_windows; focus_cycle_nonhilite_windows = nonhilite_windows;
@ -156,7 +159,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
focus_cycle_draw_indicator(showbar ? ft : NULL); focus_cycle_draw_indicator(showbar ? ft : NULL);
} }
/* same arguments as focus_target_valid */ /* same arguments as focus_target_valid */
focus_cycle_popup_show(ft, mode); focus_cycle_popup_show(ft, mode, focus_cycle_linear);
return focus_cycle_target; return focus_cycle_target;
} else if (ft != focus_cycle_target) { } else if (ft != focus_cycle_target) {
focus_cycle_target = ft; focus_cycle_target = ft;
@ -298,6 +301,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows,
goto done_cycle; goto done_cycle;
if (focus_cycle_target == NULL) { if (focus_cycle_target == NULL) {
focus_cycle_linear = FALSE;
focus_cycle_iconic_windows = FALSE; focus_cycle_iconic_windows = FALSE;
focus_cycle_all_desktops = FALSE; focus_cycle_all_desktops = FALSE;
focus_cycle_nonhilite_windows = TRUE; focus_cycle_nonhilite_windows = TRUE;

View file

@ -102,7 +102,8 @@ static ObIconPopup *single_popup;
static gchar *popup_get_name (ObClient *c); static gchar *popup_get_name (ObClient *c);
static gboolean popup_setup (ObFocusCyclePopup *p, static gboolean popup_setup (ObFocusCyclePopup *p,
gboolean create_targets, gboolean create_targets,
gboolean refresh_targets); gboolean refresh_targets,
gboolean linear);
static void popup_render (ObFocusCyclePopup *p, static void popup_render (ObFocusCyclePopup *p,
const ObClient *c); const ObClient *c);
@ -250,7 +251,7 @@ static void popup_target_free(ObFocusCyclePopupTarget *t)
} }
static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets, static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
gboolean refresh_targets) gboolean refresh_targets, gboolean linear)
{ {
gint maxwidth, n; gint maxwidth, n;
GList *it; GList *it;
@ -279,7 +280,10 @@ static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
and count them */ and count them */
maxwidth = 0; maxwidth = 0;
n = 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; ObClient *ft = it->data;
if (focus_cycle_valid(ft)) { if (focus_cycle_valid(ft)) {
@ -700,7 +704,8 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
XFlush(obt_display); XFlush(obt_display);
} }
void focus_cycle_popup_show(ObClient *c, ObFocusCyclePopupMode mode) void focus_cycle_popup_show(ObClient *c, ObFocusCyclePopupMode mode,
gboolean linear)
{ {
g_assert(c != NULL); g_assert(c != NULL);
@ -711,7 +716,7 @@ void focus_cycle_popup_show(ObClient *c, ObFocusCyclePopupMode mode)
/* do this stuff only when the dialog is first showing */ /* do this stuff only when the dialog is first showing */
if (!popup.mapped) { if (!popup.mapped) {
popup_setup(&popup, TRUE, FALSE); popup_setup(&popup, TRUE, FALSE, linear);
/* this is fixed once the dialog is shown */ /* this is fixed once the dialog is shown */
popup.mode = mode; popup.mode = mode;
} }
@ -751,12 +756,9 @@ void focus_cycle_popup_single_show(struct _ObClient *c)
g_assert(c != NULL); g_assert(c != NULL);
/* do this stuff only when the dialog is first showing */ /* do this stuff only when the dialog is first showing */
if (!popup.mapped) { if (!single_popup->popup->mapped) {
const Rect *a; const Rect *a;
popup_setup(&popup, FALSE, FALSE);
g_assert(popup.targets == NULL);
/* position the popup */ /* position the popup */
a = screen_physical_area_primary(FALSE); a = screen_physical_area_primary(FALSE);
icon_popup_position(single_popup, CenterGravity, icon_popup_position(single_popup, CenterGravity,
@ -821,14 +823,15 @@ static ObClient* popup_revert(ObClient *target)
} }
ObClient* focus_cycle_popup_refresh(ObClient *target, ObClient* focus_cycle_popup_refresh(ObClient *target,
gboolean redraw) gboolean redraw,
gboolean linear)
{ {
if (!popup.mapped) return NULL; if (!popup.mapped) return NULL;
if (!focus_cycle_valid(target)) if (!focus_cycle_valid(target))
target = popup_revert(target); target = popup_revert(target);
redraw = popup_setup(&popup, TRUE, TRUE) && redraw; redraw = popup_setup(&popup, TRUE, TRUE, linear) && redraw;
if (!target && popup.targets) if (!target && popup.targets)
target = ((ObFocusCyclePopupTarget*)popup.targets->data)->client; target = ((ObFocusCyclePopupTarget*)popup.targets->data)->client;

View file

@ -33,7 +33,8 @@ typedef enum {
void focus_cycle_popup_startup(gboolean reconfig); void focus_cycle_popup_startup(gboolean reconfig);
void focus_cycle_popup_shutdown(gboolean reconfig); void focus_cycle_popup_shutdown(gboolean reconfig);
void focus_cycle_popup_show(struct _ObClient *c, ObFocusCyclePopupMode mode); void focus_cycle_popup_show(struct _ObClient *c, ObFocusCyclePopupMode mode,
gboolean linear);
void focus_cycle_popup_hide(void); void focus_cycle_popup_hide(void);
void focus_cycle_popup_single_show(struct _ObClient *c); void focus_cycle_popup_single_show(struct _ObClient *c);
@ -46,6 +47,7 @@ gboolean focus_cycle_popup_is_showing(struct _ObClient *c);
a different target that is valid, and which should be considered the a different target that is valid, and which should be considered the
current focus cycling target. */ current focus cycling target. */
struct _ObClient *focus_cycle_popup_refresh(struct _ObClient *target, struct _ObClient *focus_cycle_popup_refresh(struct _ObClient *target,
gboolean redraw); gboolean redraw,
gboolean linear);
#endif #endif