GList *stacking_list = NULL;
+static Window top_window = None;
+
+void stacking_startup()
+{
+ XSetWindowAttributes attrib;
+ attrib.override_redirect = TRUE;
+ top_window = XCreateWindow(ob_display, ob_root,
+ -100, -100, 1, 1, 0,
+ CopyFromParent, InputOutput, CopyFromParent,
+ CWOverrideRedirect, &attrib);
+ XMapWindow(ob_display, top_window);
+}
+
+void stacking_shutdown()
+{
+ XDestroyWindow(ob_display, top_window);
+}
+
void stacking_set_list()
{
Window *windows, *win_it;
} else
windows = NULL;
- PROP_SETA32(ob_root, net_client_list_stacking, window, windows, size);
+ PROP_SETA32(ob_root, net_client_list_stacking, window,
+ (guint32*)windows, size);
if (windows)
g_free(windows);
static void raise_recursive(Client *client)
{
Window wins[2]; /* only ever restack 2 windows. */
- GList *it;
+ GList *it, *low;
GSList *sit;
g_assert(stacking_list != NULL); /* this would be bad */
/* find 'it' where it is the positiion in the stacking order where
'client' will be inserted *before* */
- it = find_lowest_transient(client);
- if (it)
- it = it->next;
- else {
- /* the stacking list is from highest to lowest */
- for (it = stacking_list; it; it = it->next) {
- if (client->layer >= ((Client*)it->data)->layer)
- break;
+ low = find_lowest_transient(client);
+ /* the stacking list is from highest to lowest */
+ for (it = g_list_last(stacking_list); it; it = it->prev) {
+ if (it == low || client->layer < ((Client*)it->data)->layer) {
+ it = it->next;
+ break;
}
+ if (it == stacking_list)
+ break;
}
/*
stacking_set_list();
}
+void stacking_raise_internal(Window win)
+{
+ Window wins[2]; /* only ever restack 2 windows. */
+
+ wins[0] = top_window;
+ wins[1] = win;
+
+ XRestackWindows(ob_display, wins, 2);
+}