WIP version 3 of edges thinger
[mikachu/openbox.git] / openbox / window.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    window.h for the Openbox window manager
4    Copyright (c) 2003-2007   Dana Jansens
5
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.
10
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.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __window_h
20 #define __window_h
21
22 #include "stacking.h"
23
24 #include <X11/Xlib.h>
25 #include <glib.h>
26
27 typedef struct _ObWindow         ObWindow;
28 typedef struct _ObInternalWindow ObInternalWindow;
29
30 typedef enum {
31     OB_WINDOW_CLASS_MENUFRAME,
32     OB_WINDOW_CLASS_DOCK,
33     OB_WINDOW_CLASS_CLIENT,
34     OB_WINDOW_CLASS_INTERNAL,
35     OB_WINDOW_CLASS_PROMPT,
36     OB_WINDOW_CLASS_EDGE
37 } ObWindowClass;
38
39 /* In order to be an ObWindow, you need to make this struct the top of your
40    struct */
41 struct _ObWindow {
42     ObWindowClass type;
43 };
44
45 #define WINDOW_IS_MENUFRAME(win) \
46     (((ObWindow*)win)->type == OB_WINDOW_CLASS_MENUFRAME)
47 #define WINDOW_IS_DOCK(win) \
48     (((ObWindow*)win)->type == OB_WINDOW_CLASS_DOCK)
49 #define WINDOW_IS_CLIENT(win) \
50     (((ObWindow*)win)->type == OB_WINDOW_CLASS_CLIENT)
51 #define WINDOW_IS_INTERNAL(win) \
52     (((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNAL)
53 #define WINDOW_IS_PROMPT(win) \
54     (((ObWindow*)win)->type == OB_WINDOW_CLASS_PROMPT)
55 #define WINDOW_IS_EDGE(win) \
56     (((ObWindow*)win)->type == OB_WINDOW_CLASS_EDGE)
57
58 struct _ObMenu;
59 struct _ObDock;
60 struct _ObDockApp;
61 struct _ObClient;
62 struct _ObPrompt;
63
64 #define WINDOW_AS_MENUFRAME(win) ((struct _ObMenuFrame*)win)
65 #define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
66 #define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
67 #define WINDOW_AS_INTERNAL(win) ((struct _ObInternalWindow*)win)
68 #define WINDOW_AS_PROMPT(win) ((struct _ObPrompt*)win)
69 #define WINDOW_AS_EDGE(win) ((struct _ObEdge*)win)
70
71 #define MENUFRAME_AS_WINDOW(menu) ((ObWindow*)menu)
72 #define DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
73 #define CLIENT_AS_WINDOW(client) ((ObWindow*)client)
74 #define INTERNAL_AS_WINDOW(intern) ((ObWindow*)intern)
75 #define PROMPT_AS_WINDOW(prompt) ((ObWindow*)prompt)
76 #define EDGE_AS_WINDOW(edge) ((ObWindow*)edge)
77
78 void window_startup (gboolean reconfig);
79 void window_shutdown(gboolean reconfig);
80
81 Window          window_top  (ObWindow *self);
82 ObStackingLayer window_layer(ObWindow *self);
83
84 ObWindow* window_find  (Window xwin);
85 void      window_add   (Window *xwin, ObWindow *win);
86 void      window_remove(Window xwin);
87
88 /* Internal openbox-owned windows like the alt-tab popup */
89 struct _ObInternalWindow {
90     ObWindowClass type;
91     Window window;
92 };
93
94 void window_manage_all(void);
95 void window_manage(Window win);
96 void window_unmanage_all(void);
97
98 #endif