1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 2 3 /** 4 * \file window-private.h Windows which Mutter 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, see <http://www.gnu.org/licenses/>. 30 */ 31 32 #ifndef META_WINDOW_PRIVATE_H 33 #define META_WINDOW_PRIVATE_H 34 35 #include <X11/Xutil.h> 36 #include <cairo.h> 37 #include <gdk-pixbuf/gdk-pixbuf.h> 38 39 #include "backends/meta-logical-monitor.h" 40 #include "clutter/clutter.h" 41 #include "core/stack.h" 42 #include "meta/compositor.h" 43 #include "meta/meta-close-dialog.h" 44 #include "meta/util.h" 45 #include "meta/window.h" 46 #include "wayland/meta-wayland-types.h" 47 #include "x11/group-private.h" 48 49 typedef struct _MetaWindowQueue MetaWindowQueue; 50 51 typedef enum 52 { 53 META_CLIENT_TYPE_UNKNOWN = 0, 54 META_CLIENT_TYPE_APPLICATION = 1, 55 META_CLIENT_TYPE_PAGER = 2, 56 META_CLIENT_TYPE_MAX_RECOGNIZED = 2 57 } MetaClientType; 58 59 typedef enum 60 { 61 META_QUEUE_CALC_SHOWING = 1 << 0, 62 META_QUEUE_MOVE_RESIZE = 1 << 1, 63 META_QUEUE_UPDATE_ICON = 1 << 2, 64 } MetaQueueType; 65 66 #define NUMBER_OF_QUEUES 3 67 68 typedef enum 69 { 70 META_MOVE_RESIZE_CONFIGURE_REQUEST = 1 << 0, 71 META_MOVE_RESIZE_USER_ACTION = 1 << 1, 72 META_MOVE_RESIZE_MOVE_ACTION = 1 << 2, 73 META_MOVE_RESIZE_RESIZE_ACTION = 1 << 3, 74 META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE = 1 << 4, 75 META_MOVE_RESIZE_STATE_CHANGED = 1 << 5, 76 META_MOVE_RESIZE_UNMAXIMIZE = 1 << 6, 77 META_MOVE_RESIZE_UNFULLSCREEN = 1 << 7, 78 META_MOVE_RESIZE_FORCE_MOVE = 1 << 8, 79 META_MOVE_RESIZE_WAYLAND_STATE_CHANGED = 1 << 9, 80 META_MOVE_RESIZE_FORCE_UPDATE_MONITOR = 1 << 10, 81 META_MOVE_RESIZE_PLACEMENT_CHANGED = 1 << 11, 82 } MetaMoveResizeFlags; 83 84 typedef enum 85 { 86 META_MOVE_RESIZE_RESULT_MOVED = 1 << 0, 87 META_MOVE_RESIZE_RESULT_RESIZED = 1 << 1, 88 META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED = 1 << 2, 89 META_MOVE_RESIZE_RESULT_STATE_CHANGED = 1 << 3, 90 } MetaMoveResizeResultFlags; 91 92 typedef enum 93 { 94 META_PLACEMENT_GRAVITY_NONE = 0, 95 META_PLACEMENT_GRAVITY_TOP = 1 << 0, 96 META_PLACEMENT_GRAVITY_BOTTOM = 1 << 1, 97 META_PLACEMENT_GRAVITY_LEFT = 1 << 2, 98 META_PLACEMENT_GRAVITY_RIGHT = 1 << 3, 99 } MetaPlacementGravity; 100 101 typedef enum 102 { 103 META_PLACEMENT_ANCHOR_NONE = 0, 104 META_PLACEMENT_ANCHOR_TOP = 1 << 0, 105 META_PLACEMENT_ANCHOR_BOTTOM = 1 << 1, 106 META_PLACEMENT_ANCHOR_LEFT = 1 << 2, 107 META_PLACEMENT_ANCHOR_RIGHT = 1 << 3, 108 } MetaPlacementAnchor; 109 110 typedef enum 111 { 112 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_NONE = 0, 113 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1 << 0, 114 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 1 << 1, 115 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_X = 1 << 2, 116 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_Y = 1 << 3, 117 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_X = 1 << 4, 118 META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 1 << 5, 119 } MetaPlacementConstraintAdjustment; 120 121 typedef enum _MetaWindowUpdateMonitorFlags 122 { 123 META_WINDOW_UPDATE_MONITOR_FLAGS_NONE = 0, 124 META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP = 1 << 0, 125 META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE = 1 << 1, 126 } MetaWindowUpdateMonitorFlags; 127 128 typedef struct _MetaPlacementRule 129 { 130 MetaRectangle anchor_rect; 131 MetaPlacementGravity gravity; 132 MetaPlacementAnchor anchor; 133 MetaPlacementConstraintAdjustment constraint_adjustment; 134 int offset_x; 135 int offset_y; 136 int width; 137 int height; 138 139 gboolean is_reactive; 140 141 MetaRectangle parent_rect; 142 } MetaPlacementRule; 143 144 typedef enum _MetaPlacementState 145 { 146 META_PLACEMENT_STATE_UNCONSTRAINED, 147 META_PLACEMENT_STATE_CONSTRAINED_PENDING, 148 META_PLACEMENT_STATE_CONSTRAINED_CONFIGURED, 149 META_PLACEMENT_STATE_CONSTRAINED_FINISHED, 150 META_PLACEMENT_STATE_INVALIDATED, 151 } MetaPlacementState; 152 153 typedef enum 154 { 155 META_EDGE_CONSTRAINT_NONE = 0, 156 META_EDGE_CONSTRAINT_WINDOW = 1, 157 META_EDGE_CONSTRAINT_MONITOR = 2, 158 } MetaEdgeConstraint; 159 160 typedef enum 161 { 162 META_EDGE_RESISTANCE_DEFAULT = 0, 163 META_EDGE_RESISTANCE_SNAP = 1 << 0, 164 META_EDGE_RESISTANCE_KEYBOARD_OP = 1 << 1, 165 META_EDGE_RESISTANCE_WINDOWS = 1 << 2, 166 } MetaEdgeResistanceFlags; 167 168 struct _MetaWindow 169 { 170 GObject parent_instance; 171 172 MetaDisplay *display; 173 uint64_t id; 174 guint64 stamp; 175 MetaLogicalMonitor *monitor; 176 MetaWorkspace *workspace; 177 MetaWindowClientType client_type; 178 MetaWaylandSurface *surface; 179 Window xwindow; 180 /* may be NULL! not all windows get decorated */ 181 MetaFrame *frame; 182 int depth; 183 Visual *xvisual; 184 char *desc; /* used in debug spew */ 185 char *title; 186 187 cairo_surface_t *icon; 188 cairo_surface_t *mini_icon; 189 190 MetaWindowType type; 191 192 /* NOTE these five are not in UTF-8, we just treat them as random 193 * binary data 194 */ 195 char *res_class; 196 char *res_name; 197 char *role; 198 char *sm_client_id; 199 char *wm_client_machine; 200 201 char *startup_id; 202 char *mutter_hints; 203 char *sandboxed_app_id; 204 char *gtk_theme_variant; 205 char *gtk_application_id; 206 char *gtk_unique_bus_name; 207 char *gtk_application_object_path; 208 char *gtk_window_object_path; 209 char *gtk_app_menu_object_path; 210 char *gtk_menubar_object_path; 211 212 Window xtransient_for; 213 Window xgroup_leader; 214 Window xclient_leader; 215 MetaWindow *transient_for; 216 217 /* Initial workspace property */ 218 int initial_workspace; 219 220 /* Initial timestamp property */ 221 guint32 initial_timestamp; 222 223 /* Whether this is an override redirect window or not */ 224 guint override_redirect : 1; 225 226 /* Whether we're maximized */ 227 guint maximized_horizontally : 1; 228 guint maximized_vertically : 1; 229 230 /* Whether we have to maximize/minimize after placement */ 231 guint maximize_horizontally_after_placement : 1; 232 guint maximize_vertically_after_placement : 1; 233 guint minimize_after_placement : 1; 234 235 /* The current tile mode */ 236 MetaTileMode tile_mode; 237 238 /* The last "full" maximized/unmaximized state. We need to keep track of 239 * that to toggle between normal/tiled or maximized/tiled states. */ 240 guint saved_maximize : 1; 241 int tile_monitor_number; 242 243 struct { 244 MetaEdgeConstraint top; 245 MetaEdgeConstraint right; 246 MetaEdgeConstraint bottom; 247 MetaEdgeConstraint left; 248 } edge_constraints; 249 250 double tile_hfraction; 251 252 uint64_t preferred_output_winsys_id; 253 254 /* Whether we're shaded */ 255 guint shaded : 1; 256 257 /* Whether we're fullscreen */ 258 guint fullscreen : 1; 259 260 /* Whether the window is marked as urgent */ 261 guint urgent : 1; 262 263 /* Area to cover when in fullscreen mode. If _NET_WM_FULLSCREEN_MONITORS has 264 * been overridden (via a client message), the window will cover the union of 265 * these monitors. If not, this is the single monitor which the window's 266 * origin is on. */ 267 struct { 268 MetaLogicalMonitor *top; 269 MetaLogicalMonitor *bottom; 270 MetaLogicalMonitor *left; 271 MetaLogicalMonitor *right; 272 } fullscreen_monitors; 273 274 /* Whether we're trying to constrain the window to be fully onscreen */ 275 guint require_fully_onscreen : 1; 276 277 /* Whether we're trying to constrain the window to be on a single monitor */ 278 guint require_on_single_monitor : 1; 279 280 /* Whether we're trying to constrain the window's titlebar to be onscreen */ 281 guint require_titlebar_visible : 1; 282 283 /* Whether we're sticky in the multi-workspace sense 284 * (vs. the not-scroll-with-viewport sense, we don't 285 * have no stupid viewports) 286 */ 287 guint on_all_workspaces : 1; 288 289 /* This is true if the client requested sticky, and implies on_all_workspaces == TRUE, 290 * however on_all_workspaces can be set TRUE for other internal reasons too, such as 291 * being override_redirect or being on the non-primary monitor. */ 292 guint on_all_workspaces_requested : 1; 293 294 /* Minimize is the state controlled by the minimize button */ 295 guint minimized : 1; 296 guint tab_unminimized : 1; 297 298 /* Whether the window is mapped; actual server-side state 299 * see also unmaps_pending 300 */ 301 guint mapped : 1; 302 303 /* Whether window has been hidden from view by lowering it to the bottom 304 * of window stack. 305 */ 306 guint hidden : 1; 307 308 /* Whether the compositor thinks the window is visible. 309 * This should match up with calls to meta_compositor_show_window / 310 * meta_compositor_hide_window. 311 */ 312 guint visible_to_compositor : 1; 313 314 /* Whether the compositor knows about the window. 315 * This should match up with calls to meta_compositor_add_window / 316 * meta_compositor_remove_window. 317 */ 318 guint known_to_compositor : 1; 319 320 /* When we next show or hide the window, what effect we should 321 * tell the compositor to perform. 322 */ 323 guint pending_compositor_effect : 4; /* MetaCompEffect */ 324 325 /* Iconic is the state in WM_STATE; happens for workspaces/shading 326 * in addition to minimize 327 */ 328 guint iconic : 1; 329 /* initially_iconic is the WM_HINTS setting when we first manage 330 * the window. It's taken to mean initially minimized. 331 */ 332 guint initially_iconic : 1; 333 334 /* whether an initial workspace was explicitly set */ 335 guint initial_workspace_set : 1; 336 337 /* whether an initial timestamp was explicitly set */ 338 guint initial_timestamp_set : 1; 339 340 /* whether net_wm_user_time has been set yet */ 341 guint net_wm_user_time_set : 1; 342 343 /* whether net_wm_icon_geometry has been set */ 344 guint icon_geometry_set : 1; 345 346 /* Globally active / No input */ 347 guint input : 1; 348 349 /* MWM hints about features of window */ 350 guint mwm_decorated : 1; 351 guint mwm_border_only : 1; 352 guint mwm_has_close_func : 1; 353 guint mwm_has_minimize_func : 1; 354 guint mwm_has_maximize_func : 1; 355 guint mwm_has_move_func : 1; 356 guint mwm_has_resize_func : 1; 357 358 /* Computed features of window */ 359 guint decorated : 1; 360 guint border_only : 1; 361 guint always_sticky : 1; 362 guint has_close_func : 1; 363 guint has_minimize_func : 1; 364 guint has_maximize_func : 1; 365 guint has_shade_func : 1; 366 guint has_move_func : 1; 367 guint has_resize_func : 1; 368 guint has_fullscreen_func : 1; 369 370 /* Computed whether to skip taskbar or not */ 371 guint skip_taskbar : 1; 372 guint skip_pager : 1; 373 guint skip_from_window_list : 1; 374 375 /* TRUE if client set these */ 376 guint wm_state_above : 1; 377 guint wm_state_below : 1; 378 379 /* EWHH demands attention flag */ 380 guint wm_state_demands_attention : 1; 381 382 /* TRUE iff window == window->display->focus_window */ 383 guint has_focus : 1; 384 385 /* TRUE if window appears focused at the moment */ 386 guint appears_focused : 1; 387 388 /* Have we placed this window? */ 389 guint placed : 1; 390 391 /* Is this not a transient of the focus window which is being denied focus? */ 392 guint denied_focus_and_not_transient : 1; 393 394 /* Has this window not ever been shown yet? */ 395 guint showing_for_first_time : 1; 396 397 /* Are we in meta_window_unmanage()? */ 398 guint unmanaging : 1; 399 400 /* Are we in meta_window_new()? */ 401 guint constructing : 1; 402 403 /* Are we in the various queues? (Bitfield: see META_WINDOW_IS_IN_QUEUE) */ 404 guint is_in_queues : NUMBER_OF_QUEUES; 405 406 /* Used by keybindings.c */ 407 guint keys_grabbed : 1; /* normal keybindings grabbed */ 408 guint grab_on_frame : 1; /* grabs are on the frame */ 409 guint all_keys_grabbed : 1; /* AnyKey grabbed */ 410 411 /* Set if the reason for unmanaging the window is that 412 * it was withdrawn 413 */ 414 guint withdrawn : 1; 415 416 /* TRUE if constrain_position should calc placement. 417 * only relevant if !window->placed 418 */ 419 guint calc_placement : 1; 420 421 /* if TRUE, window was maximized at start of current grab op */ 422 guint shaken_loose : 1; 423 424 /* if TRUE we have a grab on the focus click buttons */ 425 guint have_focus_click_grab : 1; 426 427 /* if TRUE, application is buggy and SYNC resizing is turned off */ 428 guint disable_sync : 1; 429 430 /* if TRUE, window is attached to its parent */ 431 guint attached : 1; 432 433 /* whether or not the window is from a program running on another machine */ 434 guint is_remote : 1; 435 436 /* whether focus should be restored on map */ 437 guint restore_focus_on_map : 1; 438 439 /* if non-NULL, the bounds of the window frame */ 440 cairo_region_t *frame_bounds; 441 442 /* if non-NULL, the bounding shape region of the window. Relative to 443 * the server-side client window. */ 444 cairo_region_t *shape_region; 445 446 /* if non-NULL, the opaque region _NET_WM_OPAQUE_REGION */ 447 cairo_region_t *opaque_region; 448 449 /* the input shape region for picking */ 450 cairo_region_t *input_region; 451 452 /* _NET_WM_WINDOW_OPACITY rescaled to 0xFF */ 453 guint8 opacity; 454 455 /* if TRUE, the we have the new form of sync request counter which 456 * also handles application frames */ 457 guint extended_sync_request_counter : 1; 458 459 /* Note: can be NULL */ 460 GSList *struts; 461 462 /* XSync update counter */ 463 XSyncCounter sync_request_counter; 464 gint64 sync_request_serial; 465 gint64 sync_request_wait_serial; 466 guint sync_request_timeout_id; 467 /* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */ 468 XSyncAlarm sync_request_alarm; 469 470 /* Number of UnmapNotify that are caused by us, if 471 * we get UnmapNotify with none pending then the client 472 * is withdrawing the window. 473 */ 474 int unmaps_pending; 475 476 /* Number of XReparentWindow requests that we have queued. 477 */ 478 int reparents_pending; 479 480 /* See docs for meta_window_get_stable_sequence() */ 481 guint32 stable_sequence; 482 483 /* set to the most recent user-interaction event timestamp that we 484 know about for this window */ 485 guint32 net_wm_user_time; 486 487 /* window that gets updated net_wm_user_time values */ 488 Window user_time_window; 489 490 gboolean has_custom_frame_extents; 491 GtkBorder custom_frame_extents; 492 493 /* The rectangles here are in "frame rect" coordinates. See the 494 * comment at the top of meta_window_move_resize_internal() for more 495 * information. */ 496 497 /* The current window geometry of the window. */ 498 MetaRectangle rect; 499 500 /* The geometry to restore when we unmaximize. */ 501 MetaRectangle saved_rect; 502 503 /* The geometry to restore when we unfullscreen. */ 504 MetaRectangle saved_rect_fullscreen; 505 506 /* This is the geometry the window will have if no constraints have 507 * applied. We use this whenever we are moving implicitly (for example, 508 * if we move to avoid a panel, we can snap back to this position if 509 * the panel moves again). 510 */ 511 MetaRectangle unconstrained_rect; 512 513 /* The rectangle of the "server-side" geometry of the buffer, 514 * in root coordinates. 515 * 516 * For X11 windows, this matches XGetGeometry of the toplevel. 517 * 518 * For Wayland windows, the position matches the position of the 519 * surface associated with shell surface (wl_shell_surface, xdg_surface 520 * etc). The size matches the size surface size as displayed in the stage. 521 */ 522 MetaRectangle buffer_rect; 523 524 /* Cached net_wm_icon_geometry */ 525 MetaRectangle icon_geometry; 526 527 /* x/y/w/h here get filled with ConfigureRequest values */ 528 XSizeHints size_hints; 529 530 /* Managed by stack.c */ 531 MetaStackLayer layer; 532 int stack_position; /* see comment in stack.h */ 533 534 /* Managed by delete.c */ 535 MetaCloseDialog *close_dialog; 536 537 /* maintained by group.c */ 538 MetaGroup *group; 539 540 GObject *compositor_private; 541 542 /* Focused window that is (directly or indirectly) attached to this one */ 543 MetaWindow *attached_focus_window; 544 545 /* The currently complementary tiled window, if any */ 546 MetaWindow *tile_match; 547 548 struct { 549 MetaPlacementRule *rule; 550 MetaPlacementState state; 551 552 struct { 553 int x; 554 int y; 555 int rel_x; 556 int rel_y; 557 } pending; 558 559 struct { 560 int rel_x; 561 int rel_y; 562 } current; 563 } placement; 564 565 guint unmanage_idle_id; 566 567 pid_t client_pid; 568 569 gboolean has_valid_cgroup; 570 GFile *cgroup_path; 571 }; 572 573 struct _MetaWindowClass 574 { 575 GObjectClass parent_class; 576 577 void (*manage) (MetaWindow *window); 578 void (*unmanage) (MetaWindow *window); 579 void (*ping) (MetaWindow *window, 580 guint32 serial); 581 void (*delete) (MetaWindow *window, 582 guint32 timestamp); 583 void (*kill) (MetaWindow *window); 584 void (*focus) (MetaWindow *window, 585 guint32 timestamp); 586 void (*grab_op_began) (MetaWindow *window, 587 MetaGrabOp op); 588 void (*grab_op_ended) (MetaWindow *window, 589 MetaGrabOp op); 590 void (*current_workspace_changed) (MetaWindow *window); 591 void (*move_resize_internal) (MetaWindow *window, 592 MetaGravity gravity, 593 MetaRectangle unconstrained_rect, 594 MetaRectangle constrained_rect, 595 MetaRectangle temporary_rect, 596 int rel_x, 597 int rel_y, 598 MetaMoveResizeFlags flags, 599 MetaMoveResizeResultFlags *result); 600 gboolean (*update_struts) (MetaWindow *window); 601 void (*get_default_skip_hints) (MetaWindow *window, 602 gboolean *skip_taskbar_out, 603 gboolean *skip_pager_out); 604 gboolean (*update_icon) (MetaWindow *window, 605 cairo_surface_t **icon, 606 cairo_surface_t **mini_icon); 607 pid_t (*get_client_pid) (MetaWindow *window); 608 void (*update_main_monitor) (MetaWindow *window, 609 MetaWindowUpdateMonitorFlags flags); 610 void (*main_monitor_changed) (MetaWindow *window, 611 const MetaLogicalMonitor *old); 612 void (*adjust_fullscreen_monitor_rect) (MetaWindow *window, 613 MetaRectangle *monitor_rect); 614 void (*force_restore_shortcuts) (MetaWindow *window, 615 ClutterInputDevice *source); 616 gboolean (*shortcuts_inhibited) (MetaWindow *window, 617 ClutterInputDevice *source); 618 gboolean (*is_focusable) (MetaWindow *window); 619 gboolean (*is_stackable) (MetaWindow *window); 620 gboolean (*can_ping) (MetaWindow *window); 621 gboolean (*are_updates_frozen) (MetaWindow *window); 622 gboolean (*is_focus_async) (MetaWindow *window); 623 624 MetaStackLayer (*calculate_layer) (MetaWindow *window); 625 626 void (* map) (MetaWindow *window); 627 void (* unmap) (MetaWindow *window); 628 }; 629 630 /* These differ from window->has_foo_func in that they consider 631 * the dynamic window state such as "maximized", not just the 632 * window's type 633 */ 634 #define META_WINDOW_MAXIMIZED(w) ((w)->maximized_horizontally && \ 635 (w)->maximized_vertically) 636 #define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically) 637 #define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally) 638 #define META_WINDOW_TILED_SIDE_BY_SIDE(w) ((w)->maximized_vertically && \ 639 !(w)->maximized_horizontally && \ 640 (w)->tile_mode != META_TILE_NONE) 641 #define META_WINDOW_TILED_LEFT(w) (META_WINDOW_TILED_SIDE_BY_SIDE(w) && \ 642 (w)->tile_mode == META_TILE_LEFT) 643 #define META_WINDOW_TILED_RIGHT(w) (META_WINDOW_TILED_SIDE_BY_SIDE(w) && \ 644 (w)->tile_mode == META_TILE_RIGHT) 645 #define META_WINDOW_TILED_MAXIMIZED(w)(META_WINDOW_MAXIMIZED(w) && \ 646 (w)->tile_mode == META_TILE_MAXIMIZED) 647 #define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen) 648 #define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded) 649 #define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \ 650 (((w)->size_hints.min_width < (w)->size_hints.max_width) || \ 651 ((w)->size_hints.min_height < (w)->size_hints.max_height))) 652 #define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width < (w)->size_hints.max_width) 653 #define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height < (w)->size_hints.max_height) 654 655 MetaWindow * _meta_window_shared_new (MetaDisplay *display, 656 MetaWindowClientType client_type, 657 MetaWaylandSurface *surface, 658 Window xwindow, 659 gulong existing_wm_state, 660 MetaCompEffect effect, 661 XWindowAttributes *attrs); 662 663 void meta_window_unmanage (MetaWindow *window, 664 guint32 timestamp); 665 void meta_window_unmanage_on_idle (MetaWindow *window); 666 void meta_window_queue (MetaWindow *window, 667 guint queuebits); 668 META_EXPORT_TEST 669 void meta_window_untile (MetaWindow *window); 670 671 META_EXPORT_TEST 672 void meta_window_tile (MetaWindow *window, 673 MetaTileMode mode); 674 MetaTileMode meta_window_get_tile_mode (MetaWindow *window); 675 void meta_window_restore_tile (MetaWindow *window, 676 MetaTileMode mode, 677 int width, 678 int height); 679 void meta_window_maximize_internal (MetaWindow *window, 680 MetaMaximizeFlags directions, 681 MetaRectangle *saved_rect); 682 683 void meta_window_make_fullscreen_internal (MetaWindow *window); 684 void meta_window_update_fullscreen_monitors (MetaWindow *window, 685 MetaLogicalMonitor *top, 686 MetaLogicalMonitor *bottom, 687 MetaLogicalMonitor *left, 688 MetaLogicalMonitor *right); 689 690 gboolean meta_window_has_fullscreen_monitors (MetaWindow *window); 691 692 void meta_window_adjust_fullscreen_monitor_rect (MetaWindow *window, 693 MetaRectangle *monitor_rect); 694 695 void meta_window_resize_frame_with_gravity (MetaWindow *window, 696 gboolean user_op, 697 int w, 698 int h, 699 MetaGravity gravity); 700 701 /* Return whether the window should be currently mapped */ 702 gboolean meta_window_should_be_showing (MetaWindow *window); 703 704 void meta_window_update_struts (MetaWindow *window); 705 706 /* gets position we need to set to stay in current position, 707 * assuming position will be gravity-compensated. i.e. 708 * this is the position a client would send in a configure 709 * request. 710 */ 711 void meta_window_get_gravity_position (MetaWindow *window, 712 MetaGravity gravity, 713 int *x, 714 int *y); 715 /* Get geometry for saving in the session; x/y are gravity 716 * position, and w/h are in resize inc above the base size. 717 */ 718 void meta_window_get_session_geometry (MetaWindow *window, 719 int *x, 720 int *y, 721 int *width, 722 int *height); 723 724 void meta_window_update_unfocused_button_grabs (MetaWindow *window); 725 726 void meta_window_update_appears_focused (MetaWindow *window); 727 728 void meta_window_set_focused_internal (MetaWindow *window, 729 gboolean focused); 730 731 gboolean meta_window_is_focusable (MetaWindow *window); 732 733 gboolean meta_window_can_ping (MetaWindow *window); 734 735 MetaStackLayer meta_window_calculate_layer (MetaWindow *window); 736 737 void meta_window_current_workspace_changed (MetaWindow *window); 738 739 void meta_window_show_menu (MetaWindow *window, 740 MetaWindowMenuType menu, 741 int x, 742 int y); 743 744 void meta_window_show_menu_for_rect (MetaWindow *window, 745 MetaWindowMenuType menu, 746 MetaRectangle *rect); 747 748 gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window, 749 const ClutterEvent *event); 750 751 GList* meta_window_get_workspaces (MetaWindow *window); 752 753 void meta_window_get_work_area_for_logical_monitor (MetaWindow *window, 754 MetaLogicalMonitor *logical_monitor, 755 MetaRectangle *area); 756 757 int meta_window_get_current_tile_monitor_number (MetaWindow *window); 758 void meta_window_get_tile_area (MetaWindow *window, 759 MetaTileMode mode, 760 MetaRectangle *tile_area); 761 762 763 gboolean meta_window_same_application (MetaWindow *window, 764 MetaWindow *other_window); 765 766 #define META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE(w) \ 767 ((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP) 768 #define META_WINDOW_IN_NORMAL_TAB_CHAIN(w) \ 769 (meta_window_is_focusable (w) && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) && (!(w)->skip_taskbar)) 770 #define META_WINDOW_IN_DOCK_TAB_CHAIN(w) \ 771 (meta_window_is_focusable (w) && (! META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) || (w)->skip_taskbar)) 772 #define META_WINDOW_IN_GROUP_TAB_CHAIN(w, g) \ 773 (meta_window_is_focusable (w) && (!g || meta_window_get_group(w)==g)) 774 775 void meta_window_free_delete_dialog (MetaWindow *window); 776 777 void meta_window_update_keyboard_resize (MetaWindow *window, 778 gboolean update_cursor); 779 void meta_window_update_keyboard_move (MetaWindow *window); 780 781 MetaStackLayer meta_window_get_default_layer (MetaWindow *window); 782 void meta_window_update_layer (MetaWindow *window); 783 784 void meta_window_recalc_features (MetaWindow *window); 785 786 void meta_window_set_type (MetaWindow *window, 787 MetaWindowType type); 788 789 void meta_window_frame_size_changed (MetaWindow *window); 790 791 gboolean meta_window_is_in_stack (MetaWindow *window); 792 793 void meta_window_stack_just_below (MetaWindow *window, 794 MetaWindow *below_this_one); 795 796 void meta_window_stack_just_above (MetaWindow *window, 797 MetaWindow *above_this_one); 798 799 void meta_window_set_user_time (MetaWindow *window, 800 guint32 timestamp); 801 802 void meta_window_update_for_monitors_changed (MetaWindow *window); 803 void meta_window_on_all_workspaces_changed (MetaWindow *window); 804 805 gboolean meta_window_should_attach_to_parent (MetaWindow *window); 806 gboolean meta_window_can_tile_side_by_side (MetaWindow *window); 807 808 void meta_window_compute_tile_match (MetaWindow *window); 809 810 gboolean meta_window_updates_are_frozen (MetaWindow *window); 811 812 void meta_window_set_title (MetaWindow *window, 813 const char *title); 814 void meta_window_set_wm_class (MetaWindow *window, 815 const char *wm_class, 816 const char *wm_instance); 817 void meta_window_set_gtk_dbus_properties (MetaWindow *window, 818 const char *application_id, 819 const char *unique_bus_name, 820 const char *appmenu_path, 821 const char *menubar_path, 822 const char *application_object_path, 823 const char *window_object_path); 824 825 gboolean meta_window_has_transient_type (MetaWindow *window); 826 827 void meta_window_set_transient_for (MetaWindow *window, 828 MetaWindow *parent); 829 830 void meta_window_set_opacity (MetaWindow *window, 831 guint8 opacity); 832 833 void meta_window_handle_enter (MetaWindow *window, 834 guint32 timestamp, 835 guint root_x, 836 guint root_y); 837 void meta_window_handle_leave (MetaWindow *window); 838 839 gboolean meta_window_handle_ui_frame_event (MetaWindow *window, 840 const ClutterEvent *event); 841 842 void meta_window_handle_ungrabbed_event (MetaWindow *window, 843 const ClutterEvent *event); 844 845 void meta_window_get_client_area_rect (const MetaWindow *window, 846 cairo_rectangle_int_t *rect); 847 void meta_window_get_titlebar_rect (MetaWindow *window, 848 MetaRectangle *titlebar_rect); 849 850 void meta_window_activate_full (MetaWindow *window, 851 guint32 timestamp, 852 MetaClientType source_indication, 853 MetaWorkspace *workspace); 854 855 META_EXPORT_TEST 856 MetaLogicalMonitor * meta_window_calculate_main_logical_monitor (MetaWindow *window); 857 858 MetaLogicalMonitor * meta_window_get_main_logical_monitor (MetaWindow *window); 859 void meta_window_update_monitor (MetaWindow *window, 860 MetaWindowUpdateMonitorFlags flags); 861 862 void meta_window_set_urgent (MetaWindow *window, 863 gboolean urgent); 864 865 void meta_window_update_resize (MetaWindow *window, 866 MetaEdgeResistanceFlags flags, 867 int x, int y, 868 gboolean force); 869 870 void meta_window_move_resize_internal (MetaWindow *window, 871 MetaMoveResizeFlags flags, 872 MetaGravity gravity, 873 MetaRectangle frame_rect); 874 875 void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op); 876 void meta_window_grab_op_ended (MetaWindow *window, MetaGrabOp op); 877 878 void meta_window_set_alive (MetaWindow *window, gboolean is_alive); 879 880 gboolean meta_window_has_pointer (MetaWindow *window); 881 882 void meta_window_emit_size_changed (MetaWindow *window); 883 884 MetaPlacementRule *meta_window_get_placement_rule (MetaWindow *window); 885 886 void meta_window_force_placement (MetaWindow *window, 887 gboolean force_move); 888 889 void meta_window_force_restore_shortcuts (MetaWindow *window, 890 ClutterInputDevice *source); 891 892 gboolean meta_window_shortcuts_inhibited (MetaWindow *window, 893 ClutterInputDevice *source); 894 gboolean meta_window_is_stackable (MetaWindow *window); 895 gboolean meta_window_is_focus_async (MetaWindow *window); 896 897 GFile *meta_window_get_unit_cgroup (MetaWindow *window); 898 gboolean meta_window_unit_cgroup_equal (MetaWindow *window1, 899 MetaWindow *window2); 900 #endif 901