From: Dana Jansens Date: Fri, 11 Jan 2008 20:28:26 +0000 (-0500) Subject: make it possible to temporarily raise a window to the top, and restore it. also... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=abc67cbdc1c1e61e074f8f312eaecb357cd0aa5c;p=chaz%2Fopenbox make it possible to temporarily raise a window to the top, and restore it. also fix the return val for window_layer. --- diff --git a/openbox/actions/lower.c b/openbox/actions/lower.c index 3a214ea7..d34e933b 100644 --- a/openbox/actions/lower.c +++ b/openbox/actions/lower.c @@ -1,5 +1,6 @@ #include "openbox/actions.h" #include "openbox/stacking.h" +#include "openbox/window.h" static gboolean run_func(ObActionsData *data, gpointer options); diff --git a/openbox/actions/raise.c b/openbox/actions/raise.c index 5dfe281a..6837bce2 100644 --- a/openbox/actions/raise.c +++ b/openbox/actions/raise.c @@ -1,5 +1,6 @@ #include "openbox/actions.h" #include "openbox/stacking.h" +#include "openbox/window.h" static gboolean run_func(ObActionsData *data, gpointer options); diff --git a/openbox/client.h b/openbox/client.h index b4b165f8..e83a6b7a 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -24,6 +24,7 @@ #include "mwm.h" #include "geom.h" #include "stacking.h" +#include "window.h" #include "render/color.h" #include diff --git a/openbox/stacking.c b/openbox/stacking.c index b23e6eac..bb8975d4 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -105,6 +105,42 @@ static void do_restack(GList *wins, GList *before) stacking_set_list(); } +void stacking_temp_raise(ObWindow *window) +{ + Window win[2]; + GList *it; + + /* don't use this for internal windows..! it would lower them.. */ + g_assert(window_layer(window) < OB_STACKING_LAYER_INTERNAL); + + /* find the window to drop it underneath */ + win[0] = screen_support_win; + for (it = stacking_list; it; it = g_list_next(it)) { + ObWindow *w = it->data; + if (window_layer(w) >= OB_STACKING_LAYER_INTERNAL) + win[0] = window_top(w); + else + break; + } + + win[1] = window_top(window); + XRestackWindows(ob_display, win, 2); +} + +void stacking_restore() +{ + Window *win; + GList *it; + gint i; + + win = g_new(Window, g_list_length(stacking_list) + 1); + win[0] = screen_support_win; + for (i = 1, it = stacking_list; it; ++i, it = g_list_next(it)) + win[i] = window_top(it->data); + XRestackWindows(ob_display, win, i); + g_free(win); +} + static void do_raise(GList *wins) { GList *it; diff --git a/openbox/stacking.h b/openbox/stacking.h index ac9c8239..e226f36f 100644 --- a/openbox/stacking.h +++ b/openbox/stacking.h @@ -20,11 +20,12 @@ #ifndef __stacking_h #define __stacking_h -#include "window.h" - #include #include +struct _ObWindow; +struct _ObClient; + /*! The possible stacking layers a client window can be a part of */ typedef enum { OB_STACKING_LAYER_INVALID, @@ -44,21 +45,27 @@ extern GList *stacking_list; stacking_list */ void stacking_set_list(); -void stacking_add(ObWindow *win); -void stacking_add_nonintrusive(ObWindow *win); +void stacking_add(struct _ObWindow *win); +void stacking_add_nonintrusive(struct _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(struct _ObWindow *window); + +/*! Temporarily raises a window above all others */ +void stacking_temp_raise(struct _ObWindow *window); + +/*! Restores any temporarily raised windows to their correct place */ +void stacking_restore(); /*! Lowers a window below all others in its stacking layer */ -void stacking_lower(ObWindow *window); +void stacking_lower(struct _ObWindow *window); /*! Moves a window below another if its in the same layer. This function does not enforce stacking rules IRT transients n such, and so it should really ONLY be used to restore stacking orders from saved sessions */ -void stacking_below(ObWindow *window, ObWindow *below); +void stacking_below(struct _ObWindow *window, struct _ObWindow *below); /*! Restack a window based upon a sibling (or all windows) in various ways. @param client The client to be restacked diff --git a/openbox/window.c b/openbox/window.c index 19b39c09..c5e6a4ea 100644 --- a/openbox/window.c +++ b/openbox/window.c @@ -63,7 +63,7 @@ Window window_top(ObWindow *self) return None; } -Window window_layer(ObWindow *self) +ObStackingLayer window_layer(ObWindow *self) { switch (self->type) { case Window_Menu: diff --git a/openbox/window.h b/openbox/window.h index ef29edd7..aaf83995 100644 --- a/openbox/window.h +++ b/openbox/window.h @@ -19,6 +19,8 @@ #ifndef __window_h #define __window_h +#include "stacking.h" + #include #include @@ -74,6 +76,6 @@ void window_startup(gboolean reconfig); void window_shutdown(gboolean reconfig); Window window_top(ObWindow *self); -Window window_layer(ObWindow *self); +ObStackingLayer window_layer(ObWindow *self); #endif