make it possible to temporarily raise a window to the top, and restore it. also fix the return val for window_layer.
This commit is contained in:
parent
1789d45645
commit
abc67cbdc1
7 changed files with 57 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "openbox/actions.h"
|
#include "openbox/actions.h"
|
||||||
#include "openbox/stacking.h"
|
#include "openbox/stacking.h"
|
||||||
|
#include "openbox/window.h"
|
||||||
|
|
||||||
static gboolean run_func(ObActionsData *data, gpointer options);
|
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "openbox/actions.h"
|
#include "openbox/actions.h"
|
||||||
#include "openbox/stacking.h"
|
#include "openbox/stacking.h"
|
||||||
|
#include "openbox/window.h"
|
||||||
|
|
||||||
static gboolean run_func(ObActionsData *data, gpointer options);
|
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "mwm.h"
|
#include "mwm.h"
|
||||||
#include "geom.h"
|
#include "geom.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
|
#include "window.h"
|
||||||
#include "render/color.h"
|
#include "render/color.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
|
@ -105,6 +105,42 @@ static void do_restack(GList *wins, GList *before)
|
||||||
stacking_set_list();
|
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)
|
static void do_raise(GList *wins)
|
||||||
{
|
{
|
||||||
GList *it;
|
GList *it;
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
#ifndef __stacking_h
|
#ifndef __stacking_h
|
||||||
#define __stacking_h
|
#define __stacking_h
|
||||||
|
|
||||||
#include "window.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
struct _ObWindow;
|
||||||
|
struct _ObClient;
|
||||||
|
|
||||||
/*! The possible stacking layers a client window can be a part of */
|
/*! The possible stacking layers a client window can be a part of */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OB_STACKING_LAYER_INVALID,
|
OB_STACKING_LAYER_INVALID,
|
||||||
|
@ -44,21 +45,27 @@ extern GList *stacking_list;
|
||||||
stacking_list */
|
stacking_list */
|
||||||
void stacking_set_list();
|
void stacking_set_list();
|
||||||
|
|
||||||
void stacking_add(ObWindow *win);
|
void stacking_add(struct _ObWindow *win);
|
||||||
void stacking_add_nonintrusive(ObWindow *win);
|
void stacking_add_nonintrusive(struct _ObWindow *win);
|
||||||
#define stacking_remove(win) stacking_list = g_list_remove(stacking_list, win);
|
#define stacking_remove(win) stacking_list = g_list_remove(stacking_list, win);
|
||||||
|
|
||||||
/*! Raises a window above all others in its stacking layer */
|
/*! 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 */
|
/*! 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.
|
/*! Moves a window below another if its in the same layer.
|
||||||
This function does not enforce stacking rules IRT transients n such, and so
|
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
|
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.
|
/*! Restack a window based upon a sibling (or all windows) in various ways.
|
||||||
@param client The client to be restacked
|
@param client The client to be restacked
|
||||||
|
|
|
@ -63,7 +63,7 @@ Window window_top(ObWindow *self)
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window window_layer(ObWindow *self)
|
ObStackingLayer window_layer(ObWindow *self)
|
||||||
{
|
{
|
||||||
switch (self->type) {
|
switch (self->type) {
|
||||||
case Window_Menu:
|
case Window_Menu:
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#ifndef __window_h
|
#ifndef __window_h
|
||||||
#define __window_h
|
#define __window_h
|
||||||
|
|
||||||
|
#include "stacking.h"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -74,6 +76,6 @@ void window_startup(gboolean reconfig);
|
||||||
void window_shutdown(gboolean reconfig);
|
void window_shutdown(gboolean reconfig);
|
||||||
|
|
||||||
Window window_top(ObWindow *self);
|
Window window_top(ObWindow *self);
|
||||||
Window window_layer(ObWindow *self);
|
ObStackingLayer window_layer(ObWindow *self);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue