1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 unmanaged.c for the Openbox window manager
4 Copyright (c) 2010 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
19 #include "unmanaged.h"
20 #include "composite.h"
22 #include "obt/display.h"
27 ObStackingLayer layer;
32 static GSList *unmanaged_list = NULL;
34 ObUnmanaged* unmanaged_new(Window w)
39 if (w == composite_overlay)
41 if (!XGetWindowAttributes(obt_display, w, &at))
43 if (at.class == InputOnly)
46 self = window_new(OB_WINDOW_CLASS_UNMANAGED, ObUnmanaged);
48 self->layer = OB_STACKING_LAYER_ALL;
49 self->depth = at.depth;
51 window_set_abstract(UNMANAGED_AS_WINDOW(self),
56 window_add(&self->win, UNMANAGED_AS_WINDOW(self));
57 stacking_add(UNMANAGED_AS_WINDOW(self));
58 unmanaged_list = g_slist_prepend(unmanaged_list, self);
63 void unmanaged_destroy(ObUnmanaged *self)
65 window_cleanup(UNMANAGED_AS_WINDOW(self));
66 unmanaged_list = g_slist_remove(unmanaged_list, self);
67 stacking_remove(UNMANAGED_AS_WINDOW(self));
68 window_remove(self->win);
69 window_free(UNMANAGED_AS_WINDOW(self));
72 void unmanaged_destroy_all(void)
74 while (unmanaged_list)
75 unmanaged_destroy(unmanaged_list->data);