You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

821 lines
32 KiB

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