update TODO
[luccawm.git] / xwm / lucca-display-private.h
blobf04dd7ae0bb37abc26c2eb908ad254c1d3b07208
1 /* Copyright (c) 2008 Vincent Povirk
3 Permission is hereby granted, free of charge, to any person
4 obtaining a copy of this software and associated documentation
5 files (the "Software"), to deal in the Software without
6 restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following
10 conditions:
12 The above copyright notice and this permission notice shall be
13 included in all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef LUCCA_DISPLAY_PRIVATE_H
26 #define LUCCA_DISPLAY_PRIVATE_H
28 #include <gdk/gdkx.h>
29 #include <X11/Xlib.h>
31 #include <string.h>
33 #include "lucca-bin.h"
34 #include "lucca-display.h"
36 /* Private definitons for the X Window Management Module */
38 struct _LuccaDisplay {
39 GObject parent;
40 /* instance members */
41 gboolean valid;
42 GdkDisplay* display;
43 Display* xdisplay;
44 struct _LuccaScreen* default_screen;
46 GHashTable* valid_windows; /* maps GdkWindow's to LuccaWindow's */
48 GSList* hotkey_infos;
50 gchar* wm_name;
52 /* atoms */
53 Atom xatom_atom;
54 Atom xcardinal_atom;
56 gboolean dispose_has_run;
59 struct _LuccaDisplayClass {
60 GObjectClass parent;
61 /* class members */
62 gint new_screen_signal_id;
63 gint new_window_signal_id;
66 struct _LuccaScreen {
67 GObject parent;
68 /* instance members */
69 gboolean valid;
70 GdkScreen* screen;
71 Screen* xscreen;
72 LuccaDisplay* display;
73 GdkWindow* root;
74 Window xroot;
76 GList* docks;
77 guint workarea_x, workarea_y, workarea_width, workarea_height;
79 GdkWindow* window;
80 Window xwindow;
82 int lock_mask; /* All "lock" modifier bits; hotkeys must be grabbed with every combination of these */
83 int meta_mask;
84 int super_mask;
85 int hyper_mask;
87 GList* grab_infos;
89 gboolean dispose_has_run;
92 struct _LuccaScreenClass {
93 GObjectClass parent;
94 /* class members */
95 gint resize_workarea_signal_id;
98 typedef gulong ICCCM_STATE; /* possible values: WithdrawnState, NormalState, IconicState; according to the ICCCM, managed windows are either Normal or Iconic, depending on whether the window would be visible when not obscured */
99 typedef struct {
100 ICCCM_STATE state; /* current state according to the window manager, in ICCCM terms */
101 Window icon; /* icon window; this is specified in the ICCCM but never used in practice; it will always be None */
102 } ICCCM_WM_STATE; /* type for the WM_STATE hint */
104 struct _LuccaWindow {
105 GObject parent;
106 /* instance members */
107 gboolean valid;
108 gboolean badwindow; /* if TRUE, this window doesn't exist anymore, but the rest of the program might not know that yet */
109 gboolean internal;
110 LuccaDisplay* display;
111 GdkWindow* window;
112 Window xwindow;
114 LuccaBin* bin;
116 XWindowAttributes xattr;
117 XWMHints* xwmhints;
118 XSizeHints xsizehints;
119 long xsizehints_supplied;
120 GData* properties_set;
121 LuccaType type;
123 gboolean supports_delete_window;
125 gboolean focused;
127 gboolean needs_configurenotify;
129 gboolean ignore_focus;
131 GdkWindow* window_parent;
133 ICCCM_STATE icccm_state;
135 LuccaState requested_states;
136 LuccaState netwm_states;
138 gchar* requested_title;
140 GClosure* owner_callback;
142 /* _NET_WM_STRUT_PARTIAL info */
143 gint strut_left, strut_right, strut_top, strut_bottom, left_start_y, left_end_y, right_start_y, right_end_y, top_start_x, top_end_x, bottom_start_x, bottom_end_x;
145 gboolean dispose_has_run;
148 struct _LuccaWindowClass {
149 GObjectClass parent;
150 /* class members */
151 gint withdraw_signal_id;
152 gint gain_focus_signal_id;
153 gint lose_focus_signal_id;
154 gint mouse_in_signal_id;
155 gint mouse_out_signal_id;
156 gint state_request_signal_id;
159 /* structs for storing information about keyboard grabs */
160 typedef struct {
161 LuccaDisplay* display;
162 guint keyval; /* these are apparently the same as an X KeySym */
163 GdkModifierType modifiers;
164 GClosure* callback;
165 } HotkeyInfo;
167 typedef struct {
168 LuccaScreen* screen;
169 unsigned int keycode;
170 unsigned int xmodifiers;
171 HotkeyInfo* hotkey;
172 } GrabInfo;
174 /* private methods */
176 /* lucca_screen_init: initializes a LuccaScreen from a GdkScreen, taking over as window manager for that screen */
177 void lucca_screen_initialize(LuccaScreen* screen, GdkScreen* gdkscreen, LuccaDisplay* display, GError** error);
179 /* lucca_screen_recalculate_docks: update positions of docking windows and */
180 void lucca_screen_recalculate_docks(LuccaScreen* screen);
182 /* lucca_screen_add_hotkey: grabs a hotkey */
183 void lucca_screen_add_hotkey(LuccaScreen* screen, HotkeyInfo* info);
185 /* lucca_window_new: creates a LuccaWindow from an X Window (and adds to a LuccaDisplay) or returns NULL if the window should not be managed
186 existing: TRUE if this is an existing window (as opposed to a window that is currently asking to be mapped)
187 internal: TRUE if this window was created with lucca_display_create_internal
189 LuccaWindow* lucca_window_new(Window xwindow, LuccaScreen* screen, gboolean existing);
191 /* lucca_window_new_internal: creates a LuccaWindow from a LuccaBin, stealing a reference to the bin */
192 LuccaWindow* lucca_window_new_internal(LuccaBin* bin, LuccaScreen* screen);
194 /* lucca_window_get_atoms: get a list of atoms in a window property, to be freed with XFree() */
195 Atom* lucca_window_get_atoms(LuccaWindow* window, gchar* property, guint* length);
197 /* lucca_window_get_utf8: Gets a utf8-encoded property from a window and writes it to value
198 value should be freed with g_free() */
199 gchar* lucca_window_get_utf8(LuccaWindow* window, gchar* property);
201 /* lucca_window_get_cardinals: gets a list of CARDINAL values in a window property, to be freed with XFree() */
202 int* lucca_window_get_cardinals(LuccaWindow* window, gchar* property, guint* length);
204 /* lucca_window_withdraw_finish: complete the process of withdrawing a client that has hidden (or destroyed) its window */
205 void lucca_window_withdraw_finish(LuccaWindow* window);
207 /* lucca_window_send_configure: send a synthetic ConfigureNotify event to a window */
208 void lucca_window_send_configure(LuccaWindow* window);
210 /* lucca_window_property_notify: called when we get a PropertyNotify event for a window */
211 void lucca_window_property_notify(LuccaWindow* window, XPropertyEvent* event);
213 /* lucca_window_netwmstate_request: called when we get a ClientMessage of type _NET_WM_STATE */
214 void lucca_window_netwmstate_request(LuccaWindow* window, XClientMessageEvent* event);
216 #endif