1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 
3 /**
4  * \file window-private.h  Windows which Muffin manages
5  *
6  * Managing X windows.
7  * This file contains methods on this class which are available to
8  * routines in core but not outside it.  (See window.h for the routines
9  * which the rest of the world is allowed to use.)
10  */
11 
12 /*
13  * Copyright (C) 2001 Havoc Pennington
14  * Copyright (C) 2002 Red Hat, Inc.
15  * Copyright (C) 2003, 2004 Rob Adams
16  * Copyright (C) 2004-2006 Elijah Newren
17  *
18  * This program is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU General Public License as
20  * published by the Free Software Foundation; either version 2 of the
21  * License, or (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful, but
24  * WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  * General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
31  * 02110-1335, USA.
32  */
33 
34 #ifndef META_WINDOW_PRIVATE_H
35 #define META_WINDOW_PRIVATE_H
36 
37 #include <config.h>
38 #include <meta/compositor.h>
39 #include <meta/window.h>
40 #include "screen-private.h"
41 #include <meta/util.h>
42 #include "stack.h"
43 #include "iconcache.h"
44 #include <X11/Xutil.h>
45 #include <cairo.h>
46 #include <gdk-pixbuf/gdk-pixbuf.h>
47 
48 typedef struct _MetaWindowQueue MetaWindowQueue;
49 
50 typedef enum {
51   META_CLIENT_TYPE_UNKNOWN = 0,
52   META_CLIENT_TYPE_APPLICATION = 1,
53   META_CLIENT_TYPE_PAGER = 2,
54   META_CLIENT_TYPE_MAX_RECOGNIZED = 2
55 } MetaClientType;
56 
57 typedef enum {
58   META_QUEUE_CALC_SHOWING = 1 << 0,
59   META_QUEUE_MOVE_RESIZE  = 1 << 1
60 } MetaQueueType;
61 
62 /* edge zones for tiling/snapping identification
63 
64   ___________________________
65   | 4          0          5 |
66   |                         |
67   |                         |
68   |                         |
69   |                         |
70   |  2                   3  |
71   |                         |
72   |                         |
73   |                         |
74   |                         |
75   | 7          1          6 |
76   |_________________________|
77 
78 */
79 
80 enum {
81     ZONE_0 = 0,
82     ZONE_1,
83     ZONE_2,
84     ZONE_3,
85     ZONE_4,
86     ZONE_5,
87     ZONE_6,
88     ZONE_7,
89     ZONE_NONE
90 };
91 
92 #define NUMBER_OF_QUEUES 2
93 
94 #define HUD_WIDTH 24
95 #define CSD_TITLEBAR_HEIGHT 48
96 
97 typedef enum {
98   _NET_WM_BYPASS_COMPOSITOR_HINT_AUTO = 0,
99   _NET_WM_BYPASS_COMPOSITOR_HINT_ON = 1,
100   _NET_WM_BYPASS_COMPOSITOR_HINT_OFF = 2,
101 } MetaBypassCompositorHintValue;
102 
103 typedef enum
104 {
105   META_EDGE_CONSTRAINT_NONE    = 0,
106   META_EDGE_CONSTRAINT_WINDOW  = 1,
107   META_EDGE_CONSTRAINT_MONITOR = 2,
108 } MetaEdgeConstraint;
109 
110 struct _MetaWindow
111 {
112   GObject parent_instance;
113 
114   MetaDisplay *display;
115   MetaScreen *screen;
116   const MetaMonitorInfo *monitor;
117   MetaWorkspace *workspace;
118   Window xwindow;
119   /* may be NULL! not all windows get decorated */
120   MetaFrame *frame;
121   int depth;
122   Visual *xvisual;
123   Colormap colormap;
124   char *desc; /* used in debug spew */
125   char *title;
126 
127   char *icon_name;
128 
129 /* XAppGtkWindow */
130   char *theme_icon_name;
131   guint progress;
132   guint progress_pulse : 1;
133 /* /XappGtkWindow */
134 
135   GdkPixbuf *icon;
136   MetaIconCache icon_cache;
137   int icon_size;
138 
139   Pixmap wm_hints_pixmap;
140   Pixmap wm_hints_mask;
141 
142   MetaWindowType type;
143   Atom type_atom;
144 
145   /* NOTE these five are not in UTF-8, we just treat them as random
146    * binary data
147    */
148   char *res_class;
149   char *res_name;
150   char *role;
151   char *sm_client_id;
152   char *wm_client_machine;
153 
154   char *startup_id;
155   char *muffin_hints;
156   char *gtk_theme_variant;
157   char *gtk_application_id;
158   char *gtk_unique_bus_name;
159   char *gtk_application_object_path;
160   char *gtk_window_object_path;
161   char *gtk_app_menu_object_path;
162   char *gtk_menubar_object_path;
163 
164   int hide_titlebar_when_maximized;
165   int net_wm_pid;
166   int client_pid;
167 
168   Window xtransient_for;
169   Window xgroup_leader;
170   Window xclient_leader;
171 
172   /* Initial workspace property */
173   int initial_workspace;
174 
175   /* Initial timestamp property */
176   guint32 initial_timestamp;
177 
178   /* Whether this is an override redirect window or not */
179   guint override_redirect : 1;
180 
181   /* Whether we're maximized */
182   guint maximized_horizontally : 1;
183   guint maximized_vertically : 1;
184 
185   guint32 snap_delay_timestamp;
186   guint snap_queued : 1;
187   guint zone_queued;
188   MetaWindowTileType tile_type;
189   MetaWindowTileType resizing_tile_type;
190   guint custom_snap_size : 1;
191   guint current_proximity_zone;
192   guint mouse_on_edge : 1;
193   guint maybe_retile_maximize : 1;
194 
195   /* Whether we have to maximize/minimize after placement */
196   guint maximize_horizontally_after_placement : 1;
197   guint maximize_vertically_after_placement : 1;
198   guint minimize_after_placement : 1;
199   guint tile_after_placement : 1;
200   guint move_after_placement : 1;
201 
202   /* The current or requested tile mode. If maximized_vertically is true,
203    * this is the current mode. If not, it is the mode which will be
204    * requested after the window grab is released */
205   guint tile_mode : 4;
206   guint last_tile_mode : 4;
207   guint resize_tile_mode : 4;
208 
209   /* The last "full" maximized/unmaximized state. We need to keep track of
210    * that to toggle between normal/tiled or maximized/tiled states. */
211   guint saved_maximize : 1;
212   int tile_monitor_number;
213 
214   /* 0 - top
215    * 1 - right
216    * 2 - bottom
217    * 3 - left */
218   MetaEdgeConstraint edge_constraints[4];
219 
220   /* Whether we're shaded */
221   guint shaded : 1;
222 
223   /* Whether we're fullscreen */
224   guint fullscreen : 1;
225 
226   /* Whether the urgent flag of WM_HINTS is set */
227   guint wm_hints_urgent : 1;
228 
229   /* Whether we have to fullscreen after placement */
230   guint fullscreen_after_placement : 1;
231 
232   /* Area to cover when in fullscreen mode.  If _NET_WM_FULLSCREEN_MONITORS has
233    * been overridden (via a client message), the window will cover the union of
234    * these monitors.  If not, this is the single monitor which the window's
235    * origin is on. */
236   long fullscreen_monitors[4];
237 
238   /* Whether we're trying to constrain the window to be fully onscreen */
239   guint require_fully_onscreen : 1;
240 
241   /* Whether we're trying to constrain the window to be on a single monitor */
242   guint require_on_single_monitor : 1;
243 
244   /* Whether we're trying to constrain the window's titlebar to be onscreen */
245   guint require_titlebar_visible : 1;
246 
247   /* Whether we're sticky in the multi-workspace sense
248    * (vs. the not-scroll-with-viewport sense, we don't
249    * have no stupid viewports)
250    */
251   guint on_all_workspaces : 1;
252 
253   /* This is true if the client requested sticky, and implies on_all_workspaces == TRUE,
254    * however on_all_workspaces can be set TRUE for other internal reasons too, such as
255    * being override_redirect or being on the non-primary monitor. */
256   guint on_all_workspaces_requested : 1;
257 
258   /* Minimize is the state controlled by the minimize button */
259   guint minimized : 1;
260   guint tab_unminimized : 1;
261 
262   /* Whether the window is mapped; actual server-side state
263    * see also unmaps_pending
264    */
265   guint mapped : 1;
266 
267   /* Whether window has been hidden from view by lowering it to the bottom
268    * of window stack.
269    */
270   guint hidden : 1;
271 
272   /* Whether the compositor thinks the window is visible
273    */
274   guint visible_to_compositor : 1;
275 
276   /* When we next show or hide the window, what effect we should
277    * tell the compositor to perform.
278    */
279   guint pending_compositor_effect : 4; /* MetaCompEffect */
280 
281   /* Iconic is the state in WM_STATE; happens for workspaces/shading
282    * in addition to minimize
283    */
284   guint iconic : 1;
285   /* initially_iconic is the WM_HINTS setting when we first manage
286    * the window. It's taken to mean initially minimized.
287    */
288   guint initially_iconic : 1;
289 
290   /* whether an initial workspace was explicitly set */
291   guint initial_workspace_set : 1;
292 
293   /* whether an initial timestamp was explicitly set */
294   guint initial_timestamp_set : 1;
295 
296   /* whether net_wm_user_time has been set yet */
297   guint net_wm_user_time_set : 1;
298 
299   /* whether net_wm_icon_geometry has been set */
300   guint icon_geometry_set: 1;
301 
302   /* These are the flags from WM_PROTOCOLS */
303   guint take_focus : 1;
304   guint delete_window : 1;
305   guint net_wm_ping : 1;
306   /* Globally active / No input */
307   guint input : 1;
308 
309   /* MWM hints about features of window */
310   guint mwm_decorated : 1;
311   guint mwm_border_only : 1;
312   guint mwm_has_close_func : 1;
313   guint mwm_has_minimize_func : 1;
314   guint mwm_has_maximize_func : 1;
315   guint mwm_has_move_func : 1;
316   guint mwm_has_resize_func : 1;
317 
318   /* Computed features of window */
319   guint decorated : 1;
320   guint border_only : 1;
321   guint always_sticky : 1;
322   guint has_close_func : 1;
323   guint has_minimize_func : 1;
324   guint has_maximize_func : 1;
325   guint has_shade_func : 1;
326   guint has_move_func : 1;
327   guint has_resize_func : 1;
328   guint has_fullscreen_func : 1;
329 
330   /* Weird "_NET_WM_STATE_MODAL" flag */
331   guint wm_state_modal : 1;
332 
333   /* TRUE if the client forced these on */
334   guint wm_state_skip_taskbar : 1;
335   guint wm_state_skip_pager : 1;
336 
337   /* Computed whether to skip taskbar or not */
338   guint skip_taskbar : 1;
339   guint skip_pager : 1;
340 
341   /* TRUE if client set these */
342   guint wm_state_above : 1;
343   guint wm_state_below : 1;
344 
345   /* EWHH demands attention flag */
346   guint wm_state_demands_attention : 1;
347 
348   /* this flag tracks receipt of focus_in focus_out */
349   guint has_focus : 1;
350 
351   /* Have we placed this window? */
352   guint placed : 1;
353 
354   /* Must we force_save_user_window_placement? */
355   guint force_save_user_rect : 1;
356 
357   /* Is this not a transient of the focus window which is being denied focus? */
358   guint denied_focus_and_not_transient : 1;
359 
360   /* Has this window not ever been shown yet? */
361   guint showing_for_first_time : 1;
362 
363   /* Are we in meta_window_unmanage()? */
364   guint unmanaging : 1;
365 
366   /* Are we in meta_window_new()? */
367   guint constructing : 1;
368 
369   /* Are we in the various queues? (Bitfield: see META_WINDOW_IS_IN_QUEUE) */
370   guint is_in_queues : NUMBER_OF_QUEUES;
371 
372   /* Used by keybindings.c */
373   guint keys_grabbed : 1;     /* normal keybindings grabbed */
374   guint grab_on_frame : 1;    /* grabs are on the frame */
375   guint all_keys_grabbed : 1; /* AnyKey grabbed */
376 
377   /* Set if the reason for unmanaging the window is that
378    * it was withdrawn
379    */
380   guint withdrawn : 1;
381 
382   /* TRUE if constrain_position should calc placement.
383    * only relevant if !window->placed
384    */
385   guint calc_placement : 1;
386 
387   /* Transient parent is a root window */
388   guint transient_parent_is_root_window : 1;
389 
390   /* Info on which props we got our attributes from */
391   guint using_net_wm_name              : 1; /* vs. plain wm_name */
392   guint using_net_wm_visible_name      : 1; /* tracked so we can clear it */
393   guint using_net_wm_icon_name         : 1; /* vs. plain wm_icon_name */
394   guint using_net_wm_visible_icon_name : 1; /* tracked so we can clear it */
395 
396   /* has a shape mask */
397   guint has_shape : 1;
398 
399   /* icon props have changed */
400   guint need_reread_icon : 1;
401 
402   /* if TRUE, window was maximized at start of current grab op */
403   guint shaken_loose : 1;
404 
405   /* if TRUE we have a grab on the focus click buttons */
406   guint have_focus_click_grab : 1;
407 
408   /* if TRUE, application is buggy and SYNC resizing is turned off */
409   guint disable_sync : 1;
410 
411   /* if TRUE, window is attached to its parent */
412   guint attached : 1;
413 
414   /* if non-NULL, the bounds of the window frame */
415   cairo_region_t *frame_bounds;
416 
417   /* if non-NULL, the opaque region _NET_WM_OPAQUE_REGION */
418   cairo_region_t *opaque_region;
419 
420   /* if TRUE, the we have the new form of sync request counter which
421    * also handles application frames */
422   guint extended_sync_request_counter : 1;
423 
424   /* Note: can be NULL */
425   GSList *struts;
426 
427 #ifdef HAVE_XSYNC
428   /* XSync update counter */
429   XSyncCounter sync_request_counter;
430   gint64 sync_request_serial;
431   gint64 sync_request_wait_serial;
432   guint sync_request_timeout_id;
433   /* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
434   XSyncAlarm sync_request_alarm;
435 #endif
436 
437   /* Number of UnmapNotify that are caused by us, if
438    * we get UnmapNotify with none pending then the client
439    * is withdrawing the window.
440    */
441   int unmaps_pending;
442 
443   /* See docs for meta_window_get_stable_sequence() */
444   guint32 stable_sequence;
445 
446   /* set to the most recent user-interaction event timestamp that we
447      know about for this window */
448   guint32 net_wm_user_time;
449 
450   /* window that gets updated net_wm_user_time values */
451   Window user_time_window;
452 
453   /* The size we set the window to last (i.e. what we believe
454    * to be its actual size on the server). The x, y are
455    * the actual server-side x,y so are relative to the frame
456    * (meaning that they just hold the frame width and height)
457    * or the root window (meaning they specify the location
458    * of the top left of the inner window) as appropriate.
459    */
460   MetaRectangle rect;
461 
462   gboolean has_custom_frame_extents;
463   GtkBorder custom_frame_extents;
464 
465   /* The geometry to restore when we unmaximize.  The position is in
466    * root window coords, even if there's a frame, which contrasts with
467    * window->rect above.  Note that this gives the position and size
468    * of the client window (i.e. ignoring the frame).
469    */
470   MetaRectangle saved_rect;
471 
472   /* This is the geometry the window had after the last user-initiated
473    * move/resize operations. We use this whenever we are moving the
474    * implicitly (for example, if we move to avoid a panel, we can snap
475    * back to this position if the panel moves again).  Note that this
476    * gives the position and size of the client window (i.e. ignoring
477    * the frame).
478    *
479    * Position valid if user_has_moved, size valid if user_has_resized
480    *
481    * Position always in root coords, unlike window->rect.
482    */
483   MetaRectangle user_rect;
484 
485   MetaRectangle snapped_rect;
486 
487   /* Cached net_wm_icon_geometry */
488   MetaRectangle icon_geometry;
489 
490   /* Requested geometry */
491   int border_width;
492   /* x/y/w/h here get filled with ConfigureRequest values */
493   XSizeHints size_hints;
494 
495   /* Managed by stack.c */
496   MetaStackLayer layer;
497   int stack_position; /* see comment in stack.h */
498 
499   /* Current dialog open for this window */
500   int dialog_pid;
501 
502   /* maintained by group.c */
503   MetaGroup *group;
504 
505   GObject *compositor_private;
506 
507   /* Focused window that is (directly or indirectly) attached to this one */
508   MetaWindow *attached_focus_window;
509 
510   /* The currently complementary tiled window, if any */
511   MetaWindow *tile_match;
512 
513   /* Bypass compositor hints */
514   guint bypass_compositor;
515 };
516 
517 struct _MetaWindowClass
518 {
519   GObjectClass parent_class;
520 
521   void (*workspace_changed) (MetaWindow *window, int  old_workspace);
522   void (*focus)             (MetaWindow *window);
523   void (*raised)            (MetaWindow *window);
524   void (*unmanaged)         (MetaWindow *window);
525 };
526 
527 /* These differ from window->has_foo_func in that they consider
528  * the dynamic window state such as "maximized", not just the
529  * window's type
530  */
531 #define META_WINDOW_MAXIMIZED(w)       ((w)->maximized_horizontally && \
532                                         (w)->maximized_vertically)
533 #define META_WINDOW_MAXIMIZED_VERTICALLY(w)    ((w)->maximized_vertically)
534 #define META_WINDOW_MAXIMIZED_HORIZONTALLY(w)  ((w)->maximized_horizontally)
535 #define META_WINDOW_TILED(w)                   ((w)->tile_type == META_WINDOW_TILE_TYPE_TILED)
536 #define META_WINDOW_SNAPPED(w)                 ((w)->tile_type == META_WINDOW_TILE_TYPE_SNAPPED)
537 #define META_WINDOW_TILED_OR_SNAPPED(w)        (META_WINDOW_SNAPPED (w) || META_WINDOW_TILED (w))
538 #define META_WINDOW_TILED_LEFT(w)     (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_LEFT)
539 #define META_WINDOW_TILED_RIGHT(w)    (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_RIGHT)
540 #define META_WINDOW_TILED_SIDE_BY_SIDE(w)      (META_WINDOW_TILED_LEFT (w) || META_WINDOW_TILED_RIGHT (w))
541 #define META_WINDOW_TILED_ULC(w)       (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_ULC)
542 #define META_WINDOW_TILED_LLC(w)       (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_LLC)
543 #define META_WINDOW_TILED_URC(w)       (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_URC)
544 #define META_WINDOW_TILED_LRC(w)       (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_LRC)
545 #define META_WINDOW_TILED_CORNER(w)    (META_WINDOW_TILED_ULC (w) || \
546                                         META_WINDOW_TILED_LLC (w) || \
547                                         META_WINDOW_TILED_URC (w) || \
548                                         META_WINDOW_TILED_LRC (w))
549 
550 #define META_WINDOW_TILED_TOP(w)     (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_TOP)
551 #define META_WINDOW_TILED_BOTTOM(w)    (META_WINDOW_TILED_OR_SNAPPED (w) && (w)->tile_mode == META_TILE_BOTTOM)
552 
553 #define META_WINDOW_TILED_TOP_BOTTOM(w)  (META_WINDOW_TILED_TOP (w) || \
554                                           META_WINDOW_TILED_BOTTOM (w))
555 
556 #define META_WINDOW_ALLOWS_MOVE(w)     ((w)->has_move_func && !(w)->fullscreen)
557 #define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
558 #define META_WINDOW_ALLOWS_RESIZE(w)   (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) &&                \
559                                         (((w)->size_hints.min_width < (w)->size_hints.max_width) ||  \
560                                          ((w)->size_hints.min_height < (w)->size_hints.max_height)))
561 #define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width < (w)->size_hints.max_width && \
562                                                 !META_WINDOW_TILED_OR_SNAPPED (w))
563 #define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w)   (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height < (w)->size_hints.max_height && \
564                                                 !META_WINDOW_TILED_OR_SNAPPED (w))
565 #define META_WINDOW_ALLOWS_TOP_RESIZE(w)        (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && META_WINDOW_TILED_OR_SNAPPED (w) && \
566                                                  ((w)->tile_mode == META_TILE_BOTTOM || \
567                                                   (w)->tile_mode == META_TILE_LLC || (w)->tile_mode == META_TILE_LRC))
568 #define META_WINDOW_ALLOWS_BOTTOM_RESIZE(w)        (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && META_WINDOW_TILED_OR_SNAPPED (w) && \
569                                                     ((w)->tile_mode == META_TILE_TOP || \
570                                                      (w)->tile_mode == META_TILE_ULC || (w)->tile_mode == META_TILE_URC))
571 #define META_WINDOW_ALLOWS_LEFT_RESIZE(w)        (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && META_WINDOW_TILED_OR_SNAPPED (w) && \
572                                                   ((w)->tile_mode == META_TILE_RIGHT || \
573                                                    (w)->tile_mode == META_TILE_URC || (w)->tile_mode == META_TILE_LRC))
574 #define META_WINDOW_ALLOWS_RIGHT_RESIZE(w)        (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && META_WINDOW_TILED_OR_SNAPPED (w) && \
575                                                    ((w)->tile_mode == META_TILE_LEFT || \
576                                                     (w)->tile_mode == META_TILE_ULC || (w)->tile_mode == META_TILE_LLC))
577 #define GRAB_OP(w)                                 ((w)->display->grab_op)
578 
579 #define META_WINDOW_
580 
581 MetaWindow* meta_window_new                (MetaDisplay *display,
582                                             Window       xwindow,
583                                             gboolean     must_be_viewable);
584 MetaWindow* meta_window_new_with_attrs     (MetaDisplay       *display,
585                                             Window             xwindow,
586                                             gboolean           must_be_viewable,
587                                             MetaCompEffect     effect,
588                                             XWindowAttributes *attrs);
589 void        meta_window_unmanage           (MetaWindow  *window,
590                                             guint32      timestamp);
591 void        meta_window_queue              (MetaWindow  *window,
592                                             guint queuebits);
593 void        meta_window_real_tile          (MetaWindow        *window,
594                                             gboolean           force);
595 void        meta_window_maximize_internal  (MetaWindow        *window,
596                                             MetaMaximizeFlags  directions,
597                                             MetaRectangle     *saved_rect);
598 void        meta_window_unmaximize_with_gravity (MetaWindow        *window,
599                                                  MetaMaximizeFlags  directions,
600                                                  int                new_width,
601                                                  int                new_height,
602                                                  int                gravity);
603 void        meta_window_make_above         (MetaWindow  *window);
604 void        meta_window_unmake_above       (MetaWindow  *window);
605 void        meta_window_shade              (MetaWindow  *window,
606                                             guint32      timestamp);
607 void        meta_window_unshade            (MetaWindow  *window,
608                                             guint32      timestamp);
609 void        meta_window_adjust_opacity     (MetaWindow  *window,
610                                             gboolean     increase);
611 
612 void        meta_window_make_fullscreen_internal (MetaWindow    *window);
613 void        meta_window_make_fullscreen    (MetaWindow  *window);
614 void        meta_window_unmake_fullscreen  (MetaWindow  *window);
615 void        meta_window_update_fullscreen_monitors (MetaWindow    *window,
616                                                     unsigned long  top,
617                                                     unsigned long  bottom,
618                                                     unsigned long  left,
619                                                     unsigned long  right);
620 
621 
622 /* args to move are window pos, not frame pos */
623 void        meta_window_move_resize        (MetaWindow  *window,
624                                             gboolean     user_op,
625                                             int          root_x_nw,
626                                             int          root_y_nw,
627                                             int          w,
628                                             int          h);
629 void        meta_window_resize_with_gravity (MetaWindow  *window,
630                                              gboolean     user_op,
631                                              int          w,
632                                              int          h,
633                                              int          gravity);
634 
635 
636 /* Return whether the window should be currently mapped */
637 gboolean    meta_window_should_be_showing   (MetaWindow  *window);
638 
639 /* See warning in window.c about this function */
640 gboolean    __window_is_terminal (MetaWindow *window);
641 
642 void        meta_window_update_struts      (MetaWindow  *window);
643 
644 /* this gets root coords */
645 void        meta_window_get_position       (MetaWindow  *window,
646                                             int         *x,
647                                             int         *y);
648 
649 /* Gets root coords for x, y, width & height of client window; uses
650  * meta_window_get_position for x & y.
651  */
652 void        meta_window_get_client_root_coords (MetaWindow    *window,
653                                                 MetaRectangle *rect);
654 
655 /* gets position we need to set to stay in current position,
656  * assuming position will be gravity-compensated. i.e.
657  * this is the position a client would send in a configure
658  * request.
659  */
660 void        meta_window_get_gravity_position (MetaWindow  *window,
661                                               int          gravity,
662                                               int         *x,
663                                               int         *y);
664 /* Get geometry for saving in the session; x/y are gravity
665  * position, and w/h are in resize inc above the base size.
666  */
667 void        meta_window_get_geometry         (MetaWindow  *window,
668                                               int         *x,
669                                               int         *y,
670                                               int         *width,
671                                               int         *height);
672 
673 void        meta_window_kill               (MetaWindow  *window);
674 void        meta_window_focus              (MetaWindow  *window,
675                                             guint32      timestamp);
676 
677 void        meta_window_update_unfocused_button_grabs (MetaWindow *window);
678 
679 /* Sends a client message */
680 void meta_window_send_icccm_message (MetaWindow *window,
681                                      Atom        atom,
682                                      guint32     timestamp);
683 
684 void meta_window_create_sync_request_alarm  (MetaWindow *window);
685 void meta_window_destroy_sync_request_alarm (MetaWindow *window);
686 
687 void     meta_window_move_resize_request(MetaWindow *window,
688                                          guint       value_mask,
689                                          int         gravity,
690                                          int         x,
691                                          int         y,
692                                          int         width,
693                                          int         height);
694 gboolean meta_window_configure_request (MetaWindow *window,
695                                         XEvent     *event);
696 gboolean meta_window_property_notify   (MetaWindow *window,
697                                         XEvent     *event);
698 gboolean meta_window_client_message    (MetaWindow *window,
699                                         XEvent     *event);
700 gboolean meta_window_notify_focus      (MetaWindow *window,
701                                         XEvent     *event);
702 
703 void     meta_window_set_current_workspace_hint (MetaWindow *window);
704 
705 unsigned long meta_window_get_net_wm_desktop (MetaWindow *window);
706 
707 void meta_window_show_menu (MetaWindow *window,
708                             int         root_x,
709                             int         root_y,
710                             int         button,
711                             guint32     timestamp);
712 
713 gboolean meta_window_titlebar_is_onscreen    (MetaWindow *window);
714 void     meta_window_shove_titlebar_onscreen (MetaWindow *window);
715 
716 void meta_window_set_gravity (MetaWindow *window,
717                               int         gravity);
718 
719 #ifdef HAVE_XSYNC
720  void meta_window_update_sync_request_counter (MetaWindow *window,
721                                                gint64      new_counter_value);
722 #endif /* HAVE_XSYNC */
723 
724 void meta_window_handle_mouse_grab_op_event (MetaWindow *window,
725                                              XEvent     *event);
726 
727 void meta_window_handle_keyboard_grab_op_event (MetaWindow *window,
728                                                 XEvent     *event);
729 
730 GList* meta_window_get_workspaces (MetaWindow *window);
731 
732 gboolean meta_window_located_on_workspace (MetaWindow    *window,
733                                            MetaWorkspace *workspace);
734 
735 void meta_window_get_work_area_current_monitor (MetaWindow    *window,
736                                                 MetaRectangle *area);
737 void meta_window_get_work_area_for_monitor     (MetaWindow    *window,
738                                                 int            which_monitor,
739                                                 MetaRectangle *area);
740 void meta_window_get_work_area_all_monitors    (MetaWindow    *window,
741                                                 MetaRectangle *area);
742 
743 int meta_window_get_current_tile_monitor_number (MetaWindow *window);
744 
745 void meta_window_get_current_tile_area         (MetaWindow    *window,
746                                                 MetaRectangle *tile_area);
747 
748 void meta_window_get_tile_threshold_area_for_mode        (MetaWindow    *window,
749                                                           MetaRectangle  work_area,
750                                                           MetaTileMode   mode,
751                                                           MetaRectangle *tile_area,
752                                                           gint           zone_width);
753 
754 void meta_window_get_titlebar_rect (MetaWindow *window,
755                                     MetaRectangle *titlebar_rect);
756 
757 gboolean meta_window_same_application (MetaWindow *window,
758                                        MetaWindow *other_window);
759 
760 #define META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE(w) \
761   ((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP)
762 #define META_WINDOW_IN_NORMAL_TAB_CHAIN(w) \
763   (((w)->input || (w)->take_focus ) && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) && (!(w)->skip_taskbar))
764 #define META_WINDOW_IN_DOCK_TAB_CHAIN(w) \
765   (((w)->input || (w)->take_focus) && (! META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) || (w)->skip_taskbar))
766 #define META_WINDOW_IN_GROUP_TAB_CHAIN(w, g) \
767   (((w)->input || (w)->take_focus) && (!g || meta_window_get_group(w)==g))
768 
769 void meta_window_refresh_resize_popup (MetaWindow *window);
770 
771 void meta_window_free_delete_dialog (MetaWindow *window);
772 
773 
774 void meta_window_begin_grab_op (MetaWindow *window,
775                                 MetaGrabOp  op,
776                                 gboolean    frame_action,
777                                 guint32     timestamp);
778 
779 void meta_window_update_keyboard_resize (MetaWindow *window,
780                                          gboolean    update_cursor);
781 void meta_window_update_keyboard_move   (MetaWindow *window);
782 
783 void meta_window_update_layer (MetaWindow *window);
784 
785 void meta_window_recalc_features    (MetaWindow *window);
786 
787 void meta_window_recalc_window_type (MetaWindow *window);
788 
789 void meta_window_frame_size_changed (MetaWindow *window);
790 
791 void meta_window_stack_just_below (MetaWindow *window,
792                                    MetaWindow *below_this_one);
793 
794 void meta_window_stack_just_above (MetaWindow *window,
795                                    MetaWindow *above_this_one);
796 
797 void meta_window_set_user_time (MetaWindow *window,
798                                 guint32     timestamp);
799 
800 void meta_window_update_role (MetaWindow *window);
801 void meta_window_update_net_wm_type (MetaWindow *window);
802 void meta_window_update_for_monitors_changed (MetaWindow *window);
803 void meta_window_update_on_all_workspaces (MetaWindow *window);
804 
805 void meta_window_propagate_focus_appearance (MetaWindow *window,
806                                              gboolean    focused);
807 
808 gboolean meta_window_should_attach_to_parent (MetaWindow *window);
809 gboolean meta_window_can_tile_side_by_side   (MetaWindow *window);
810 gboolean meta_window_can_tile_top_bottom (MetaWindow *window);
811 gboolean meta_window_can_tile_corner         (MetaWindow *window);
812 MetaSide meta_window_get_tile_side (MetaWindow *window);
813 
814 void meta_window_compute_tile_match (MetaWindow *window);
815 
816 gboolean meta_window_mouse_on_edge (MetaWindow *window,
817                                     gint        x,
818                                     gint        y);
819 
820 guint meta_window_get_current_zone (MetaWindow   *window,
821                                     MetaRectangle monitor,
822                                     MetaRectangle work_area,
823                                     int           x,
824                                     int           y,
825                                     int           zone_threshold);
826 
827 void       meta_window_set_tile_type (MetaWindow *window,
828                                       MetaWindowTileType  type);
829 MetaWindowTileType  meta_window_get_tile_type (MetaWindow *window);
830 
831 gboolean meta_window_is_client_decorated (MetaWindow *window);
832 
833 
834 gboolean meta_window_updates_are_frozen (MetaWindow *window);
835 
836 void meta_window_extend_by_frame (MetaWindow              *window,
837                                   MetaRectangle           *rect,
838                                   const MetaFrameBorders  *borders);
839 void meta_window_unextend_by_frame (MetaWindow              *window,
840                                     MetaRectangle           *rect,
841                                     const MetaFrameBorders  *borders);
842 
843 void meta_window_get_client_area_rect (const MetaWindow      *window,
844                                        cairo_rectangle_int_t *rect);
845 
846 void meta_window_icon_changed (MetaWindow *window);
847 #endif
848