00001
00002
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef META_WINDOW_PRIVATE_H
00035 #define META_WINDOW_PRIVATE_H
00036
00037 #include <config.h>
00038 #include "window.h"
00039 #include "screen-private.h"
00040 #include "util.h"
00041 #include "stack.h"
00042 #include "iconcache.h"
00043 #include <X11/Xutil.h>
00044 #include <gdk-pixbuf/gdk-pixbuf.h>
00045
00046 typedef struct _MetaGroup MetaGroup;
00047 typedef struct _MetaWindowQueue MetaWindowQueue;
00048
00049 typedef gboolean (*MetaWindowForeachFunc) (MetaWindow *window,
00050 void *data);
00051
00052 typedef enum
00053 {
00054 META_WINDOW_NORMAL,
00055 META_WINDOW_DESKTOP,
00056 META_WINDOW_DOCK,
00057 META_WINDOW_DIALOG,
00058 META_WINDOW_MODAL_DIALOG,
00059 META_WINDOW_TOOLBAR,
00060 META_WINDOW_MENU,
00061 META_WINDOW_UTILITY,
00062 META_WINDOW_SPLASHSCREEN
00063 } MetaWindowType;
00064
00065 typedef enum
00066 {
00067 META_MAXIMIZE_HORIZONTAL = 1 << 0,
00068 META_MAXIMIZE_VERTICAL = 1 << 1
00069 } MetaMaximizeFlags;
00070
00071 typedef enum {
00072 META_CLIENT_TYPE_UNKNOWN = 0,
00073 META_CLIENT_TYPE_APPLICATION = 1,
00074 META_CLIENT_TYPE_PAGER = 2,
00075 META_CLIENT_TYPE_MAX_RECOGNIZED = 2
00076 } MetaClientType;
00077
00078 typedef enum {
00079 META_QUEUE_CALC_SHOWING = 1 << 0,
00080 META_QUEUE_MOVE_RESIZE = 1 << 1,
00081 META_QUEUE_UPDATE_ICON = 1 << 2,
00082 } MetaQueueType;
00083
00084 #define NUMBER_OF_QUEUES 3
00085
00086 struct _MetaWindow
00087 {
00088 MetaDisplay *display;
00089 MetaScreen *screen;
00090 MetaWorkspace *workspace;
00091 Window xwindow;
00092
00093 MetaFrame *frame;
00094 int depth;
00095 Visual *xvisual;
00096 Colormap colormap;
00097 char *desc;
00098 char *title;
00099
00100 char *icon_name;
00101 GdkPixbuf *icon;
00102 GdkPixbuf *mini_icon;
00103 MetaIconCache icon_cache;
00104 Pixmap wm_hints_pixmap;
00105 Pixmap wm_hints_mask;
00106
00107 MetaWindowType type;
00108 Atom type_atom;
00109
00110
00111
00112
00113 char *res_class;
00114 char *res_name;
00115 char *role;
00116 char *sm_client_id;
00117 char *wm_client_machine;
00118 char *startup_id;
00119
00120 int net_wm_pid;
00121
00122 Window xtransient_for;
00123 Window xgroup_leader;
00124 Window xclient_leader;
00125
00126
00127 int initial_workspace;
00128
00129
00130 guint32 initial_timestamp;
00131
00132
00133 guint maximized_horizontally : 1;
00134 guint maximized_vertically : 1;
00135
00136
00137 guint maximize_horizontally_after_placement : 1;
00138 guint maximize_vertically_after_placement : 1;
00139 guint minimize_after_placement : 1;
00140
00141
00142 guint shaded : 1;
00143
00144
00145 guint fullscreen : 1;
00146
00147
00148 guint require_fully_onscreen : 1;
00149
00150
00151 guint require_on_single_xinerama : 1;
00152
00153
00154 guint require_titlebar_visible : 1;
00155
00156
00157
00158
00159
00160 guint on_all_workspaces : 1;
00161
00162
00163 guint minimized : 1;
00164 guint was_minimized : 1;
00165 guint tab_unminimized : 1;
00166
00167
00168
00169
00170 guint mapped : 1;
00171
00172
00173
00174
00175 guint iconic : 1;
00176
00177
00178
00179 guint initially_iconic : 1;
00180
00181
00182 guint initial_workspace_set : 1;
00183
00184
00185 guint initial_timestamp_set : 1;
00186
00187
00188 guint net_wm_user_time_set : 1;
00189
00190
00191 guint take_focus : 1;
00192 guint delete_window : 1;
00193 guint net_wm_ping : 1;
00194
00195 guint input : 1;
00196
00197
00198 guint mwm_decorated : 1;
00199 guint mwm_border_only : 1;
00200 guint mwm_has_close_func : 1;
00201 guint mwm_has_minimize_func : 1;
00202 guint mwm_has_maximize_func : 1;
00203 guint mwm_has_move_func : 1;
00204 guint mwm_has_resize_func : 1;
00205
00206
00207 guint decorated : 1;
00208 guint border_only : 1;
00209 guint always_sticky : 1;
00210 guint has_close_func : 1;
00211 guint has_minimize_func : 1;
00212 guint has_maximize_func : 1;
00213 guint has_shade_func : 1;
00214 guint has_move_func : 1;
00215 guint has_resize_func : 1;
00216 guint has_fullscreen_func : 1;
00217
00218
00219 guint wm_state_modal : 1;
00220
00221
00222 guint wm_state_skip_taskbar : 1;
00223 guint wm_state_skip_pager : 1;
00224
00225
00226 guint skip_taskbar : 1;
00227 guint skip_pager : 1;
00228
00229
00230 guint wm_state_above : 1;
00231 guint wm_state_below : 1;
00232
00233
00234 guint wm_state_demands_attention : 1;
00235
00236
00237
00238
00239 guint has_focus : 1;
00240
00241
00242 guint placed : 1;
00243
00244
00245 guint denied_focus_and_not_transient : 1;
00246
00247
00248 guint showing_for_first_time : 1;
00249
00250
00251 guint unmanaging : 1;
00252
00253
00254 guint constructing : 1;
00255
00256
00257 guint is_in_queues : NUMBER_OF_QUEUES;
00258
00259
00260 guint keys_grabbed : 1;
00261 guint grab_on_frame : 1;
00262 guint all_keys_grabbed : 1;
00263
00264
00265
00266
00267 guint withdrawn : 1;
00268
00269
00270
00271
00272 guint calc_placement : 1;
00273
00274
00275 guint transient_parent_is_root_window : 1;
00276
00277
00278 guint using_net_wm_name : 1;
00279 guint using_net_wm_visible_name : 1;
00280 guint using_net_wm_icon_name : 1;
00281 guint using_net_wm_visible_icon_name : 1;
00282
00283
00284 guint has_shape : 1;
00285
00286
00287 guint need_reread_icon : 1;
00288
00289
00290 guint shaken_loose : 1;
00291
00292
00293 guint have_focus_click_grab : 1;
00294
00295
00296 guint disable_sync : 1;
00297
00298
00299 GSList *struts;
00300
00301 #ifdef HAVE_XSYNC
00302
00303 XSyncCounter sync_request_counter;
00304 guint sync_request_serial;
00305 GTimeVal sync_request_time;
00306 #endif
00307
00308
00309
00310
00311
00312 int unmaps_pending;
00313
00314
00315
00316 guint32 net_wm_user_time;
00317
00318
00319 Window user_time_window;
00320
00321
00322
00323
00324
00325
00326
00327
00328 MetaRectangle rect;
00329
00330
00331
00332
00333
00334
00335 MetaRectangle saved_rect;
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 MetaRectangle user_rect;
00349
00350
00351 int border_width;
00352
00353 XSizeHints size_hints;
00354
00355
00356 MetaStackLayer layer;
00357 int stack_position;
00358
00359
00360 int dialog_pid;
00361 int dialog_pipe;
00362
00363
00364 MetaGroup *group;
00365 };
00366
00367
00368
00369
00370
00371 #define META_WINDOW_MAXIMIZED(w) ((w)->maximized_horizontally && \
00372 (w)->maximized_vertically)
00373 #define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically)
00374 #define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally)
00375 #define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen)
00376 #define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
00377 #define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \
00378 (((w)->size_hints.min_width < (w)->size_hints.max_width) || \
00379 ((w)->size_hints.min_height < (w)->size_hints.max_height)))
00380 #define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width < (w)->size_hints.max_width)
00381 #define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height < (w)->size_hints.max_height)
00382
00383 MetaWindow* meta_window_new (MetaDisplay *display,
00384 Window xwindow,
00385 gboolean must_be_viewable);
00386 MetaWindow* meta_window_new_with_attrs (MetaDisplay *display,
00387 Window xwindow,
00388 gboolean must_be_viewable,
00389 XWindowAttributes *attrs);
00390 void meta_window_free (MetaWindow *window,
00391 guint32 timestamp);
00392 void meta_window_calc_showing (MetaWindow *window);
00393 void meta_window_queue (MetaWindow *window,
00394 guint queuebits);
00395 void meta_window_minimize (MetaWindow *window);
00396 void meta_window_unminimize (MetaWindow *window);
00397 void meta_window_maximize (MetaWindow *window,
00398 MetaMaximizeFlags directions);
00399 void meta_window_maximize_internal (MetaWindow *window,
00400 MetaMaximizeFlags directions,
00401 MetaRectangle *saved_rect);
00402 void meta_window_unmaximize (MetaWindow *window,
00403 MetaMaximizeFlags directions);
00404 void meta_window_make_above (MetaWindow *window);
00405 void meta_window_unmake_above (MetaWindow *window);
00406 void meta_window_shade (MetaWindow *window,
00407 guint32 timestamp);
00408 void meta_window_unshade (MetaWindow *window,
00409 guint32 timestamp);
00410 void meta_window_change_workspace (MetaWindow *window,
00411 MetaWorkspace *workspace);
00412 void meta_window_stick (MetaWindow *window);
00413 void meta_window_unstick (MetaWindow *window);
00414
00415 void meta_window_activate (MetaWindow *window,
00416 guint32 current_time);
00417 void meta_window_activate_with_workspace (MetaWindow *window,
00418 guint32 current_time,
00419 MetaWorkspace *workspace);
00420 void meta_window_make_fullscreen_internal (MetaWindow *window);
00421 void meta_window_make_fullscreen (MetaWindow *window);
00422 void meta_window_unmake_fullscreen (MetaWindow *window);
00423
00424
00425 void meta_window_move (MetaWindow *window,
00426 gboolean user_op,
00427 int root_x_nw,
00428 int root_y_nw);
00429 void meta_window_resize (MetaWindow *window,
00430 gboolean user_op,
00431 int w,
00432 int h);
00433 void meta_window_move_resize (MetaWindow *window,
00434 gboolean user_op,
00435 int root_x_nw,
00436 int root_y_nw,
00437 int w,
00438 int h);
00439 void meta_window_resize_with_gravity (MetaWindow *window,
00440 gboolean user_op,
00441 int w,
00442 int h,
00443 int gravity);
00444
00445
00446
00447 gboolean meta_window_showing_on_its_workspace (MetaWindow *window);
00448
00449
00450 gboolean meta_window_should_be_showing (MetaWindow *window);
00451
00452
00453 gboolean __window_is_terminal (MetaWindow *window);
00454
00455 void meta_window_update_struts (MetaWindow *window);
00456
00457
00458 void meta_window_get_position (MetaWindow *window,
00459 int *x,
00460 int *y);
00461
00462
00463
00464
00465 void meta_window_get_client_root_coords (MetaWindow *window,
00466 MetaRectangle *rect);
00467
00468
00469
00470
00471
00472
00473 void meta_window_get_gravity_position (MetaWindow *window,
00474 int gravity,
00475 int *x,
00476 int *y);
00477
00478
00479
00480 void meta_window_get_geometry (MetaWindow *window,
00481 int *x,
00482 int *y,
00483 int *width,
00484 int *height);
00485 void meta_window_get_outer_rect (const MetaWindow *window,
00486 MetaRectangle *rect);
00487 void meta_window_get_xor_rect (MetaWindow *window,
00488 const MetaRectangle *grab_wireframe_rect,
00489 MetaRectangle *xor_rect);
00490 void meta_window_begin_wireframe (MetaWindow *window);
00491 void meta_window_update_wireframe (MetaWindow *window,
00492 int x,
00493 int y,
00494 int width,
00495 int height);
00496 void meta_window_end_wireframe (MetaWindow *window);
00497
00498 void meta_window_delete (MetaWindow *window,
00499 guint32 timestamp);
00500 void meta_window_kill (MetaWindow *window);
00501 void meta_window_focus (MetaWindow *window,
00502 guint32 timestamp);
00503 void meta_window_raise (MetaWindow *window);
00504 void meta_window_lower (MetaWindow *window);
00505
00506 void meta_window_update_unfocused_button_grabs (MetaWindow *window);
00507
00508
00509 void meta_window_send_icccm_message (MetaWindow *window,
00510 Atom atom,
00511 guint32 timestamp);
00512
00513
00514 void meta_window_move_resize_request(MetaWindow *window,
00515 guint value_mask,
00516 int gravity,
00517 int x,
00518 int y,
00519 int width,
00520 int height);
00521 gboolean meta_window_configure_request (MetaWindow *window,
00522 XEvent *event);
00523 gboolean meta_window_property_notify (MetaWindow *window,
00524 XEvent *event);
00525 gboolean meta_window_client_message (MetaWindow *window,
00526 XEvent *event);
00527 gboolean meta_window_notify_focus (MetaWindow *window,
00528 XEvent *event);
00529
00530 void meta_window_set_current_workspace_hint (MetaWindow *window);
00531
00532 unsigned long meta_window_get_net_wm_desktop (MetaWindow *window);
00533
00534 void meta_window_show_menu (MetaWindow *window,
00535 int root_x,
00536 int root_y,
00537 int button,
00538 guint32 timestamp);
00539
00540 gboolean meta_window_titlebar_is_onscreen (MetaWindow *window);
00541 void meta_window_shove_titlebar_onscreen (MetaWindow *window);
00542
00543 void meta_window_set_gravity (MetaWindow *window,
00544 int gravity);
00545
00546 void meta_window_handle_mouse_grab_op_event (MetaWindow *window,
00547 XEvent *event);
00548
00549 GList* meta_window_get_workspaces (MetaWindow *window);
00550
00551 gboolean meta_window_located_on_workspace (MetaWindow *window,
00552 MetaWorkspace *workspace);
00553
00554 void meta_window_get_work_area_current_xinerama (MetaWindow *window,
00555 MetaRectangle *area);
00556 void meta_window_get_work_area_for_xinerama (MetaWindow *window,
00557 int which_xinerama,
00558 MetaRectangle *area);
00559 void meta_window_get_work_area_all_xineramas (MetaWindow *window,
00560 MetaRectangle *area);
00561
00562
00563 gboolean meta_window_same_application (MetaWindow *window,
00564 MetaWindow *other_window);
00565
00566 #define META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE(w) \
00567 ((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP)
00568 #define META_WINDOW_IN_NORMAL_TAB_CHAIN(w) \
00569 (((w)->input || (w)->take_focus ) && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) && (!(w)->skip_taskbar))
00570 #define META_WINDOW_IN_DOCK_TAB_CHAIN(w) \
00571 (((w)->input || (w)->take_focus) && (! META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) || (w)->skip_taskbar))
00572 #define META_WINDOW_IN_GROUP_TAB_CHAIN(w, g) \
00573 (((w)->input || (w)->take_focus) && (!g || meta_window_get_group(w)==g))
00574
00575 void meta_window_refresh_resize_popup (MetaWindow *window);
00576
00577 void meta_window_free_delete_dialog (MetaWindow *window);
00578
00579 void meta_window_foreach_transient (MetaWindow *window,
00580 MetaWindowForeachFunc func,
00581 void *data);
00582 gboolean meta_window_is_ancestor_of_transient (MetaWindow *window,
00583 MetaWindow *transient);
00584 void meta_window_foreach_ancestor (MetaWindow *window,
00585 MetaWindowForeachFunc func,
00586 void *data);
00587 MetaWindow* meta_window_find_root_ancestor (MetaWindow *window);
00588
00589
00590 void meta_window_begin_grab_op (MetaWindow *window,
00591 MetaGrabOp op,
00592 gboolean frame_action,
00593 guint32 timestamp);
00594
00595 void meta_window_update_keyboard_resize (MetaWindow *window,
00596 gboolean update_cursor);
00597 void meta_window_update_keyboard_move (MetaWindow *window);
00598
00599 void meta_window_update_layer (MetaWindow *window);
00600
00601 gboolean meta_window_get_icon_geometry (MetaWindow *window,
00602 MetaRectangle *rect);
00603
00604 const char* meta_window_get_startup_id (MetaWindow *window);
00605
00606 void meta_window_recalc_features (MetaWindow *window);
00607 void meta_window_recalc_window_type (MetaWindow *window);
00608
00609 void meta_window_stack_just_below (MetaWindow *window,
00610 MetaWindow *below_this_one);
00611
00612 void meta_window_set_user_time (MetaWindow *window,
00613 guint32 timestamp);
00614
00615 void meta_window_set_demands_attention (MetaWindow *window);
00616
00617 void meta_window_unset_demands_attention (MetaWindow *window);
00618
00619 void meta_window_update_icon_now (MetaWindow *window);
00620
00621 #endif