1 #ifndef __WINMGR_H
2 #define __WINMGR_H
3 
4 /* all of this is still experimental -- feedback welcome */
5 /* 0.5
6  *    - added WIN_LAYER_MENU
7  */
8 /* 0.4
9  *   - added WIN_WORKSPACES for windows appearing on multiple workspaces
10  *     at the same time.
11  *   - added WinStateDocked
12  *   - added WinStateSticky for possible virtual desktops
13  *   - changed WIN_ICONS format to be extensible and more complete
14  */
15 /* 0.3
16  *   - renamed WinStateSticky -> WinStateAllWorkspaces
17  */
18 /* 0.2
19  *   - added separate flags for horizonal/vertical maximized state
20  */
21 /* 0.1 */
22 
23 /* TODO:
24  *   - packed properties for STATE and HINTS (WIN_ALL_STATE and WIN_ALL_HINTS)
25  *     currently planned to look like this:
26  *      CARD32 nhints
27  *        for each hint:
28  *         CARD32 atom (hint type)
29  *         CARD32 count (data length)
30  *         CARD32 data[count]
31  *         ...
32  *     this has the advantage of being slightly faster, but
33  *     demands that all hints are handled at one place. WM ignores
34  *     other hints of the same type if these two are present.
35 
36  *   - check out WMaker and KDE hints to make a superset of all
37  *   - virtual desktop, handling of virtual (>screen) scrolling
38  *     desktops and pages (fvwm like?)
39  *   - vroot.h?
40  *   - MOZILLA_ZORDER (it should be possible to do the same thing
41  *      with WIN_* hints)
42  *   - there should be a way to coordinate corner/edge points of the frames
43  *     (for placement). ICCCM is vague on this issue. icewm prefers to treat
44  *     windows as client-area and titlebar when doing the placement (ignoring
45  *     the frame)
46  *   - hint limit wm key/mouse bindings on a window
47  * possible
48  *   - what does MOTIF_WM_INFO do?
49  *   - WIN_MAXIMIZED_GEOMETRY
50  *   - WIN_RESIZE (protocol that allows applications to start sizing the frame)
51  *   - WIN_FOCUS (protocol for focusing a window)
52  */
53 
54 #define XA_WIN_PROTOCOLS       "_WIN_PROTOCOLS"
55 /* Type: array of Atom
56  *       set on Root window by the window manager.
57  *
58  * This property contains all of the protocols/hints supported by
59  * the window manager (WM_HINTS, MWM_HINTS, WIN_*, etc.
60  */
61 
62 #define XA_WIN_SUPPORTING_WM_CHECK "_WIN_SUPPORTING_WM_CHECK"
63 /* XID of window created by WM, used to check */
64 
65 #define XA_WIN_ICONS           "_WIN_ICONS"
66 /* Type: array of CARD32
67  *       first item is icon count (n)
68  *       second item is icon record length (in CARD32s)
69  *       this is followed by (n) icon records as follows
70  *           pixmap (XID)
71  *           mask (XID)
72  *           width (CARD32)
73  *           height (CARD32)
74  *           depth (of pixmap, mask is assumed to be of depth 1) (CARD32)
75  *           drawable (screen root drawable of pixmap) (XID)
76  *           ... additional fields can be added at the end of this list
77  *
78  * This property contains additional icons for the application.
79  * if this property is set, the WM will ignore default X icon hints
80  * and KWM_WIN_ICON hint.
81  *
82  * Icon Mask can be None if transparency is not required.
83  *
84  * Icewm currently needs/uses icons of size 16x16 and 32x32 with default
85  * depth. Applications are recommended to set several icons sizes
86  * (recommended 16x16,32x32,48x48 at least)
87  *
88  * TODO: WM should present a wishlist of desired icons somehow. (standard
89  * WM_ICON_SIZES property is only a partial solution). 16x16 icons can be
90  * quite small on large resolutions.
91  */
92 
93 /* workspace */
94 #define XA_WIN_WORKSPACE       "_WIN_WORKSPACE"
95 /* Type: CARD32
96  *       Root Window: current workspace, set by the window manager
97  *
98  *       Application Window: current workspace. The default workspace
99  *       can be set by applications, but they must use ClientMessages to
100  *       change them. When window is mapped, the propery should only be
101  *       updated by the window manager.
102  *
103  * Applications wanting to change the current workspace should send
104  * a ClientMessage to the Root window like this:
105  *     xev.type = ClientMessage;
106  *     xev.window = root_window or toplevel_window;
107  *     xev.message_type = _XA_WIN_WORKSPACE;
108  *     xev.format = 32;
109  *     xev.data.l[0] = workspace;
110  *     xev.data.l[1] = timeStamp;
111  *     XSendEvent(display, root, False, SubstructureNotifyMask, (XEvent *) &xev);
112  *
113  */
114 
115 #define XA_WIN_WORKSPACE_COUNT "_WIN_WORKSPACE_COUNT"
116 /* Type: CARD32
117  *       workspace count, set by window manager
118  *
119  * NOT FINALIZED/IMPLEMENTED YET
120  */
121 
122 #define XA_WIN_WORKSPACE_NAMES "_WIN_WORKSPACE_NAMES"
123 /* Type: StringList (TextPropery)
124  *
125  *
126  * IMPLEMENTED but not FINALIZED.
127  * perhaps the name should be separate for each workspace (like KDE).
128  * this where WIN_WORKSPACE_COUNT comes into play.
129  */
130 
131 #define WinWorkspaceInvalid    -1L
132 
133 /* workspaces */
134 #define XA_WIN_WORKSPACES "_WIN_WORKSPACES"
135 /* Type: array of CARD32
136  *       bitmask of workspaces that application appears on
137  *
138  * Applications must still set WIN_WORKPACE property to define
139  * the default window (if the WM has to switch workspaces) and
140  * specify the workspace for WMs that do not support this property.
141  *
142  * The same policy applies as for WIN_WORKSPACE: default can be set by
143  * applications, but is only changed by the window manager after the
144  * window is mapped.
145  *
146  * Applications wanting to change the current workspace should send
147  * a ClientMessage to the Root window like this:
148  *     xev.type = ClientMessage;
149  *     xev.window = root_window or toplevel_window;
150  *     xev.message_type = _XA_WIN_WORKSPACES_ADD; // or _REMOVE
151  *     xev.format = 32;
152  *     xev.data.l[0] = index; // index of item
153  *     xev.data.l[1] = bitmask; // to assign, or, or reset
154  *     xev.data.l[2] = timestamp; // of event that caused operation
155  *     XSendEvent(display, root, False, SubstructureNotifyMask, (XEvent *) &xev);
156  */
157 #define XA_WIN_WORKSPACES_ADD "_WIN_WORKSPACES_ADD"
158 #define XA_WIN_WORKSPACES_REMOVE "_WIN_WORKSPACES_REMOVE"
159 
160 /* layer */
161 #define XA_WIN_LAYER           "_WIN_LAYER"
162 /* Type: CARD32
163  *       window layer
164  *
165  * Window layer.
166  * Windows with LAYER=WinLayerDock determine size of the Work Area
167  * (WIN_WORKAREA). Windows below dock layer are resized to the size
168  * of the work area when maximized. Windows above dock layer are
169  * maximized to the entire screen space.
170  *
171  * The default can be set by application, but when window is mapped
172  * only window manager can change this. If an application wants to change
173  * the window layer it should send the ClientMessage to the root window
174  * like this:
175  *     xev.type = ClientMessage;
176  *     xev.window = toplevel_window;
177  *     xev.message_type = _XA_WIN_LAYER;
178  *     xev.format = 32;
179  *     xev.data.l[0] = layer;
180  *     xev.data.l[1] = timeStamp;
181  *     XSendEvent(display, root, False, SubstructureNotifyMask, (XEvent *) &xev);
182  *
183  * TODO: A few available layers could be used for WMaker menus/submenus
184  * (comments?)
185  *
186  * Partially implemented. Currently requires all docked windows to be
187  * sticky (only one workarea for all workspaces). Otherwise non-docked sticky
188  * windows could (?) move when switching workspaces (annoying).
189  */
190 
191 #define WinLayerCount          16
192 #define WinLayerInvalid        -1L
193 
194 #define WinLayerDesktop        0L
195 #define WinLayerBelow          2L
196 #define WinLayerNormal         4L
197 #define WinLayerOnTop          6L
198 #define WinLayerDock           8L
199 #define WinLayerAboveDock      10L
200 #define WinLayerMenu           12L
201 #define WinLayerFullscreen     14L // hack, for now
202 #define WinLayerAboveAll       15L // for taskbar auto hide
203 
204 /* task bar tray */
205 #define XA_WIN_TRAY             "_ICEWM_TRAY"
206 /* Type: CARD32
207  *       window task bar tray option
208  *
209  * Window with tray=Ignore (default) has its window button only on TaskPane.
210  * Window with tray=Minimized has its icon on TrayPane and if it is
211  * not minimized it has also window button on TaskPane (no button for
212  * minimized window).
213  * Window with tray=Exclusive has only its icon on TrayPane and there is no
214  * window button on TaskPane.
215  *
216  * The default can be set by application, but when window is mapped
217  * only window manager can change this. If an application wants to change
218  * the window tray option it should send the ClientMessage to the root window
219  * like this:
220  *
221  *     xev.type = ClientMessage;
222  *     xev.window = toplevel_window;
223  *     xev.message_type = _XA_WIN_TRAY;
224  *     xev.format = 32;
225  *     xev.data.l[0] = tray_opt;
226  *     xev.data.l[1] = timeStamp;
227  *     XSendEvent(display, root, False, SubstructureNotifyMask, (XEvent *) &xev);
228  */
229 
230 #define WinTrayOptionCount      3
231 #define WinTrayInvalid          -1L
232 
233 #define WinTrayIgnore           0L
234 #define WinTrayMinimized        1L
235 #define WinTrayExclusive        2L
236 
237 /* state */
238 #define XA_WIN_STATE           "_WIN_STATE"
239 
240 /* Type CARD32[2]
241  *      window state. First CARD32 is the mask of set/supported states,
242  *      the second one is the state.
243  *
244  * The default value for this property can be set by applications.
245  * When window is mapped, the property is updated by the window manager
246  * as necessary. Applications can request the state change by sending
247  * the client message to the root window like this:
248  *
249  *   xev.type = ClientMessage;
250  *   xev.window = toplevel_window;
251  *   xev.message_type = _XA_WIN_STATE;
252  *   xev.format = 32;
253  *   xev.data.l[0] = mask; // mask of the states to change
254  *   xev.data.l[1] = state; // new state values
255  *   xev.data.l[2] = timeStamp;
256  *   XSendEvent(display, root, False, SubstructureNotifyMask, (XEvent *) &xev);
257  */
258 #if 0
259 // From wm-comp.ps:
260 #define WIN_STATE_STICKY            (1<<0) /* everyone knows sticky */
261 #define WIN_STATE_MINIMIZED         (1<<1) /* Reserved - definition is unclear */
262 #define WIN_STATE_MAXIMIZED_VERT    (1<<2) /* window in maximized V state */
263 #define WIN_STATE_MAXIMIZED_HORIZ   (1<<3) /* window in maximized H state */
264 #define WIN_STATE_HIDDEN            (1<<4) /* not on taskbar but window visible */
265 #define WIN_STATE_SHADED            (1<<5) /* shaded (MacOS / Afterstep style) */
266 #define WIN_STATE_HID_WORKSPACE     (1<<6) /* not on current desktop */
267 #define WIN_STATE_HID_TRANSIENT     (1<<7) /* owner of transient is hidden */
268 #define WIN_STATE_FIXED_POSITION    (1<<8) /* window is fixed in position even */
269 #define WIN_STATE_ARRANGE_IGNORE    (1<<9) /* ignore for auto arranging */
270 #endif
271 
272 #define WinStateSticky         (1 << 0)   /* sticks to virtual desktop */
273 #define WinStateMinimized      (1 << 1)   /* to iconbox,taskbar,... */
274 #define WinStateMaximizedVert  (1 << 2)   /* maximized vertically */
275 #define WinStateMaximizedHoriz (1 << 3)   /* maximized horizontally */
276 #define WinStateMaximizedBoth  (3 << 2)   /* maximized vert+horiz */
277 #define WinStateHidden         (1 << 4)   /* not on taskbar if any, but still accessible */
278 #define WinStateRollup         (1 << 5)   /* only titlebar visible */
279 #define WinStateHidWorkspace   (1 << 6)   /* not on current desktop */
280 #define WinStateHidTransient   (1 << 7)   /* owner of transient is hidden */
281 #define WinStateFixedPosition  (1 << 8)   /* fixed position on virtual desktop*/
282 #define WinStateArrangeIgnore  (1 << 9)   /* ignore for auto arranging */
283 #define WinStateFullscreen     (1 << 10)  /* fullscreen (no layout limits) */
284 #define WinStateFocused        (1 << 21)  /* has the focus */
285 #define WinStateUrgent         (1 << 22)  /* demands attention */
286 #define WinStateSkipPager      (1 << 23)  /* skip pager */
287 #define WinStateSkipTaskBar    (1 << 24)  /* skip taskbar */
288 #define WinStateModal          (1 << 25)  /* modal */
289 #define WinStateBelow          (1 << 26)  /* below layer */
290 #define WinStateAbove          (1 << 27)  /* above layer */
291 #define WinStateWasHidden      (1 << 29)  /* was hidden when parent was minimized/hidden */
292 #define WinStateWasMinimized   (1 << 30)  /* was minimized when parent was minimized/hidden */
293 #define WinStateUnmapped       (WinStateMinimized|WinStateHidden|WinStateRollup)
294 
295 #define WIN_STATE_ALL (WinStateSticky | WinStateUnmapped |\
296                        WinStateMaximizedBoth | WinStateFullscreen)
297 /* Win state flags which are also in _NET_WM_STATE: */
298 #define WIN_STATE_NET (WIN_STATE_ALL | WinStateModal | WinStateUrgent |\
299                        WinStateSkipPager | WinStateSkipTaskBar |\
300                        WinStateBelow | WinStateAbove | WinStateFocused)
301 
302 
303 /* hints */
304 // From wm-comp.ps:
305 // #define WIN_HINTS_SKIP_FOCUS        (1<<0) /* "alt-tab" skips this win */
306 // #define WIN_HINTS_SKIP_WINLIST      (1<<1) /* do not show in window list */
307 // #define WIN_HINTS_SKIP_TASKBAR      (1<<2) /* do not show on taskbar */
308 // #define WIN_HINTS_GROUP_TRANSIENT   (1<<3) /* Reserved - definition is unclear */
309 // #define WIN_HINTS_FOCUS_ON_CLICK    (1<<4) /* app only accepts focus if clicked */
310 
311 #define XA_WIN_HINTS            "_WIN_HINTS"
312 #define WinHintsSkipFocus       (1 << 0) /* "alt-tab" skips this win */
313 #define WinHintsSkipWindowMenu  (1 << 1) /* do not show in window list */
314 #define WinHintsSkipTaskBar     (1 << 2) /* do not show on taskbar */
315 #define WinHintsGroupTransient  (1 << 3) /* Reserved - definition is unclear */
316 #define WinHintsFocusOnClick    (1 << 4) /* app only accepts focus when clicked */
317 #define WinHintsDoNotCover      (1 << 5) /* attempt to not cover this window */
318 #define WinHintsDockHorizontal  (1 << 6) /* docked horizontally */
319 
320 #define WIN_HINTS_ALL (WinHintsSkipFocus | WinHintsSkipWindowMenu |\
321                        WinHintsSkipTaskBar | WinHintsGroupTransient |\
322                        WinHintsFocusOnClick | WinHintsDoNotCover)
323 
324 /* work area of current workspace -- */
325 #define XA_WIN_WORKAREA        "_WIN_WORKAREA"
326 /*
327  * CARD32[4]
328  *     minX, minY, maxX, maxY of workarea.
329  *     set/updated only by the window manager
330  *
331  * When windows are maximized they occupy the entire workarea except for
332  * the titlebar at the top (in icewm window frame is not visible).
333  *
334  * Note: when WORKAREA changes, the application window are automatically
335  * repositioned and maximized windows are also resized.
336  */
337 
338 #define XA_WIN_CLIENT_LIST    "_WIN_CLIENT_LIST"
339 /*
340  * XID[]
341  *
342  * list of clients the WM is currently managing
343  */
344 
345 
346 /* hack for gmc */
347 #define XA_WIN_DESKTOP_BUTTON_PROXY "_WIN_DESKTOP_BUTTON_PROXY"
348 
349 /* not really used: */
350 #define XA_WIN_AREA "_WIN_AREA"
351 #define XA_WIN_AREA_COUNT "_WIN_AREA_COUNT"
352 
353 #define XA_WIN_APP_STATE "_WIN_APP_STATE"
354 #define XA_WIN_EXPANDED_SIZE "_WIN_EXPANDED_SIZE"
355 
356 #endif
357 
358 // vim: set sw=4 ts=4 et:
359