1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
3
/* Mutter common types shared by core.h and ui.h */
6
* Copyright (C) 2001 Havoc Pennington
7
* Copyright (C) 2005 Elijah Newren
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.
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.
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
28
/* Don't include GTK or core headers here */
32
typedef struct _MetaResizePopup MetaResizePopup;
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
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
78
typedef struct _MetaWindowMenu MetaWindowMenu;
80
typedef void (* MetaWindowMenuFunc) (MetaWindowMenu *menu,
82
Window client_xwindow,
88
/* when changing this enum, there are various switch statements
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,
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,
119
META_GRAB_OP_KEYBOARD_TABBING_NORMAL,
120
META_GRAB_OP_KEYBOARD_TABBING_DOCK,
123
META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL,
124
META_GRAB_OP_KEYBOARD_ESCAPING_DOCK,
126
META_GRAB_OP_KEYBOARD_ESCAPING_GROUP,
129
META_GRAB_OP_KEYBOARD_TABBING_GROUP,
131
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
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,
146
/* Special grab op when the compositor asked for a grab */
147
META_GRAB_OP_COMPOSITOR
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,
168
META_FOCUS_MODE_CLICK,
169
META_FOCUS_MODE_SLOPPY,
170
META_FOCUS_MODE_MOUSE
175
META_FOCUS_NEW_WINDOWS_SMART,
176
META_FOCUS_NEW_WINDOWS_STRICT
177
} MetaFocusNewWindows;
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;
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,
206
/* Create gratuitous divergence from regular
207
* X mod bits, to be sure we find bugs
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;
221
/* Relative directions or sides seem to come up all over the place... */
223
* screen.[ch]:MetaScreenDirection,
224
* workspace.[ch]:MetaMotionDirection,
225
* with the use of MetaDirection.
229
META_DIRECTION_LEFT = 1 << 0,
230
META_DIRECTION_RIGHT = 1 << 1,
231
META_DIRECTION_TOP = 1 << 2,
232
META_DIRECTION_BOTTOM = 1 << 3,
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,
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,
243
/* Negative to avoid conflicting with real workspace
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;
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.
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
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.
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;
291
#define MAX_BUTTONS_PER_CORNER META_BUTTON_FUNCTION_LAST
293
typedef struct _MetaButtonLayout MetaButtonLayout;
294
struct _MetaButtonLayout
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];
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];
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
311
#define META_DEFAULT_ICON_NAME "window"
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.
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.
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.
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
338
/* G_PRIORITY_DEFAULT:
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) */
347
#define META_PRIORITY_BEFORE_REDRAW (G_PRIORITY_HIGH_IDLE + 40)
352
/* CLUTTER_PRIORITY_REDRAW: (G_PRIORITY_HIGH_IDLE + 50) */
353
#define META_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50)
355
/* ==== Anything below here can be starved arbitrarily ==== */
357
/* G_PRIORITY_DEFAULT_IDLE:
358
* Mutter plugin unloading
362
/* Chosen to be below the GConf notify idle */
363
#define META_PRIORITY_PREFS_NOTIFY (G_PRIORITY_DEFAULT_IDLE + 10)
365
/************************************************************/
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))
374
* Layers a window can be in.
375
* These MUST be in the order of stacking.
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 */
384
META_LAYER_FULLSCREEN = 5,
385
META_LAYER_FOCUSED_WINDOW = 6,
386
META_LAYER_OVERRIDE_REDIRECT = 7,