aboutsummaryrefslogtreecommitdiffstats
path: root/matchbox2/mb-wm-types.h
blob: 9c1c71a698ddc91337e7be80470e5cfe604eba6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/*
 *  Matchbox Window Manager II - A lightweight window manager not for the
 *                               desktop.
 *
 *  Authored By Matthew Allum <mallum@o-hand.com>
 *
 *  Copyright (c) 2005 OpenedHand Ltd - http://o-hand.com
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 */

#ifndef _HAVE_MB_WM_TYPES_H
#define _HAVE_MB_WM_TYPES_H

#include <matchbox2/mb-wm-config.h>

#if USE_GLIB_MAINLOOP
#include <glib.h>
#endif

#include <X11/Xlib.h>

typedef struct MBWMFuncInfo
{
  void *func;
  void *data;
  void *userdata;
  unsigned long signal;
  unsigned long id;
} MBWMFuncInfo;

typedef struct MBGeometry
{
  int x,y;
  int width,height;

} MBGeometry;

typedef struct MBWMList MBWMList;

typedef void (*MBWMListForEachCB) (void *data, void *userdata);

struct MBWMList
{
  MBWMList *next, *prev;
  void *data;
};

typedef struct MBWMClientWindowAttributes /* Needs to be sorted */
{
  Visual *visual;
  Window root;
  int class;
  int bit_gravity;
  int win_gravity;
  int backing_store;
  unsigned long backing_planes;
  unsigned long backing_pixel;
  Bool save_under;
  Colormap colormap;
  Bool map_installed;
  int map_state;
  long all_event_masks;
  long your_event_mask;
  long do_not_propagate_mask;
  Bool override_redirect;

} MBWMClientWindowAttributes ;

typedef struct MBWMRgbaIcon
{
  int width;
  int height;
  unsigned long *pixels;
} MBWMRgbaIcon;

typedef struct MBWindowManager             MBWindowManager;
typedef struct MBWindowManagerClient       MBWindowManagerClient;
typedef struct MBWindowManagerClientClass  MBWindowManagerClientClass;
typedef struct MBWindowManagerClientPriv   MBWindowManagerClientPriv;
typedef struct MBWMClientWindow            MBWMClientWindow;
typedef struct MBWMClientWindowClass       MBWMClientWindowClass;
typedef struct MBWMTheme                   MBWMTheme;
typedef struct MBWMThemeClass              MBWMThemeClass;
typedef struct MBWMThemePng                MBWMThemePng;
typedef struct MBWMThemePngClass           MBWMThemePngClass;
typedef enum   MBWMThemeCaps               MBWMThemeCaps;
typedef struct MBWMDecor                   MBWMDecor;
typedef struct MBWMDecorClass              MBWMDecorClass;
typedef struct MBWMDecorButton             MBWMDecorButton;
typedef struct MBWMDecorButtonClass        MBWMDecorButtonClass;
typedef struct MBWMLayout                  MBWMLayout;
typedef struct MBWMLayoutClass             MBWMLayoutClass;
typedef struct MBWMMainContext             MBWMMainContext;
typedef struct MBWMMainContextClass        MBWMMainContextClass;
typedef struct MBWMCompMgr                 MBWMCompMgr;
typedef struct MBWMCompMgrClass            MBWMCompMgrClass;
typedef struct MBWMCompMgrDefault          MBWMCompMgrDefault;
typedef struct MBWMCompMgrDefaultPrivate   MBWMCompMgrDefaultPrivate;
typedef struct MBWMCompMgrDefaultClass     MBWMCompMgrDefaultClass;
typedef struct MBWMCompMgrClient           MBWMCompMgrClient;
typedef struct MBWMCompMgrClientClass      MBWMCompMgrClientClass;
typedef struct MBWMCompMgrDefaultClient    MBWMCompMgrDefaultClient;
typedef struct MBWMCompMgrDefaultClientClass MBWMCompMgrDefaultClientClass;
typedef struct MBWMCompMgrDefaultClentPrivate MBWMCompMgrDefaultClientPrivate;

typedef enum MBWMClientType
{
  MBWMClientTypeApp      = (1 << 0),
  MBWMClientTypeDialog   = (1 << 1),
  MBWMClientTypePanel    = (1 << 2),
  MBWMClientTypeDesktop  = (1 << 3),
  MBWMClientTypeInput    = (1 << 4),
  MBWMClientTypeMenu     = (1 << 5),
  MBWMClientTypeNote     = (1 << 6),
  MBWMClientTypeOverride = (1 << 7),

  MBWMClientTypeLast    = MBWMClientTypeOverride,
} MBWMClientType;

typedef enum _MBWMCompMgrClientEvent
{
  MBWMCompMgrClientEventNone     = 0,
  MBWMCompMgrClientEventMinimize,
  MBWMCompMgrClientEventMap,
  MBWMCompMgrClientEventUnmap,

  _MBWMCompMgrClientEventLast,
} MBWMCompMgrClientEvent;

typedef enum _MBWMGravity
{
  MBWMGravityNone       = 0,
  MBWMGravityNorth,
  MBWMGravityNorthEast,
  MBWMGravityEast,
  MBWMGravitySouthEast,
  MBWMGravitySouth,
  MBWMGravitySouthWest,
  MBWMGravityWest,
  MBWMGravityNorthWest,
  MBWMGravityCenter,
} MBWMGravity;

typedef unsigned long MBWMCookie;

typedef enum MBWMAtom
{
  /* ICCCM */

  MBWM_ATOM_WM_NAME = 0,
  MBWM_ATOM_WM_STATE,
  MBWM_ATOM_WM_HINTS,
  MBWM_ATOM_WM_NORMAL_HINTS,
  MBWM_ATOM_WM_CHANGE_STATE,
  MBWM_ATOM_WM_PROTOCOLS,
  MBWM_ATOM_WM_DELETE_WINDOW,
  MBWM_ATOM_WM_COLORMAP_WINDOWS,
  MBWM_ATOM_WM_CLIENT_MACHINE,
  MBWM_ATOM_WM_TRANSIENT_FOR,
  MBWM_ATOM_WM_TAKE_FOCUS,

  /* EWMH */

  MBWM_ATOM_NET_WM_WINDOW_TYPE,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_NORMAL,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_INPUT,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_DOCK,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_MENU,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_DIALOG,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_SPLASH,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_DESKTOP,
  MBWM_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION,

  MBWM_ATOM_NET_WM_STATE,
  MBWM_ATOM_NET_WM_STATE_FULLSCREEN,
  MBWM_ATOM_NET_WM_STATE_MODAL,
  MBWM_ATOM_NET_WM_STATE_ABOVE,
  MBWM_ATOM_NET_WM_STATE_STICKY,
  MBWM_ATOM_NET_WM_STATE_MAXIMIZED_VERT,
  MBWM_ATOM_NET_WM_STATE_MAXIMIZED_HORZ,
  MBWM_ATOM_NET_WM_STATE_SHADED,
  MBWM_ATOM_NET_WM_STATE_SKIP_TASKBAR,
  MBWM_ATOM_NET_WM_STATE_SKIP_PAGER,
  MBWM_ATOM_NET_WM_STATE_HIDDEN,
  MBWM_ATOM_NET_WM_STATE_BELOW,
  MBWM_ATOM_NET_WM_STATE_DEMANDS_ATTENTION,

  MBWM_ATOM_NET_SUPPORTED,
  MBWM_ATOM_NET_CLIENT_LIST,
  MBWM_ATOM_NET_NUMBER_OF_DESKTOPS,
  MBWM_ATOM_NET_ACTIVE_WINDOW,
  MBWM_ATOM_NET_SUPPORTING_WM_CHECK,
  MBWM_ATOM_NET_CLOSE_WINDOW,
  MBWM_ATOM_NET_WM_NAME,
  MBWM_ATOM_NET_WM_USER_TIME,

  MBWM_ATOM_NET_CLIENT_LIST_STACKING,
  MBWM_ATOM_NET_CURRENT_DESKTOP,
  MBWM_ATOM_NET_WM_DESKTOP,
  MBWM_ATOM_NET_WM_ICON,
  MBWM_ATOM_NET_DESKTOP_GEOMETRY,
  MBWM_ATOM_NET_WORKAREA,
  MBWM_ATOM_NET_SHOWING_DESKTOP,
  MBWM_ATOM_NET_DESKTOP_VIEWPORT,
  MBWM_ATOM_NET_FRAME_EXTENTS,
  MBWM_ATOM_NET_WM_FULL_PLACEMENT,

  MBWM_ATOM_NET_WM_ALLOWED_ACTIONS,
  MBWM_ATOM_NET_WM_ACTION_MOVE,
  MBWM_ATOM_NET_WM_ACTION_RESIZE,
  MBWM_ATOM_NET_WM_ACTION_MINIMIZE,
  MBWM_ATOM_NET_WM_ACTION_SHADE,
  MBWM_ATOM_NET_WM_ACTION_STICK,
  MBWM_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ,
  MBWM_ATOM_NET_WM_ACTION_MAXIMIZE_VERT,
  MBWM_ATOM_NET_WM_ACTION_FULLSCREEN,
  MBWM_ATOM_NET_WM_ACTION_CHANGE_DESKTOP,
  MBWM_ATOM_NET_WM_ACTION_CLOSE,

  MBWM_ATOM_NET_WM_PING,
  MBWM_ATOM_NET_WM_PID,

  /* Startup Notification */
  MBWM_ATOM_NET_STARTUP_ID,

  /* Misc */

  MBWM_ATOM_UTF8_STRING,
  MBWM_ATOM_MOTIF_WM_HINTS,
  MBWM_ATOM_WIN_SUPPORTING_WM_CHECK,

  MBWM_ATOM_NET_WM_CONTEXT_HELP,
  MBWM_ATOM_NET_WM_CONTEXT_ACCEPT,
  MBWM_ATOM_NET_WM_CONTEXT_CUSTOM,
  MBWM_ATOM_NET_WM_SYNC_REQUEST,

  MBWM_ATOM_CM_TRANSLUCENCY,

  MBWM_ATOM_MB_APP_WINDOW_LIST_STACKING,
  MBWM_ATOM_MB_THEME,
  MBWM_ATOM_MB_THEME_NAME,
  MBWM_ATOM_MB_COMMAND,
  MBWM_ATOM_MB_GRAB_TRANSFER,
  MBWM_ATOM_MB_CURRENT_APP_WINDOW,

  /* FIXME: Custom/Unused to sort out
   *
   * MB_WM_STATE_DOCK_TITLEBAR,
   *
   * _NET_WM_SYNC_REQUEST_COUNTER,
   * _NET_WM_SYNC_REQUEST,
   *
   * MB_CLIENT_EXEC_MAP,
   * MB_CLIENT_STARTUP_LIST,
   * MB_DOCK_TITLEBAR_SHOW_ON_DESKTOP,
   *
   * WINDOW_TYPE_MESSAGE,
   *
  */

  MBWM_ATOM_COUNT

} MBWMAtom;

/* Keys */

typedef struct MBWMKeyBinding MBWMKeyBinding;
typedef struct MBWMKeys       MBWMKeys;

typedef void (*MBWMKeyPressedFunc) (MBWindowManager   *wm,
				    MBWMKeyBinding    *binding,
				    void              *userdata);

typedef void (*MBWMKeyDestroyFunc) (MBWindowManager   *wm,
				    MBWMKeyBinding    *binding,
				    void              *userdata);

struct MBWMKeyBinding
{
  KeySym                   keysym;
  int                      modifier_mask;
  MBWMKeyPressedFunc       pressed;
  MBWMKeyDestroyFunc       destroy;
  void                    *userdata;
  /* FIXME: free func */
};

/* Event Callbacks */

typedef Bool (*MBWMXEventFunc)
     (void              *xev,
      void              *userdata);

typedef Bool (*MBWindowManagerMapNotifyFunc)
     (XMapEvent         *xev,
      void              *userdata);

typedef Bool (*MBWindowManagerClientMessageFunc)
     (XClientMessageEvent *xev,
      void                *userdata);

typedef Bool (*MBWindowManagerMapRequestFunc)
     (XMapRequestEvent  *xev,
      void              *userdata);

typedef Bool (*MBWindowManagerUnmapNotifyFunc)
     (XUnmapEvent       *xev,
      void              *userdata);

typedef Bool (*MBWindowManagerDestroyNotifyFunc)
     (XDestroyWindowEvent  *xev,
      void                 *userdata);

typedef Bool (*MBWindowManagerConfigureNotifyFunc)
     (XConfigureEvent      *xev,
      void                 *userdata);

typedef Bool (*MBWindowManagerConfigureRequestFunc)
     (XConfigureRequestEvent  *xev,
      void                    *userdata);

typedef Bool (*MBWindowManagerKeyPressFunc)
     (XKeyEvent               *xev,
      void                    *userdata);

typedef Bool (*MBWindowManagerPropertyNotifyFunc)
     (XPropertyEvent          *xev,
      void                    *userdata);

typedef Bool (*MBWindowManagerButtonPressFunc)
     (XButtonEvent            *xev,
      void                    *userdata);

typedef Bool (*MBWindowManagerButtonReleaseFunc)
     (XButtonEvent            *xev,
      void                    *userdata);

typedef Bool (*MBWindowManagerMotionNotifyFunc)
     (XMotionEvent            *xev,
      void                    *userdata);

typedef Bool (*MBWindowManagerTimeOutFunc)
     (void                    *userdata);

#if USE_GLIB_MAINLOOP
typedef GIOChannel   MBWMIOChannel;
typedef GIOCondition MBWMIOCondition;
#else
typedef int MBWMIOChannel;
typedef int MBWMIOCondition;
#endif

typedef Bool (*MBWindowManagerFdWatchFunc)
     (MBWMIOChannel           *channel,
      MBWMIOCondition          events,
      void                    *userdata);

typedef struct MBWMXEventFuncInfo
{
  MBWMXEventFunc func;
  Window         xwindow;
  void          *userdata;
  unsigned long  id;
}
MBWMXEventFuncInfo;

typedef struct MBWMTimeOutEventInfo MBWMTimeOutEventInfo;
typedef struct MBWMFdWatchInfo      MBWMFdWatchInfo;

typedef enum MBWMDecorButtonFlags
{
  MB_WM_DECOR_BUTTON_INVISIBLE = (1<<1)

} MBWMDecorButtonFlags;

typedef enum MBWMDecorType
{
  MBWMDecorTypeNorth = 1,
  MBWMDecorTypeSouth,
  MBWMDecorTypeEast,
  MBWMDecorTypeWest,

} MBWMDecorType;

typedef enum MBWMSyncType
{
  MBWMSyncStacking          = (1<<1),
  MBWMSyncGeometry          = (1<<2),
  MBWMSyncVisibility        = (1<<3),
  MBWMSyncDecor             = (1<<4),
  MBWMSyncConfigRequestAck  = (1<<5),
  MBWMSyncFullscreen        = (1<<6),
} MBWMSyncType;

typedef struct MBWMColor
{
  double r;
  double g;
  double b;
  double a;

  Bool set;
}MBWMColor;

typedef enum MBWMCompMgrShadowType
{
  MBWM_COMP_MGR_SHADOW_NONE = 0,
  MBWM_COMP_MGR_SHADOW_SIMPLE,
  MBWM_COMP_MGR_SHADOW_GAUSSIAN,
} MBWMCompMgrShadowType;

typedef enum MBWMModality
{
  MBWMModalityNormal = 0, /* Handle modality per EWMH */
  MBWMModalitySystem,     /* Treat all modal dialogs as if system modal */
  MBWMModalityNone,       /* Ignore modality */
}MBWMModality;


/* mb remote commands */
#define MB_CMD_SET_THEME   1
#define MB_CMD_EXIT        2
#define MB_CMD_DESKTOP     3
#define MB_CMD_NEXT        4
#define MB_CMD_PREV        5
#define MB_CMD_MISC        7 	/* spare, used for debugging */
#define MB_CMD_COMPOSITE   8
#define MB_CMB_KEYS_RELOAD 9

#endif