add copyright headers, adjust --version output to include copyright, and --help outpu...
[mikachu/openbox.git] / openbox / window.h
1 /* -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
2
3    window.h for the Openbox window manager
4    Copyright (c) 2003        Ben 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 <X11/Xlib.h>
23 #include <glib.h>
24
25 typedef struct _ObWindow         ObWindow;
26 typedef struct _ObInternalWindow ObInternalWindow;
27
28 typedef enum {
29     Window_Menu,
30     Window_Dock,
31     Window_DockApp, /* used for events but not stacking */
32     Window_Client,
33     Window_Internal /* used for stacking but not events */
34 } Window_InternalType;
35
36 struct _ObWindow
37 {
38     Window_InternalType type;
39 };
40
41 /* Wrapper for internal stuff. If its struct matches this then it can be used
42    as an ObWindow */
43 typedef struct InternalWindow {
44     ObWindow obwin;
45     Window win;
46 } InternalWindow;
47
48 #define WINDOW_IS_MENU(win) (((ObWindow*)win)->type == Window_Menu)
49 #define WINDOW_IS_DOCK(win) (((ObWindow*)win)->type == Window_Dock)
50 #define WINDOW_IS_DOCKAPP(win) (((ObWindow*)win)->type == Window_DockApp)
51 #define WINDOW_IS_CLIENT(win) (((ObWindow*)win)->type == Window_Client)
52 #define WINDOW_IS_INTERNAL(win) (((ObWindow*)win)->type == Window_Internal)
53
54 struct _ObMenu;
55 struct _ObDock;
56 struct _ObDockApp;
57 struct _ObClient;
58
59 #define WINDOW_AS_MENU(win) ((struct _ObMenuFrame*)win)
60 #define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
61 #define WINDOW_AS_DOCKAPP(win) ((struct _ObDockApp*)win)
62 #define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
63 #define WINDOW_AS_INTERNAL(win) ((struct InternalWindow*)win)
64
65 #define MENU_AS_WINDOW(menu) ((ObWindow*)menu)
66 #define DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
67 #define DOCKAPP_AS_WINDOW(dockapp) ((ObWindow*)dockapp)
68 #define CLIENT_AS_WINDOW(client) ((ObWindow*)client)
69 #define INTERNAL_AS_WINDOW(intern) ((ObWindow*)intern)
70
71 extern GHashTable *window_map;
72
73 void window_startup(gboolean reconfig);
74 void window_shutdown(gboolean reconfig);
75
76 Window window_top(ObWindow *self);
77 Window window_layer(ObWindow *self);
78
79 #endif