display.h 21 KB
Newer Older
1 2
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

rhp's avatar
...  
rhp committed
3 4 5 6
/* Metacity X display handler */

/* 
 * Copyright (C) 2001 Havoc Pennington
7
 * Copyright (C) 2002 Red Hat, Inc.
8
 * Copyright (C) 2003 Rob Adams
9
 * Copyright (C) 2004-2006 Elijah Newren
rhp's avatar
...  
rhp committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 * 
 * 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 of the
 * License, 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.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#ifndef META_DISPLAY_H
#define META_DISPLAY_H

Havoc Pennington's avatar
Havoc Pennington committed
30 31 32 33
#ifndef PACKAGE
#error "config.h not included"
#endif

rhp's avatar
...  
rhp committed
34
#include <glib.h>
rhp's avatar
...  
rhp committed
35
#include <X11/Xlib.h>
rhp's avatar
...  
rhp committed
36
#include "eventqueue.h"
rhp's avatar
...  
rhp committed
37
#include "common.h"
38
#include "boxes.h"
rhp's avatar
...  
rhp committed
39

40 41 42 43
#ifdef HAVE_STARTUP_NOTIFICATION
#include <libsn/sn.h>
#endif

44 45 46 47
#ifdef HAVE_XSYNC
#include <X11/extensions/sync.h>
#endif

Havoc Pennington's avatar
Havoc Pennington committed
48 49
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)

Havoc Pennington's avatar
Havoc Pennington committed
50
typedef struct MetaCompositor  MetaCompositor;
51 52 53 54 55 56 57 58
typedef struct _MetaDisplay    MetaDisplay;
typedef struct _MetaFrame      MetaFrame;
typedef struct _MetaKeyBinding MetaKeyBinding;
typedef struct _MetaScreen     MetaScreen;
typedef struct _MetaStack      MetaStack;
typedef struct _MetaUISlave    MetaUISlave;
typedef struct _MetaWindow     MetaWindow;
typedef struct _MetaWorkspace  MetaWorkspace;
rhp's avatar
...  
rhp committed
59

60
typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
Havoc Pennington's avatar
Havoc Pennington committed
61
typedef struct _MetaGroupPropHooks  MetaGroupPropHooks;
62

63 64
typedef struct MetaEdgeResistanceData MetaEdgeResistanceData;

65 66
typedef void (* MetaWindowPingFunc) (MetaDisplay *display,
				     Window       xwindow,
67
				     guint32      timestamp,
68 69 70
				     gpointer     user_data);


rhp's avatar
...  
rhp committed
71 72 73 74
#define _NET_WM_STATE_REMOVE        0    /* remove/unset property */
#define _NET_WM_STATE_ADD           1    /* add/set property */
#define _NET_WM_STATE_TOGGLE        2    /* toggle property  */

75 76 77 78 79 80 81
/* This is basically a bogus number, just has to be large enough
 * to handle the expected case of the alt+tab operation, where
 * we want to ignore serials from UnmapNotify on the tab popup,
 * and the LeaveNotify/EnterNotify from the pointer ungrab
 */
#define N_IGNORED_SERIALS           4

rhp's avatar
...  
rhp committed
82 83 84 85
struct _MetaDisplay
{
  char *name;
  Display *xdisplay;
rhp's avatar
...  
rhp committed
86

rhp's avatar
...  
rhp committed
87
  Window leader_window;
88
  Window timestamp_pinging_window;
rhp's avatar
...  
rhp committed
89
  
rhp's avatar
...  
rhp committed
90
  Atom atom_net_wm_name;
rhp's avatar
...  
rhp committed
91 92 93
  Atom atom_wm_protocols;
  Atom atom_wm_take_focus;
  Atom atom_wm_delete_window;
rhp's avatar
...  
rhp committed
94
  Atom atom_wm_state;
rhp's avatar
...  
rhp committed
95
  Atom atom_net_close_window;
rhp's avatar
...  
rhp committed
96 97 98 99 100
  Atom atom_net_wm_state;
  Atom atom_motif_wm_hints;
  Atom atom_net_wm_state_shaded;
  Atom atom_net_wm_state_maximized_horz;
  Atom atom_net_wm_state_maximized_vert;
rhp's avatar
rhp committed
101 102
  Atom atom_net_wm_desktop;
  Atom atom_net_number_of_desktops;
rhp's avatar
...  
rhp committed
103 104 105 106
  Atom atom_wm_change_state;
  Atom atom_sm_client_id;
  Atom atom_wm_client_leader;
  Atom atom_wm_window_role;
rhp's avatar
...  
rhp committed
107 108
  Atom atom_net_current_desktop;
  Atom atom_net_supporting_wm_check;
109
  Atom atom_net_supported;
rhp's avatar
...  
rhp committed
110 111 112 113 114 115 116 117
  Atom atom_net_wm_window_type;
  Atom atom_net_wm_window_type_desktop;
  Atom atom_net_wm_window_type_dock;
  Atom atom_net_wm_window_type_toolbar;
  Atom atom_net_wm_window_type_menu;
  Atom atom_net_wm_window_type_dialog;
  Atom atom_net_wm_window_type_normal;
  Atom atom_net_wm_state_modal;
rhp's avatar
...  
rhp committed
118 119
  Atom atom_net_client_list;
  Atom atom_net_client_list_stacking;
rhp's avatar
...  
rhp committed
120 121
  Atom atom_net_wm_state_skip_taskbar;
  Atom atom_net_wm_state_skip_pager;
rhp's avatar
...  
rhp committed
122 123
  Atom atom_net_wm_icon_name;
  Atom atom_net_wm_icon;
124
  Atom atom_net_wm_icon_geometry;
125
  Atom atom_utf8_string;
Havoc Pennington's avatar
Havoc Pennington committed
126
  Atom atom_wm_icon_size;
127
  Atom atom_kwm_win_icon;
128
  Atom atom_net_wm_moveresize;
Havoc Pennington's avatar
Havoc Pennington committed
129
  Atom atom_net_active_window;
130
  Atom atom_metacity_restart_message;
131
  Atom atom_net_wm_strut;
132
  Atom atom_metacity_reload_theme_message;
133
  Atom atom_metacity_set_keybindings_message;
134
  Atom atom_net_wm_state_hidden;
135
  Atom atom_net_wm_window_type_utility;
Havoc Pennington's avatar
Havoc Pennington committed
136
  Atom atom_net_wm_window_type_splash;
137 138 139
  Atom atom_net_wm_ping;
  Atom atom_net_wm_pid;
  Atom atom_wm_client_machine;
140
  Atom atom_net_wm_state_fullscreen;
141
  Atom atom_net_workarea;
142
  Atom atom_net_showing_desktop;
143
  Atom atom_net_desktop_layout;
Havoc Pennington's avatar
Havoc Pennington committed
144 145 146 147 148 149
  Atom atom_manager;
  Atom atom_targets;
  Atom atom_multiple;
  Atom atom_timestamp;
  Atom atom_version;
  Atom atom_atom_pair;
Havoc Pennington's avatar
Havoc Pennington committed
150
  Atom atom_net_desktop_names;
151 152 153
  Atom atom_net_wm_allowed_actions;
  Atom atom_net_wm_action_move;
  Atom atom_net_wm_action_resize;
154 155
  Atom atom_net_wm_action_fullscreen;
  Atom atom_net_wm_action_minimize;
156 157 158 159 160 161
  Atom atom_net_wm_action_shade;
  Atom atom_net_wm_action_stick;
  Atom atom_net_wm_action_maximize_horz;
  Atom atom_net_wm_action_maximize_vert;
  Atom atom_net_wm_action_change_desktop;
  Atom atom_net_wm_action_close;
Havoc Pennington's avatar
Havoc Pennington committed
162 163
  Atom atom_net_wm_state_above;
  Atom atom_net_wm_state_below;
Havoc Pennington's avatar
Havoc Pennington committed
164
  Atom atom_net_startup_id;
165
  Atom atom_metacity_toggle_verbose;
166 167
  Atom atom_net_wm_sync_request;
  Atom atom_net_wm_sync_request_counter;
168 169 170
  Atom atom_gnome_panel_action;
  Atom atom_gnome_panel_action_main_menu;
  Atom atom_gnome_panel_action_run_dialog;
171
  Atom atom_metacity_sentinel;
172
  Atom atom_net_wm_strut_partial;
173 174
  Atom atom_net_frame_extents;
  Atom atom_net_request_frame_extents;
175
  Atom atom_net_wm_user_time;
176 177 178 179 180
  Atom atom_net_wm_state_demands_attention;
  Atom atom_net_restack_window;
  Atom atom_net_moveresize_window;
  Atom atom_net_desktop_geometry;
  Atom atom_net_desktop_viewport;
181
  Atom atom_metacity_version;
182 183
  Atom atom_net_wm_visible_name;
  Atom atom_net_wm_visible_icon_name;
184
  Atom atom_net_wm_user_time_window;
185

rhp's avatar
...  
rhp committed
186 187 188 189
  /* This is the actual window from focus events,
   * not the one we last set
   */
  MetaWindow *focus_window;
rhp's avatar
...  
rhp committed
190

191 192 193 194 195 196
  /* window we are expecting a FocusIn event for or the current focus
   * window if we are not expecting any FocusIn/FocusOut events; not
   * perfect because applications can call XSetInputFocus directly.
   * (It could also be messed up if a timestamp later than current
   * time is sent to meta_display_set_input_focus_window, though that
   * would be a programming error).  See bug 154598 for more info.
197 198 199
   */
  MetaWindow *expected_focus_window;

200
  /* last timestamp passed to XSetInputFocus */
201
  guint32 last_focus_time;
202

203
  /* last user interaction time in any app */
204
  guint32 last_user_time;
205

206 207 208 209 210
  /* whether we're using mousenav (only relevant for sloppy&mouse focus modes;
   * !mouse_mode means "keynav mode")
   */
  guint mouse_mode : 1;

211 212 213 214 215 216
  /* Helper var used when focus_new_windows setting is 'strict'; only
   * relevant in 'strict' mode and if the focus window is a terminal.
   * In that case, we don't allow new windows to take focus away from
   * a terminal, but if the user explicitly did something that should
   * allow a different window to gain focus (e.g. global keybinding or
   * clicking on a dock), then we will allow the transfer.
217 218 219
   */
  guint allow_terminal_deactivation : 1;

220
  guint static_gravity_works : 1;
rhp's avatar
...  
rhp committed
221
  
rhp's avatar
...  
rhp committed
222
  /*< private-ish >*/
223
  guint error_trap_synced_at_last_pop : 1;
rhp's avatar
...  
rhp committed
224 225
  MetaEventQueue *events;
  GSList *screens;
226
  MetaScreen *active_screen;
rhp's avatar
...  
rhp committed
227
  GHashTable *window_ids;
228 229 230
  int error_traps;
  int (* error_trap_handler) (Display     *display,
                              XErrorEvent *error);  
rhp's avatar
...  
rhp committed
231
  int server_grab_count;
rhp's avatar
...  
rhp committed
232

233 234 235 236 237 238 239
  /* serials of leave/unmap events that may
   * correspond to an enter event we should
   * ignore
   */
  unsigned long ignored_serials[N_IGNORED_SERIALS];
  Window ungrab_should_not_cause_focus_window;
  
240
  guint32 current_time;
241 242 243

  /* Pings which we're waiting for a reply from */
  GSList     *pending_pings;
Havoc Pennington's avatar
Havoc Pennington committed
244 245 246

  /* Pending autoraise */
  guint       autoraise_timeout_id;
247
  MetaWindow* autoraise_window;
248 249 250

  /* Alt+click button grabs */
  unsigned int window_grab_modifiers;
rhp's avatar
...  
rhp committed
251
  
rhp's avatar
...  
rhp committed
252 253
  /* current window operation */
  MetaGrabOp  grab_op;
254
  MetaScreen *grab_screen;
rhp's avatar
...  
rhp committed
255
  MetaWindow *grab_window;
256
  Window      grab_xwindow;
257
  gulong      grab_start_serial;
rhp's avatar
...  
rhp committed
258
  int         grab_button;
259 260 261
  int         grab_anchor_root_x;
  int         grab_anchor_root_y;
  MetaRectangle grab_anchor_window_pos;
262 263
  int         grab_latest_motion_x;
  int         grab_latest_motion_y;
rhp's avatar
...  
rhp committed
264 265 266
  gulong      grab_mask;
  guint       grab_have_pointer : 1;
  guint       grab_have_keyboard : 1;
267
  guint       grab_wireframe_active : 1;
268
  guint       grab_was_cancelled : 1;    /* Only used in wireframe mode */
269
  guint       grab_frame_action : 1;
270
  MetaRectangle grab_wireframe_rect;
271
  MetaRectangle grab_wireframe_last_xor_rect;
rhp's avatar
...  
rhp committed
272
  MetaRectangle grab_initial_window_pos;
273 274
  int         grab_initial_x, grab_initial_y;  /* These are only relevant for */
  gboolean    grab_threshold_movement_reached; /* raise_on_click == FALSE.    */
275
  MetaResizePopup *grab_resize_popup;
276
  GTimeVal    grab_last_moveresize_time;
277
  guint32     grab_motion_notify_time;
278 279
  int         grab_wireframe_last_display_width;
  int         grab_wireframe_last_display_height;
280
  GList*      grab_old_window_stacking;
281
  MetaEdgeResistanceData *grab_edge_resistance_data;
282 283
  unsigned int grab_last_user_action_was_snap;

284 285 286 287 288
  /* we use property updates as sentinels for certain window focus events
   * to avoid some race conditions on EnterNotify events
   */
  int         sentinel_counter;

289 290
#ifdef HAVE_XKB
  int         xkb_base_event_type;
291
  guint32     last_bell_time;
292
#endif
293
#ifdef HAVE_XSYNC
294 295
  /* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
  XSyncAlarm  grab_sync_request_alarm;
296
#endif
297
  int	      grab_resize_timeout_id;
298 299 300 301 302 303

  /* Keybindings stuff */
  MetaKeyBinding *screen_bindings;
  int             n_screen_bindings;
  MetaKeyBinding *window_bindings;
  int             n_window_bindings;
Björn Lindqvist's avatar
Björn Lindqvist committed
304 305
  int             min_keycode;
  int             max_keycode;
306 307 308 309 310 311
  KeySym *keymap;
  int keysyms_per_keycode;
  XModifierKeymap *modmap;
  unsigned int ignored_modifier_mask;
  unsigned int num_lock_mask;
  unsigned int scroll_lock_mask;
312 313 314 315
  unsigned int hyper_mask;
  unsigned int super_mask;
  unsigned int meta_mask;
  
Havoc Pennington's avatar
Havoc Pennington committed
316 317
  /* Xinerama cache */
  unsigned int xinerama_cache_invalidated : 1;
318

319 320 321
  /* Opening the display */
  unsigned int display_opening : 1;

322 323
  /* Closing down the display */
  int closing;
324 325 326

  /* Managed by group.c */
  GHashTable *groups_by_leader;
Havoc Pennington's avatar
Havoc Pennington committed
327

328 329 330
  /* currently-active window menu if any */
  MetaWindowMenu *window_menu;
  MetaWindow *window_with_menu;
331 332 333

  /* Managed by window-props.c */
  MetaWindowPropHooks *prop_hooks;
Havoc Pennington's avatar
Havoc Pennington committed
334 335 336

  /* Managed by group-props.c */
  MetaGroupPropHooks *group_prop_hooks;
Havoc Pennington's avatar
Havoc Pennington committed
337 338 339

  /* Managed by compositor.c */
  MetaCompositor *compositor;
Havoc Pennington's avatar
Havoc Pennington committed
340 341 342 343
  
#ifdef HAVE_STARTUP_NOTIFICATION
  SnDisplay *sn_display;
#endif
344 345 346 347
#ifdef HAVE_XSYNC
  int xsync_event_base;
  int xsync_error_base;
#endif
348 349 350
#ifdef HAVE_SHAPE
  int shape_event_base;
  int shape_error_base;
351 352 353 354 355 356 357 358 359 360 361 362 363 364
#endif
#ifdef HAVE_RENDER
  int render_event_base;
  int render_error_base;
#endif
#ifdef HAVE_XSYNC
  unsigned int have_xsync : 1;
#define META_DISPLAY_HAS_XSYNC(display) ((display)->have_xsync)
#else
#define META_DISPLAY_HAS_XSYNC(display) FALSE
#endif
#ifdef HAVE_SHAPE
  unsigned int have_shape : 1;
#define META_DISPLAY_HAS_SHAPE(display) ((display)->have_shape)
365 366 367
#else
#define META_DISPLAY_HAS_SHAPE(display) FALSE
#endif
368 369 370 371 372 373
#ifdef HAVE_RENDER
  unsigned int have_render : 1;
#define META_DISPLAY_HAS_RENDER(display) ((display)->have_render)
#else
#define META_DISPLAY_HAS_RENDER(display) FALSE
#endif
rhp's avatar
...  
rhp committed
374 375
};

376 377 378 379 380
/* Xserver time can wraparound, thus comparing two timestamps needs to take
 * this into account.  Here's a little macro to help out.  If no wraparound
 * has occurred, this is equivalent to
 *   time1 < time2
 * Of course, the rest of the ugliness of this macro comes from accounting
381 382 383 384 385 386
 * for the fact that wraparound can occur and the fact that a timestamp of
 * 0 must be special-cased since it means older than anything else. 
 *
 * Note that this is NOT an equivalent for time1 <= time2; if that's what
 * you need then you'll need to swap the order of the arguments and negate
 * the result.
387
 */
388
#define XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) \
389 390
  ( (( (time1) < (time2) ) && ( (time2) - (time1) < ((guint32)-1)/2 )) ||     \
    (( (time1) > (time2) ) && ( (time1) - (time2) > ((guint32)-1)/2 ))        \
391 392
  )
#define XSERVER_TIME_IS_BEFORE(time1, time2)                          \
393
  ( (time1) == 0 ||                                                     \
394
    (XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) && \
395
     (time2) != 0)                                                      \
396 397
  )

398
gboolean      meta_display_open                (void);
399 400
void          meta_display_close               (MetaDisplay *display,
                                                guint32      timestamp);
rhp's avatar
...  
rhp committed
401 402 403 404
MetaScreen*   meta_display_screen_for_root     (MetaDisplay *display,
                                                Window       xroot);
MetaScreen*   meta_display_screen_for_x_screen (MetaDisplay *display,
                                                Screen      *screen);
405 406
MetaScreen*   meta_display_screen_for_xwindow  (MetaDisplay *display,
                                                Window       xindow);
rhp's avatar
...  
rhp committed
407 408 409
void          meta_display_grab                (MetaDisplay *display);
void          meta_display_ungrab              (MetaDisplay *display);

Havoc Pennington's avatar
Havoc Pennington committed
410
void          meta_display_unmanage_screen     (MetaDisplay *display,
411 412
                                                MetaScreen  *screen,
                                                guint32      timestamp);
Havoc Pennington's avatar
Havoc Pennington committed
413 414

void          meta_display_unmanage_windows_for_screen (MetaDisplay *display,
415 416
                                                        MetaScreen  *screen,
                                                        guint32      timestamp);
Havoc Pennington's avatar
Havoc Pennington committed
417

rhp's avatar
...  
rhp committed
418 419 420 421 422 423 424 425 426 427
/* A given MetaWindow may have various X windows that "belong"
 * to it, such as the frame window.
 */
MetaWindow* meta_display_lookup_x_window     (MetaDisplay *display,
                                              Window       xwindow);
void        meta_display_register_x_window   (MetaDisplay *display,
                                              Window      *xwindowp,
                                              MetaWindow  *window);
void        meta_display_unregister_x_window (MetaDisplay *display,
                                              Window       xwindow);
428 429 430
/* Return whether the xwindow is a no focus window for any of the screens */
gboolean    meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
                                                       Window xwindow);
rhp's avatar
...  
rhp committed
431

rhp's avatar
...  
rhp committed
432
GSList*     meta_display_list_windows        (MetaDisplay *display);
rhp's avatar
...  
rhp committed
433

rhp's avatar
...  
rhp committed
434
MetaDisplay* meta_display_for_x_display  (Display     *xdisplay);
rhp's avatar
...  
rhp committed
435
GSList*      meta_displays_list          (void);
rhp's avatar
...  
rhp committed
436

rhp's avatar
...  
rhp committed
437 438 439
Cursor         meta_display_create_x_cursor (MetaDisplay *display,
                                             MetaCursor   cursor);

440
void     meta_display_set_grab_op_cursor (MetaDisplay *display,
441
                                          MetaScreen  *screen,
442 443 444
                                          MetaGrabOp   op,
                                          gboolean     change_pointer,
                                          Window       grab_xwindow,
445
                                          guint32      timestamp);
446

rhp's avatar
...  
rhp committed
447
gboolean meta_display_begin_grab_op (MetaDisplay *display,
448
                                     MetaScreen  *screen,
rhp's avatar
...  
rhp committed
449 450 451
                                     MetaWindow  *window,
                                     MetaGrabOp   op,
                                     gboolean     pointer_already_grabbed,
452
                                     gboolean     frame_action,
453
                                     int          event_serial,
rhp's avatar
...  
rhp committed
454 455
                                     int          button,
                                     gulong       modmask,
456
                                     guint32      timestamp,
rhp's avatar
...  
rhp committed
457 458 459
                                     int          root_x,
                                     int          root_y);
void     meta_display_end_grab_op   (MetaDisplay *display,
460
                                     guint32      timestamp);
rhp's avatar
...  
rhp committed
461

462 463 464
void    meta_display_check_threshold_reached (MetaDisplay *display,
                                              int          x,
                                              int          y);
rhp's avatar
...  
rhp committed
465 466 467 468
void     meta_display_grab_window_buttons    (MetaDisplay *display,
                                              Window       xwindow);
void     meta_display_ungrab_window_buttons  (MetaDisplay *display,
                                              Window       xwindow);
rhp's avatar
...  
rhp committed
469

470
void meta_display_grab_focus_window_button   (MetaDisplay *display,
471
                                              MetaWindow  *window);
472
void meta_display_ungrab_focus_window_button (MetaDisplay *display,
473
                                              MetaWindow  *window);
474

475 476 477 478
/* Next two functions are defined in edge-resistance.c */
void meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display);
void meta_display_cleanup_edges                         (MetaDisplay *display);

479 480
/* make a request to ensure the event serial has changed */
void     meta_display_increment_event_serial (MetaDisplay *display);
rhp's avatar
...  
rhp committed
481

Havoc Pennington's avatar
Havoc Pennington committed
482 483
void     meta_display_update_active_window_hint (MetaDisplay *display);

484 485
guint32  meta_display_get_current_time           (MetaDisplay *display);
guint32  meta_display_get_current_time_roundtrip (MetaDisplay *display);
486

487
/* utility goo */
488 489
const char* meta_event_mode_to_string   (int m);
const char* meta_event_detail_to_string (int d);
490

491 492 493
void meta_display_queue_retheme_all_windows (MetaDisplay *display);
void meta_display_retheme_all (void);

494 495 496
void meta_display_set_cursor_theme (const char *theme, 
				    int         size);

497 498 499 500 501 502
void meta_display_ping_window      (MetaDisplay        *display,
                                    MetaWindow         *window,
                                    guint32             timestamp,
                                    MetaWindowPingFunc  ping_reply_func,
                                    MetaWindowPingFunc  ping_timeout_func,
                                    void               *user_data);
503 504 505
gboolean meta_display_window_has_pending_pings (MetaDisplay        *display,
						MetaWindow         *window);

Havoc Pennington's avatar
Havoc Pennington committed
506 507 508
typedef enum
{
  META_TAB_LIST_NORMAL,
509 510
  META_TAB_LIST_DOCKS,
  META_TAB_LIST_GROUP
Havoc Pennington's avatar
Havoc Pennington committed
511 512
} MetaTabList;

513 514 515 516 517 518
typedef enum
{
  META_TAB_SHOW_ICON,      /* Alt-Tab mode */
  META_TAB_SHOW_INSTANTLY  /* Alt-Esc mode */
} MetaTabShowType;

519 520 521 522
GList* meta_display_get_tab_list (MetaDisplay   *display,
                                  MetaTabList    type,
                                  MetaScreen    *screen,
                                  MetaWorkspace *workspace);
Havoc Pennington's avatar
Havoc Pennington committed
523 524

MetaWindow* meta_display_get_tab_next (MetaDisplay   *display,
Havoc Pennington's avatar
Havoc Pennington committed
525
                                       MetaTabList    type,
526
				       MetaScreen    *screen,
Havoc Pennington's avatar
Havoc Pennington committed
527 528 529
                                       MetaWorkspace *workspace,
                                       MetaWindow    *window,
                                       gboolean       backward);
530

Havoc Pennington's avatar
Havoc Pennington committed
531 532 533 534 535
MetaWindow* meta_display_get_tab_current (MetaDisplay   *display,
                                          MetaTabList    type,
                                          MetaScreen    *screen,
                                          MetaWorkspace *workspace);

536 537
int meta_resize_gravity_from_grab_op (MetaGrabOp op);

538 539 540
gboolean meta_grab_op_is_moving   (MetaGrabOp op);
gboolean meta_grab_op_is_resizing (MetaGrabOp op);

541 542 543 544
void meta_display_devirtualize_modifiers (MetaDisplay        *display,
                                          MetaVirtualModifier modifiers,
                                          unsigned int       *mask);

545 546 547 548
void meta_display_increment_focus_sentinel (MetaDisplay *display);
void meta_display_decrement_focus_sentinel (MetaDisplay *display);
gboolean meta_display_focus_sentinel_clear (MetaDisplay *display);

549 550 551
/* meta_display_set_input_focus_window is like XSetInputFocus, except
 * that (a) it can't detect timestamps later than the current time,
 * since Metacity isn't part of the XServer, and thus gives erroneous
552 553 554 555 556
 * behavior in this circumstance (so don't do it), (b) it uses
 * display->last_focus_time since we don't have access to the true
 * Xserver one, (c) it makes use of display->user_time since checking
 * whether a window should be allowed to be focused should depend
 * on user_time events (see bug 167358, comment 15 in particular)
557 558 559 560
 */
void meta_display_set_input_focus_window   (MetaDisplay *display, 
                                            MetaWindow  *window,
                                            gboolean     focus_frame,
561
                                            guint32      timestamp);
562 563 564 565 566

/* meta_display_focus_the_no_focus_window is called when the
 * designated no_focus_window should be focused, but is otherwise the
 * same as meta_display_set_input_focus_window
 */
567
void meta_display_focus_the_no_focus_window (MetaDisplay *display, 
568
                                             MetaScreen  *screen,
569
                                             guint32      timestamp);
570

571 572 573 574
void meta_display_queue_autoraise_callback  (MetaDisplay *display,
                                             MetaWindow  *window);
void meta_display_remove_autoraise_callback (MetaDisplay *display);

rhp's avatar
...  
rhp committed
575
#endif