From: Mikael Magnusson Date: Tue, 8 Feb 2005 04:33:54 +0000 (+0000) Subject: option for raise/lower related actions. hi floam. X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=abe258be1d7e7a6e9881a3e654d7e69994498c62;p=chaz%2Fopenbox option for raise/lower related actions. hi floam. --- diff --git a/CHANGELOG b/CHANGELOG index 71633794..99a5d0c6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,9 @@ * Fixed focus actions when bound to the mouse, normal focus cycle is always linear and directional focus is totally disabled, it makes no sense anyway, just move the mouse. + * Added an option for the raise/lower/raiselower/unshaderaise/shadelower + options called group that lets you bind stuff to raise/lower the whole + window group. yes * Various bug fixes. (I always wanted to write this in a changelog) 3.2: diff --git a/openbox/action.c b/openbox/action.c index 66475880..d83926b7 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -906,6 +906,13 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, } else if (act->func == action_directional_focus) { if ((n = parse_find_node("dialog", node->xmlChildrenNode))) act->data.cycle.dialog = parse_bool(doc, n); + } else if (act->func == action_raise || + act->func == action_lower || + act->func == action_raiselower || + act->func == action_shadelower || + act->func == action_unshaderaise) { + if ((n = parse_find_node("group", node->xmlChildrenNode))) + act->data.stacking.group = parse_bool(doc, n); } INTERACTIVE_LIMIT(act, uact); } @@ -1076,7 +1083,7 @@ void action_raiselower(union ActionData *data) void action_raise(union ActionData *data) { client_action_start(data); - stacking_raise(CLIENT_AS_WINDOW(data->client.any.c)); + stacking_raise(CLIENT_AS_WINDOW(data->client.any.c), data->stacking.group); client_action_end(data); } @@ -1099,7 +1106,7 @@ void action_shadelower(union ActionData *data) void action_lower(union ActionData *data) { client_action_start(data); - stacking_lower(CLIENT_AS_WINDOW(data->client.any.c)); + stacking_lower(CLIENT_AS_WINDOW(data->client.any.c), data->stacking.group); client_action_end(data); } diff --git a/openbox/action.h b/openbox/action.h index 3b991a67..03582875 100644 --- a/openbox/action.h +++ b/openbox/action.h @@ -134,6 +134,11 @@ struct CycleWindows { gboolean dialog; }; +struct Stacking { + struct AnyAction any; + gboolean group; +}; + union ActionData { struct AnyAction any; struct InteractiveAction inter; @@ -151,6 +156,7 @@ union ActionData { struct ShowMenu showmenu; struct CycleWindows cycle; struct Layer layer; + struct Stacking stacking; }; struct _ObAction { diff --git a/openbox/event.c b/openbox/event.c index c997ca59..f2c8cf45 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1147,9 +1147,9 @@ static void event_handle_dock(ObDock *s, XEvent *e) switch (e->type) { case ButtonPress: if (e->xbutton.button == 1) - stacking_raise(DOCK_AS_WINDOW(s)); + stacking_raise(DOCK_AS_WINDOW(s), FALSE); else if (e->xbutton.button == 2) - stacking_lower(DOCK_AS_WINDOW(s)); + stacking_lower(DOCK_AS_WINDOW(s), FALSE); break; case EnterNotify: dock_hide(FALSE); diff --git a/openbox/popup.c b/openbox/popup.c index fb7c9095..f132d9df 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -204,7 +204,7 @@ void popup_show(ObPopup *self, gchar *text) if (!self->mapped) { XMapWindow(ob_display, self->bg); - stacking_raise(INTERNAL_AS_WINDOW(self)); + stacking_raise(INTERNAL_AS_WINDOW(self), FALSE); self->mapped = TRUE; } } diff --git a/openbox/stacking.c b/openbox/stacking.c index d053bec4..35b2c1a7 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -229,7 +229,7 @@ static GList *pick_windows(ObClient *top, ObClient *selected, gboolean raise) } static GList *pick_group_windows(ObClient *top, ObClient *selected, - gboolean raise) + gboolean raise, gboolean normal) { GList *ret = NULL; GList *it, *next, *prev; @@ -256,7 +256,8 @@ static GList *pick_group_windows(ObClient *top, ObClient *selected, c->desktop == DESKTOP_ALL) && (t == OB_CLIENT_TYPE_TOOLBAR || t == OB_CLIENT_TYPE_MENU || - t == OB_CLIENT_TYPE_UTILITY)) + t == OB_CLIENT_TYPE_UTILITY || + (normal && t == OB_CLIENT_TYPE_NORMAL))) { ret = g_list_concat(ret, pick_windows(sit->data, @@ -271,7 +272,7 @@ static GList *pick_group_windows(ObClient *top, ObClient *selected, return ret; } -void stacking_raise(ObWindow *window) +void stacking_raise(ObWindow *window, gboolean group) { GList *wins; @@ -281,7 +282,7 @@ void stacking_raise(ObWindow *window) selected = WINDOW_AS_CLIENT(window); c = client_search_top_transient(selected); wins = pick_windows(c, selected, TRUE); - wins = g_list_concat(wins, pick_group_windows(c, selected, TRUE)); + wins = g_list_concat(wins, pick_group_windows(c, selected, TRUE, group)); } else { wins = g_list_append(NULL, window); stacking_list = g_list_remove(stacking_list, window); @@ -290,7 +291,7 @@ void stacking_raise(ObWindow *window) g_list_free(wins); } -void stacking_lower(ObWindow *window) +void stacking_lower(ObWindow *window, gboolean group) { GList *wins; @@ -300,7 +301,7 @@ void stacking_lower(ObWindow *window) selected = WINDOW_AS_CLIENT(window); c = client_search_top_transient(selected); wins = pick_windows(c, selected, FALSE); - wins = g_list_concat(pick_group_windows(c, selected, FALSE), wins); + wins = g_list_concat(pick_group_windows(c, selected, FALSE, group), wins); } else { wins = g_list_append(NULL, window); stacking_list = g_list_remove(stacking_list, window); @@ -329,13 +330,13 @@ void stacking_add(ObWindow *win) GList *wins; g_assert(screen_support_win != None); /* make sure I dont break this in the - future */ + future */ l = window_layer(win); wins = g_list_append(NULL, win); /* list of 1 element */ stacking_list = g_list_append(stacking_list, win); - stacking_raise(win); + stacking_raise(win, FALSE); } void stacking_add_nonintrusive(ObWindow *win) diff --git a/openbox/stacking.h b/openbox/stacking.h index 409535ae..365db0c0 100644 --- a/openbox/stacking.h +++ b/openbox/stacking.h @@ -47,10 +47,10 @@ void stacking_add_nonintrusive(ObWindow *win); #define stacking_remove(win) stacking_list = g_list_remove(stacking_list, win); /*! Raises a window above all others in its stacking layer */ -void stacking_raise(ObWindow *window); +void stacking_raise(ObWindow *window, gboolean group); /*! Lowers a window below all others in its stacking layer */ -void stacking_lower(ObWindow *window); +void stacking_lower(ObWindow *window, gboolean group); /*! Moves a window below another if its in the same layer. This function does not enforce stacking rules IRT transients n such, and so