3f28a93f1dbe86d25524c14e81a2efafe34c6f8e
[dana/openbox.git] / openbox / window.c
1 #include "window.h"
2 #include "menuframe.h"
3 #include "config.h"
4 #include "dock.h"
5 #include "client.h"
6 #include "frame.h"
7
8 GHashTable *window_map;
9
10 void window_startup()
11 {
12     window_map = g_hash_table_new(g_int_hash, g_int_equal);
13 }
14
15 void window_shutdown()
16 {
17     g_hash_table_destroy(window_map);
18 }
19
20 Window window_top(ObWindow *self)
21 {
22     switch (self->type) {
23     case Window_Menu:
24         return ((ObMenuFrame*)self)->window;
25     case Window_Dock:
26         return ((ObDock*)self)->frame;
27     case Window_DockApp:
28         /* not to be used for stacking */
29         g_assert_not_reached();
30         break;
31     case Window_Client:
32         return ((ObClient*)self)->frame->window;
33     case Window_Internal:
34         return ((InternalWindow*)self)->win;
35     }
36     g_assert_not_reached();
37     return None;
38 }
39
40 Window window_layer(ObWindow *self)
41 {
42     switch (self->type) {
43     case Window_Menu:
44         return OB_STACKING_LAYER_INTERNAL;
45     case Window_Dock:
46         return config_dock_layer;
47     case Window_DockApp:
48         /* not to be used for stacking */
49         g_assert_not_reached();
50         break;
51     case Window_Client:
52         return ((ObClient*)self)->layer;
53     case Window_Internal:
54         return OB_STACKING_LAYER_INTERNAL;
55     }
56     g_assert_not_reached();
57     return None;
58 }