~ubuntu-branches/ubuntu/saucy/mutter/saucy

« back to all changes in this revision

Viewing changes to src/meta/common.h

  • Committer: Bazaar Package Importer
  • Author(s): Rico Tzschichholz
  • Date: 2011-04-10 22:27:59 UTC
  • mfrom: (0.7.1 upstream) (0.3.20 experimental)
  • Revision ID: james.westby@ubuntu.com-20110410222759-o6n1i5p0unsti44n
Tags: 3.0.0-0ubuntu1
* New upstream release

* Merge with debian experimental (LP: #742458), remaining changes:
  + debian/patches/03_link_gles2.patch: Link to clutter-glx-1.0
    explicitily at the end of link flags, to bring in libGLESv2 on armel.
* debian/control.in:
  + rename gir package to gir1.2-mutter-3.0
* debian/libmutter0.symbols:
  + updated
* debian/patches:
  + fix 03_link_gles2.patch 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
2
 
 
3
/* Mutter common types shared by core.h and ui.h */
 
4
 
 
5
/* 
 
6
 * Copyright (C) 2001 Havoc Pennington
 
7
 * Copyright (C) 2005 Elijah Newren
 
8
 * 
 
9
 * This program is free software; you can redistribute it and/or
 
10
 * modify it under the terms of the GNU General Public License as
 
11
 * published by the Free Software Foundation; either version 2 of the
 
12
 * License, or (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful, but
 
15
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
 * General Public License for more details.
 
18
 * 
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
22
 * 02111-1307, USA.
 
23
 */
 
24
 
 
25
#ifndef META_COMMON_H
 
26
#define META_COMMON_H
 
27
 
 
28
/* Don't include GTK or core headers here */
 
29
#include <X11/Xlib.h>
 
30
#include <glib.h>
 
31
 
 
32
typedef struct _MetaResizePopup MetaResizePopup;
 
33
 
 
34
typedef enum
 
35
{
 
36
  META_FRAME_ALLOWS_DELETE            = 1 << 0,
 
37
  META_FRAME_ALLOWS_MENU              = 1 << 1,
 
38
  META_FRAME_ALLOWS_MINIMIZE          = 1 << 2,
 
39
  META_FRAME_ALLOWS_MAXIMIZE          = 1 << 3,
 
40
  META_FRAME_ALLOWS_VERTICAL_RESIZE   = 1 << 4,
 
41
  META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 5,
 
42
  META_FRAME_HAS_FOCUS                = 1 << 6,
 
43
  META_FRAME_SHADED                   = 1 << 7,
 
44
  META_FRAME_STUCK                    = 1 << 8,
 
45
  META_FRAME_MAXIMIZED                = 1 << 9,
 
46
  META_FRAME_ALLOWS_SHADE             = 1 << 10,
 
47
  META_FRAME_ALLOWS_MOVE              = 1 << 11,
 
48
  META_FRAME_FULLSCREEN               = 1 << 12,
 
49
  META_FRAME_IS_FLASHING              = 1 << 13,
 
50
  META_FRAME_ABOVE                    = 1 << 14,
 
51
  META_FRAME_TILED_LEFT               = 1 << 15,
 
52
  META_FRAME_TILED_RIGHT              = 1 << 16
 
53
} MetaFrameFlags;
 
54
 
 
55
typedef enum
 
56
{
 
57
  META_MENU_OP_NONE        = 0,
 
58
  META_MENU_OP_DELETE      = 1 << 0,
 
59
  META_MENU_OP_MINIMIZE    = 1 << 1,
 
60
  META_MENU_OP_UNMAXIMIZE  = 1 << 2,
 
61
  META_MENU_OP_MAXIMIZE    = 1 << 3,
 
62
  META_MENU_OP_UNSHADE     = 1 << 4,
 
63
  META_MENU_OP_SHADE       = 1 << 5,
 
64
  META_MENU_OP_UNSTICK     = 1 << 6,
 
65
  META_MENU_OP_STICK       = 1 << 7,
 
66
  META_MENU_OP_WORKSPACES  = 1 << 8,
 
67
  META_MENU_OP_MOVE        = 1 << 9,
 
68
  META_MENU_OP_RESIZE      = 1 << 10,
 
69
  META_MENU_OP_ABOVE       = 1 << 11,
 
70
  META_MENU_OP_UNABOVE     = 1 << 12,
 
71
  META_MENU_OP_MOVE_LEFT   = 1 << 13,
 
72
  META_MENU_OP_MOVE_RIGHT  = 1 << 14,
 
73
  META_MENU_OP_MOVE_UP     = 1 << 15,
 
74
  META_MENU_OP_MOVE_DOWN   = 1 << 16,
 
75
  META_MENU_OP_RECOVER     = 1 << 17
 
76
} MetaMenuOp;
 
77
 
 
78
typedef struct _MetaWindowMenu MetaWindowMenu;
 
79
 
 
80
typedef void (* MetaWindowMenuFunc) (MetaWindowMenu *menu,
 
81
                                     Display        *xdisplay,
 
82
                                     Window          client_xwindow,
 
83
                                     guint32         timestamp,
 
84
                                     MetaMenuOp      op,
 
85
                                     int             workspace,
 
86
                                     gpointer        data);
 
87
 
 
88
/* when changing this enum, there are various switch statements
 
89
 * you have to update
 
90
 */
 
91
typedef enum
 
92
{
 
93
  META_GRAB_OP_NONE,
 
94
 
 
95
  /* Mouse ops */
 
96
  META_GRAB_OP_MOVING,
 
97
  META_GRAB_OP_RESIZING_SE,
 
98
  META_GRAB_OP_RESIZING_S,
 
99
  META_GRAB_OP_RESIZING_SW,
 
100
  META_GRAB_OP_RESIZING_N,
 
101
  META_GRAB_OP_RESIZING_NE,
 
102
  META_GRAB_OP_RESIZING_NW,
 
103
  META_GRAB_OP_RESIZING_W,
 
104
  META_GRAB_OP_RESIZING_E,
 
105
 
 
106
  /* Keyboard ops */
 
107
  META_GRAB_OP_KEYBOARD_MOVING,
 
108
  META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
 
109
  META_GRAB_OP_KEYBOARD_RESIZING_S,
 
110
  META_GRAB_OP_KEYBOARD_RESIZING_N,
 
111
  META_GRAB_OP_KEYBOARD_RESIZING_W,
 
112
  META_GRAB_OP_KEYBOARD_RESIZING_E,
 
113
  META_GRAB_OP_KEYBOARD_RESIZING_SE,
 
114
  META_GRAB_OP_KEYBOARD_RESIZING_NE,
 
115
  META_GRAB_OP_KEYBOARD_RESIZING_SW,
 
116
  META_GRAB_OP_KEYBOARD_RESIZING_NW,
 
117
 
 
118
  /* Alt+Tab */
 
119
  META_GRAB_OP_KEYBOARD_TABBING_NORMAL,
 
120
  META_GRAB_OP_KEYBOARD_TABBING_DOCK,
 
121
 
 
122
  /* Alt+Esc */
 
123
  META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL,
 
124
  META_GRAB_OP_KEYBOARD_ESCAPING_DOCK,
 
125
 
 
126
  META_GRAB_OP_KEYBOARD_ESCAPING_GROUP,
 
127
  
 
128
  /* Alt+F6 */
 
129
  META_GRAB_OP_KEYBOARD_TABBING_GROUP,
 
130
  
 
131
  META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
 
132
  
 
133
  /* Frame button ops */
 
134
  META_GRAB_OP_CLICKING_MINIMIZE,
 
135
  META_GRAB_OP_CLICKING_MAXIMIZE,
 
136
  META_GRAB_OP_CLICKING_UNMAXIMIZE,
 
137
  META_GRAB_OP_CLICKING_DELETE,
 
138
  META_GRAB_OP_CLICKING_MENU,
 
139
  META_GRAB_OP_CLICKING_SHADE,
 
140
  META_GRAB_OP_CLICKING_UNSHADE,
 
141
  META_GRAB_OP_CLICKING_ABOVE,
 
142
  META_GRAB_OP_CLICKING_UNABOVE,
 
143
  META_GRAB_OP_CLICKING_STICK,
 
144
  META_GRAB_OP_CLICKING_UNSTICK,
 
145
 
 
146
  /* Special grab op when the compositor asked for a grab */
 
147
  META_GRAB_OP_COMPOSITOR
 
148
} MetaGrabOp;
 
149
 
 
150
typedef enum
 
151
{
 
152
  META_CURSOR_DEFAULT,
 
153
  META_CURSOR_NORTH_RESIZE,
 
154
  META_CURSOR_SOUTH_RESIZE,
 
155
  META_CURSOR_WEST_RESIZE,
 
156
  META_CURSOR_EAST_RESIZE,
 
157
  META_CURSOR_SE_RESIZE,
 
158
  META_CURSOR_SW_RESIZE,
 
159
  META_CURSOR_NE_RESIZE,
 
160
  META_CURSOR_NW_RESIZE,
 
161
  META_CURSOR_MOVE_OR_RESIZE_WINDOW,
 
162
  META_CURSOR_BUSY
 
163
 
 
164
} MetaCursor;
 
165
 
 
166
typedef enum
 
167
{
 
168
  META_FOCUS_MODE_CLICK,
 
169
  META_FOCUS_MODE_SLOPPY,
 
170
  META_FOCUS_MODE_MOUSE
 
171
} MetaFocusMode;
 
172
 
 
173
typedef enum
 
174
{
 
175
  META_FOCUS_NEW_WINDOWS_SMART,
 
176
  META_FOCUS_NEW_WINDOWS_STRICT
 
177
} MetaFocusNewWindows;
 
178
 
 
179
typedef enum
 
180
{
 
181
  META_ACTION_TITLEBAR_TOGGLE_SHADE,
 
182
  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE,
 
183
  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
 
184
  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
 
185
  META_ACTION_TITLEBAR_MINIMIZE,
 
186
  META_ACTION_TITLEBAR_NONE,
 
187
  META_ACTION_TITLEBAR_LOWER,
 
188
  META_ACTION_TITLEBAR_MENU,
 
189
  META_ACTION_TITLEBAR_LAST
 
190
} MetaActionTitlebar;
 
191
 
 
192
typedef enum
 
193
{
 
194
  META_FRAME_TYPE_NORMAL,
 
195
  META_FRAME_TYPE_DIALOG,
 
196
  META_FRAME_TYPE_MODAL_DIALOG,
 
197
  META_FRAME_TYPE_UTILITY,
 
198
  META_FRAME_TYPE_MENU,
 
199
  META_FRAME_TYPE_BORDER,
 
200
  META_FRAME_TYPE_ATTACHED,
 
201
  META_FRAME_TYPE_LAST
 
202
} MetaFrameType;
 
203
 
 
204
typedef enum
 
205
{
 
206
  /* Create gratuitous divergence from regular
 
207
   * X mod bits, to be sure we find bugs
 
208
   */
 
209
  META_VIRTUAL_SHIFT_MASK    = 1 << 5,
 
210
  META_VIRTUAL_CONTROL_MASK  = 1 << 6,
 
211
  META_VIRTUAL_ALT_MASK      = 1 << 7,  
 
212
  META_VIRTUAL_META_MASK     = 1 << 8,
 
213
  META_VIRTUAL_SUPER_MASK    = 1 << 9,
 
214
  META_VIRTUAL_HYPER_MASK    = 1 << 10,
 
215
  META_VIRTUAL_MOD2_MASK     = 1 << 11,
 
216
  META_VIRTUAL_MOD3_MASK     = 1 << 12,
 
217
  META_VIRTUAL_MOD4_MASK     = 1 << 13,
 
218
  META_VIRTUAL_MOD5_MASK     = 1 << 14
 
219
} MetaVirtualModifier;
 
220
 
 
221
/* Relative directions or sides seem to come up all over the place... */
 
222
/* FIXME: Replace
 
223
 *   screen.[ch]:MetaScreenDirection,
 
224
 *   workspace.[ch]:MetaMotionDirection,
 
225
 * with the use of MetaDirection.
 
226
 */
 
227
typedef enum
 
228
{
 
229
  META_DIRECTION_LEFT       = 1 << 0,
 
230
  META_DIRECTION_RIGHT      = 1 << 1,
 
231
  META_DIRECTION_TOP        = 1 << 2,
 
232
  META_DIRECTION_BOTTOM     = 1 << 3,
 
233
 
 
234
  /* Some aliases for making code more readable for various circumstances. */
 
235
  META_DIRECTION_UP         = META_DIRECTION_TOP,
 
236
  META_DIRECTION_DOWN       = META_DIRECTION_BOTTOM,
 
237
 
 
238
  /* A few more definitions using aliases */
 
239
  META_DIRECTION_HORIZONTAL = META_DIRECTION_LEFT | META_DIRECTION_RIGHT,
 
240
  META_DIRECTION_VERTICAL   = META_DIRECTION_UP   | META_DIRECTION_DOWN,
 
241
} MetaDirection;
 
242
 
 
243
/* Negative to avoid conflicting with real workspace
 
244
 * numbers
 
245
 */
 
246
typedef enum
 
247
{
 
248
  META_MOTION_UP = -1,
 
249
  META_MOTION_DOWN = -2,
 
250
  META_MOTION_LEFT = -3,
 
251
  META_MOTION_RIGHT = -4,
 
252
  /* These are only used for effects */
 
253
  META_MOTION_UP_LEFT = -5,
 
254
  META_MOTION_UP_RIGHT = -6,
 
255
  META_MOTION_DOWN_LEFT = -7,
 
256
  META_MOTION_DOWN_RIGHT = -8
 
257
} MetaMotionDirection;
 
258
 
 
259
/* Sometimes we want to talk about sides instead of directions; note
 
260
 * that the values must be as follows or meta_window_update_struts()
 
261
 * won't work. Using these values also is a safety blanket since
 
262
 * MetaDirection used to be used as a side.
 
263
 */
 
264
typedef enum
 
265
{
 
266
  META_SIDE_LEFT            = META_DIRECTION_LEFT,
 
267
  META_SIDE_RIGHT           = META_DIRECTION_RIGHT,
 
268
  META_SIDE_TOP             = META_DIRECTION_TOP,
 
269
  META_SIDE_BOTTOM          = META_DIRECTION_BOTTOM
 
270
} MetaSide;
 
271
 
 
272
/* Function a window button can have.  Note, you can't add stuff here
 
273
 * without extending the theme format to draw a new function and
 
274
 * breaking all existing themes.
 
275
 */
 
276
typedef enum
 
277
{
 
278
  META_BUTTON_FUNCTION_MENU,
 
279
  META_BUTTON_FUNCTION_MINIMIZE,
 
280
  META_BUTTON_FUNCTION_MAXIMIZE,
 
281
  META_BUTTON_FUNCTION_CLOSE,
 
282
  META_BUTTON_FUNCTION_SHADE,
 
283
  META_BUTTON_FUNCTION_ABOVE,
 
284
  META_BUTTON_FUNCTION_STICK,
 
285
  META_BUTTON_FUNCTION_UNSHADE,
 
286
  META_BUTTON_FUNCTION_UNABOVE,
 
287
  META_BUTTON_FUNCTION_UNSTICK,
 
288
  META_BUTTON_FUNCTION_LAST
 
289
} MetaButtonFunction;
 
290
 
 
291
#define MAX_BUTTONS_PER_CORNER META_BUTTON_FUNCTION_LAST
 
292
 
 
293
typedef struct _MetaButtonLayout MetaButtonLayout;
 
294
struct _MetaButtonLayout
 
295
{
 
296
  /* buttons in the group on the left side */
 
297
  MetaButtonFunction left_buttons[MAX_BUTTONS_PER_CORNER];
 
298
  gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
 
299
 
 
300
  /* buttons in the group on the right side */
 
301
  MetaButtonFunction right_buttons[MAX_BUTTONS_PER_CORNER];
 
302
  gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
 
303
};
 
304
 
 
305
/* should investigate changing these to whatever most apps use */
 
306
#define META_ICON_WIDTH 32
 
307
#define META_ICON_HEIGHT 32
 
308
#define META_MINI_ICON_WIDTH 16
 
309
#define META_MINI_ICON_HEIGHT 16
 
310
 
 
311
#define META_DEFAULT_ICON_NAME "window"
 
312
 
 
313
/* Main loop priorities determine when activity in the GLib
 
314
 * will take precendence over the others. Priorities are sometimes
 
315
 * used to enforce ordering: give A a higher priority than B if
 
316
 * A must occur before B. But that poses a problem since then
 
317
 * if A occurs frequently enough, B will never occur.
 
318
 *
 
319
 * Anything we want to occur more or less immediately should
 
320
 * have a priority of G_PRIORITY_DEFAULT. When we want to
 
321
 * coelesce multiple things together, the appropriate place to
 
322
 * do it is usually META_PRIORITY_BEFORE_REDRAW.
 
323
 *
 
324
 * Note that its usually better to use meta_later_add() rather
 
325
 * than calling g_idle_add() directly; this will make sure things
 
326
 * get run when added from a clutter event handler without
 
327
 * waiting for another repaint cycle.
 
328
 *
 
329
 * If something has a priority lower than the redraw priority
 
330
 * (such as a default priority idle), then it may be arbitrarily
 
331
 * delayed. This happens if the screen is updating rapidly: we
 
332
 * are spending all our time either redrawing or waiting for a
 
333
 * vblank-synced buffer swap. (When X is improved to allow
 
334
 * clutter to do the buffer-swap asychronously, this will get
 
335
 * better.)
 
336
 */
 
337
 
 
338
/* G_PRIORITY_DEFAULT:
 
339
 *  events
 
340
 *  many timeouts
 
341
 */
 
342
 
 
343
/* GTK_PRIORITY_RESIZE:         (G_PRIORITY_HIGH_IDLE + 10) */
 
344
#define META_PRIORITY_RESIZE    (G_PRIORITY_HIGH_IDLE + 15)
 
345
/* GTK_PRIORITY_REDRAW:         (G_PRIORITY_HIGH_IDLE + 20) */
 
346
 
 
347
#define META_PRIORITY_BEFORE_REDRAW  (G_PRIORITY_HIGH_IDLE + 40)
 
348
/*  calc-showing idle
 
349
 *  update-icon idle
 
350
 */
 
351
 
 
352
/* CLUTTER_PRIORITY_REDRAW:     (G_PRIORITY_HIGH_IDLE + 50) */
 
353
#define META_PRIORITY_REDRAW    (G_PRIORITY_HIGH_IDLE + 50)
 
354
 
 
355
/* ==== Anything below here can be starved arbitrarily ==== */
 
356
 
 
357
/* G_PRIORITY_DEFAULT_IDLE:
 
358
 *  Mutter plugin unloading
 
359
 *  GConf notify idle
 
360
 */
 
361
 
 
362
/* Chosen to be below the GConf notify idle */
 
363
#define META_PRIORITY_PREFS_NOTIFY   (G_PRIORITY_DEFAULT_IDLE + 10)
 
364
 
 
365
/************************************************************/
 
366
 
 
367
#define POINT_IN_RECT(xcoord, ycoord, rect) \
 
368
 ((xcoord) >= (rect).x &&                   \
 
369
  (xcoord) <  ((rect).x + (rect).width) &&  \
 
370
  (ycoord) >= (rect).y &&                   \
 
371
  (ycoord) <  ((rect).y + (rect).height))
 
372
 
 
373
/**
 
374
 * Layers a window can be in.
 
375
 * These MUST be in the order of stacking.
 
376
 */
 
377
typedef enum
 
378
{
 
379
  META_LAYER_DESKTOP           = 0,
 
380
  META_LAYER_BOTTOM            = 1,
 
381
  META_LAYER_NORMAL            = 2,
 
382
  META_LAYER_TOP               = 4, /* Same as DOCK; see EWMH and bug 330717 */
 
383
  META_LAYER_DOCK              = 4,
 
384
  META_LAYER_FULLSCREEN        = 5,
 
385
  META_LAYER_FOCUSED_WINDOW    = 6,
 
386
  META_LAYER_OVERRIDE_REDIRECT = 7,
 
387
  META_LAYER_LAST              = 8
 
388
} MetaStackLayer;
 
389
 
 
390
#endif