]> icculus.org git repositories - dana/openbox.git/blob - openbox/window.h
Basic compositing with GL
[dana/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 #ifdef USE_COMPOSITING
28 #include <X11/extensions/Xdamage.h>
29 #include <GL/gl.h>
30 #include <GL/glx.h>
31 #endif
32
33 typedef struct _ObWindow         ObWindow;
34 typedef struct _ObInternalWindow ObInternalWindow;
35
36 typedef enum {
37     OB_WINDOW_CLASS_MENUFRAME,
38     OB_WINDOW_CLASS_DOCK,
39     OB_WINDOW_CLASS_CLIENT,
40     OB_WINDOW_CLASS_INTERNAL,
41     OB_WINDOW_CLASS_PROMPT
42 } ObWindowClass;
43
44 /* In order to be an ObWindow, you need to make this struct the top of your
45    struct */
46 struct _ObWindow {
47     ObWindowClass type;
48 #ifdef USE_COMPOSITING
49     GLuint texture;
50     Pixmap pixmap;
51     GLXPixmap gpixmap;
52     Damage damage;
53     int depth;
54 #endif
55 };
56
57 #define WINDOW_IS_MENUFRAME(win) \
58     (((ObWindow*)win)->type == OB_WINDOW_CLASS_MENUFRAME)
59 #define WINDOW_IS_DOCK(win) \
60     (((ObWindow*)win)->type == OB_WINDOW_CLASS_DOCK)
61 #define WINDOW_IS_CLIENT(win) \
62     (((ObWindow*)win)->type == OB_WINDOW_CLASS_CLIENT)
63 #define WINDOW_IS_INTERNAL(win) \
64     (((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNAL)
65 #define WINDOW_IS_PROMPT(win) \
66     (((ObWindow*)win)->type == OB_WINDOW_CLASS_PROMPT)
67
68 struct _ObMenu;
69 struct _ObDock;
70 struct _ObDockApp;
71 struct _ObClient;
72 struct _ObPrompt;
73
74 #define WINDOW_AS_MENUFRAME(win) ((struct _ObMenuFrame*)win)
75 #define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
76 #define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
77 #define WINDOW_AS_INTERNAL(win) ((struct _ObInternalWindow*)win)
78 #define WINDOW_AS_PROMPT(win) ((struct _ObPrompt*)win)
79
80 #define MENUFRAME_AS_WINDOW(menu) ((ObWindow*)menu)
81 #define DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
82 #define CLIENT_AS_WINDOW(client) ((ObWindow*)client)
83 #define INTERNAL_AS_WINDOW(intern) ((ObWindow*)intern)
84 #define PROMPT_AS_WINDOW(prompt) ((ObWindow*)prompt)
85
86 void window_startup (gboolean reconfig);
87 void window_shutdown(gboolean reconfig);
88
89 Window          window_top  (ObWindow *self);
90 ObStackingLayer window_layer(ObWindow *self);
91
92 ObWindow* window_find  (Window xwin);
93 void      window_add   (Window *xwin, ObWindow *win);
94 void      window_remove(Window xwin);
95
96 /* Internal openbox-owned windows like the alt-tab popup */
97 struct _ObInternalWindow {
98     ObWindowClass type;
99     Window window;
100 };
101
102 void window_manage_all(void);
103 void window_manage(Window win);
104 void window_unmanage_all(void);
105
106 #endif