diff --git a/src/core/frame.c b/src/core/frame.c index 6b97306a1..b29d54a2d 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -31,6 +31,7 @@ #include "core/keybindings-private.h" #include "meta/meta-x11-errors.h" #include "x11/meta-x11-display-private.h" +#include "x11/window-x11.h" #include "x11/window-props.h" #include @@ -49,7 +50,7 @@ meta_window_ensure_frame (MetaWindow *window) meta_x11_error_trap_push (x11_display); XChangeProperty (x11_display->xdisplay, - window->xwindow, + meta_window_x11_get_xwindow (window), x11_display->atom__MUTTER_NEEDS_FRAME, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); @@ -124,10 +125,10 @@ meta_window_set_frame_xwindow (MetaWindow *window, } meta_stack_tracker_record_remove (window->display->stack_tracker, - window->xwindow, + meta_window_x11_get_xwindow (window), XNextRequest (x11_display->xdisplay)); XReparentWindow (x11_display->xdisplay, - window->xwindow, + meta_window_x11_get_xwindow (window), frame->xwindow, frame->child_x, frame->child_y); @@ -203,12 +204,12 @@ meta_window_destroy_frame (MetaWindow *window) if (!window->unmanaging) { meta_stack_tracker_record_add (window->display->stack_tracker, - window->xwindow, + meta_window_x11_get_xwindow (window), XNextRequest (x11_display->xdisplay)); } XReparentWindow (x11_display->xdisplay, - window->xwindow, + meta_window_x11_get_xwindow (window), x11_display->xroot, /* Using anything other than client root window coordinates * coordinates here means we'll need to ensure a configure @@ -223,7 +224,7 @@ meta_window_destroy_frame (MetaWindow *window) XShapeSelectInput (x11_display->xdisplay, frame->xwindow, NoEventMask); XDeleteProperty (x11_display->xdisplay, - window->xwindow, + meta_window_x11_get_xwindow (window), x11_display->atom__MUTTER_NEEDS_FRAME); meta_x11_error_trap_pop (x11_display); diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 1fbfca64c..9852266aa 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1208,7 +1208,7 @@ meta_change_button_grab (MetaKeyBindingManager *keys, if (window->frame) xwindow = window->frame->xwindow; else - xwindow = window->xwindow; + xwindow = meta_window_x11_get_xwindow (window); /* GrabModeSync means freeze until XAllowEvents */ if (grab) @@ -1605,7 +1605,7 @@ meta_window_grab_keys (MetaWindow *window) || window->override_redirect) { if (window->keys_grabbed) - change_window_keygrabs (keys, window->xwindow, FALSE); + change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE); window->keys_grabbed = FALSE; return; } @@ -1613,7 +1613,7 @@ meta_window_grab_keys (MetaWindow *window) if (window->keys_grabbed) { if (window->frame && !window->grab_on_frame) - change_window_keygrabs (keys, window->xwindow, FALSE); + change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE); else if (window->frame == NULL && window->grab_on_frame) ; /* continue to regrab on client window */ @@ -1641,7 +1641,7 @@ meta_window_ungrab_keys (MetaWindow *window) window->frame != NULL) change_window_keygrabs (keys, window->frame->xwindow, FALSE); else if (!window->grab_on_frame) - change_window_keygrabs (keys, window->xwindow, FALSE); + change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE); window->keys_grabbed = FALSE; } diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c index 6ee15d21a..a64fbebb3 100644 --- a/src/core/stack-tracker.c +++ b/src/core/stack-tracker.c @@ -45,6 +45,7 @@ #include "meta/meta-x11-errors.h" #include "meta/util.h" #include "x11/meta-x11-display-private.h" +#include "x11/window-x11.h" /* The complexity here comes from resolving two competing factors: * @@ -581,7 +582,6 @@ on_stack_changed (MetaStack *stack, for (l = sorted; l; l = l->next) { MetaWindow *w = l->data; - uint64_t top_level_window; uint64_t stack_id; if (w->unmanaging) @@ -590,13 +590,13 @@ on_stack_changed (MetaStack *stack, meta_topic (META_DEBUG_STACK, " %u:%d - %s ", w->layer, w->stack_position, w->desc); - if (w->frame) - top_level_window = w->frame->xwindow; - else - top_level_window = w->xwindow; - if (w->client_type == META_WINDOW_CLIENT_TYPE_X11) - stack_id = top_level_window; + { + if (w->frame) + stack_id = w->frame->xwindow; + else + stack_id = meta_window_x11_get_xwindow (w); + } else stack_id = w->stamp; @@ -1047,7 +1047,7 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker) * see window-prop.c:reload_net_wm_user_time_window() for registration.) */ if (meta_window && - ((Window)window == meta_window->xwindow || + ((Window)window == meta_window_x11_get_xwindow (meta_window) || (meta_window->frame && (Window)window == meta_window->frame->xwindow))) meta_windows = g_list_prepend (meta_windows, meta_window); } diff --git a/src/core/stack.c b/src/core/stack.c index a75ca675c..75f69c686 100644 --- a/src/core/stack.c +++ b/src/core/stack.c @@ -40,6 +40,7 @@ #include "meta/prefs.h" #include "meta/workspace.h" #include "x11/meta-x11-display-private.h" +#include "x11/window-x11.h" #define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w) \ (meta_window_has_transient_type (w) && w->transient_for == NULL) diff --git a/src/core/window-private.h b/src/core/window-private.h index f51db322c..a6ffaa323 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -175,7 +175,6 @@ struct _MetaWindow MetaLogicalMonitor *highest_scale_monitor; MetaWorkspace *workspace; MetaWindowClientType client_type; - Window xwindow; /* may be NULL! not all windows get decorated */ MetaFrame *frame; int depth; diff --git a/src/core/window.c b/src/core/window.c index 95699fdb2..394afb49c 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -213,7 +213,6 @@ enum PROP_IS_ALIVE, PROP_DISPLAY, PROP_EFFECT, - PROP_XWINDOW, PROP_SUSPEND_STATE, PROP_LAST, @@ -434,9 +433,6 @@ meta_window_get_property(GObject *object, case PROP_EFFECT: g_value_set_int (value, win->pending_compositor_effect); break; - case PROP_XWINDOW: - g_value_set_ulong (value, win->xwindow); - break; case PROP_SUSPEND_STATE: g_value_set_enum (value, priv->suspend_state); break; @@ -462,9 +458,6 @@ meta_window_set_property(GObject *object, case PROP_EFFECT: win->pending_compositor_effect = g_value_get_int (value); break; - case PROP_XWINDOW: - win->xwindow = g_value_get_ulong (value); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -602,11 +595,6 @@ meta_window_class_init (MetaWindowClass *klass) META_COMP_EFFECT_NONE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); - obj_props[PROP_XWINDOW] = - g_param_spec_ulong ("xwindow", NULL, NULL, - 0, G_MAXULONG, 0, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); - /** * MetaWindow::suspend-state: (skip) */ @@ -943,12 +931,12 @@ meta_window_update_desc (MetaWindow *window) g_clear_pointer (&window->desc, g_free); if (window->client_type == META_WINDOW_CLIENT_TYPE_X11) - window->desc = g_strdup_printf ("0x%lx", window->xwindow); + window->desc = g_strdup_printf ("0x%lx", meta_window_x11_get_xwindow (window)); else { - guint64 small_stamp = window->stamp - G_GUINT64_CONSTANT(0x100000000); + guint64 small_stamp = window->stamp - G_GUINT64_CONSTANT (0x100000000); - window->desc = g_strdup_printf ("W%" G_GUINT64_FORMAT , small_stamp); + window->desc = g_strdup_printf ("W%" G_GUINT64_FORMAT, small_stamp); } } @@ -6467,17 +6455,6 @@ meta_window_get_display (MetaWindow *window) return window->display; } -/** - * meta_window_get_xwindow: (skip) - * @window: a #MetaWindow - * - */ -Window -meta_window_get_xwindow (MetaWindow *window) -{ - return window->xwindow; -} - MetaWindowType meta_window_get_window_type (MetaWindow *window) { diff --git a/src/meta/window.h b/src/meta/window.h index 855f78640..08980ef20 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -140,9 +140,6 @@ void meta_window_frame_rect_to_client_rect (MetaWindow *window, META_EXPORT MetaDisplay *meta_window_get_display (MetaWindow *window); -META_EXPORT -Window meta_window_get_xwindow (MetaWindow *window); - META_EXPORT MetaWindowType meta_window_get_window_type (MetaWindow *window); diff --git a/src/wayland/meta-window-xwayland.c b/src/wayland/meta-window-xwayland.c index 00b6cdfc6..6a431e24c 100644 --- a/src/wayland/meta-window-xwayland.c +++ b/src/wayland/meta-window-xwayland.c @@ -123,7 +123,7 @@ meta_window_xwayland_adjust_fullscreen_monitor_rect (MetaWindow *window, win_monitor_rect = meta_logical_monitor_get_layout (window->monitor); if (!meta_prop_get_cardinal_list (x11_display, - window->xwindow, + meta_window_x11_get_xwindow (window), x11_display->atom__XWAYLAND_RANDR_EMU_MONITOR_RECTS, &list, &n_items)) return; @@ -199,7 +199,7 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window, frame = meta_window_get_frame (window); if (!frame) - xwin = window->xwindow; + xwin = meta_window_x11_get_xwindow (window); else xwin = meta_frame_get_xwindow (frame); diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c index 376d9549a..c787248bd 100644 --- a/src/wayland/meta-xwayland-dnd.c +++ b/src/wayland/meta-xwayland-dnd.c @@ -41,6 +41,7 @@ #include "wayland/meta-xwayland-dnd-private.h" #include "wayland/meta-xwayland.h" #include "x11/meta-x11-display-private.h" +#include "x11/window-x11.h" #define INCR_CHUNK_SIZE (128 * 1024) #define XDND_VERSION 5 @@ -616,8 +617,9 @@ meta_x11_drag_dest_focus_in (MetaWaylandDataDevice *data_device, MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device); MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat); MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd; + MetaWindow *window = meta_wayland_surface_get_window (surface); - dnd->dnd_dest = meta_wayland_surface_get_window (surface)->xwindow; + dnd->dnd_dest = meta_window_x11_get_xwindow (window); xdnd_send_enter (dnd, dnd->dnd_dest); } diff --git a/src/x11/events.c b/src/x11/events.c index 16abd8ee8..95aca722e 100644 --- a/src/x11/events.c +++ b/src/x11/events.c @@ -808,7 +808,7 @@ handle_window_focus_event (MetaX11Display *x11_display, */ if (window) { - if (event->event == window->xwindow) + if (event->event == meta_window_x11_get_xwindow (window)) window_type = "client window"; else if (window->frame && event->event == window->frame->xwindow) window_type = "frame window"; @@ -908,7 +908,7 @@ handle_window_focus_event (MetaX11Display *x11_display, { meta_x11_display_update_focus_window (x11_display, focus_window ? - focus_window->xwindow : None, + meta_window_x11_get_xwindow (focus_window) : None, x11_display->server_focus_serial, FALSE); meta_display_update_focus_window (display, focus_window); @@ -1780,7 +1780,7 @@ static gboolean window_has_xwindow (MetaWindow *window, Window xwindow) { - if (window->xwindow == xwindow) + if (meta_window_x11_get_xwindow (window) == xwindow) return TRUE; if (window->frame && window->frame->xwindow == xwindow) diff --git a/src/x11/group.c b/src/x11/group.c index c28752df0..f08c75577 100644 --- a/src/x11/group.c +++ b/src/x11/group.c @@ -35,6 +35,7 @@ #include "meta/window.h" #include "x11/group-props.h" #include "x11/meta-x11-display-private.h" +#include "x11/window-x11.h" static MetaGroup* meta_group_new (MetaX11Display *x11_display, @@ -163,8 +164,11 @@ meta_window_compute_group (MetaWindow* window) group = g_hash_table_lookup (x11_display->groups_by_leader, &window->xgroup_leader); else - group = g_hash_table_lookup (x11_display->groups_by_leader, - &window->xwindow); + { + Window xwindow = meta_window_x11_get_xwindow (window); + group = g_hash_table_lookup (x11_display->groups_by_leader, + &xwindow); + } } if (group != NULL) @@ -182,7 +186,7 @@ meta_window_compute_group (MetaWindow* window) window->xgroup_leader); else group = meta_group_new (x11_display, - window->xwindow); + meta_window_x11_get_xwindow (window)); window->group = group; } diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index d0708e75e..d9937bd8f 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -64,6 +64,7 @@ #include "x11/group-props.h" #include "x11/meta-x11-selection-private.h" #include "x11/window-props.h" +#include "x11/window-x11.h" #include "x11/xprops.h" #ifdef HAVE_XWAYLAND @@ -2017,7 +2018,7 @@ meta_x11_display_update_active_window_hint (MetaX11Display *x11_display) x11_display->focus_xwindow); if (focus_window) - data[0] = focus_window->xwindow; + data[0] = meta_window_x11_get_xwindow (focus_window); else data[0] = None; @@ -2101,7 +2102,7 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display, if (window->frame && !meta_window_is_focusable (window)) xwindow = window->frame->xwindow; else - xwindow = window->xwindow; + xwindow = meta_window_x11_get_xwindow (window); #ifdef HAVE_X11 if (!meta_is_wayland_compositor ()) diff --git a/src/x11/meta-x11-stack.c b/src/x11/meta-x11-stack.c index 95cefc1e5..f613ce761 100644 --- a/src/x11/meta-x11-stack.c +++ b/src/x11/meta-x11-stack.c @@ -25,6 +25,7 @@ #include "core/window-private.h" #include "x11/meta-x11-display-private.h" #include "x11/meta-x11-stack-private.h" +#include "x11/window-x11.h" struct _MetaX11Stack { @@ -129,7 +130,7 @@ stack_window_removed_cb (MetaStack *stack, x11_stack->added = g_list_remove (x11_stack->added, window); x11_stack->removed = g_list_prepend (x11_stack->removed, - GUINT_TO_POINTER (window->xwindow)); + GUINT_TO_POINTER (meta_window_x11_get_xwindow (window))); if (window->frame) { x11_stack->removed = g_list_prepend (x11_stack->removed, @@ -204,10 +205,10 @@ x11_stack_do_window_additions (MetaX11Stack *x11_stack) tmp = x11_stack->added; while (tmp != NULL) { - MetaWindow *w; + MetaWindow *w = tmp->data; + Window xwindow = meta_window_x11_get_xwindow (w); - w = tmp->data; - g_array_append_val (x11_stack->xwindows, w->xwindow); + g_array_append_val (x11_stack->xwindows, xwindow); tmp = tmp->next; } } @@ -250,7 +251,11 @@ x11_stack_sync_to_xserver (MetaX11Stack *x11_stack) MetaWindow *w = tmp->data; if (w->client_type == META_WINDOW_CLIENT_TYPE_X11) - g_array_append_val (x11_stacked, w->xwindow); + { + Window xwindow = meta_window_x11_get_xwindow (w); + + g_array_append_val (x11_stacked, xwindow); + } } /* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */ diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 1cb59ce93..059f75a11 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -124,7 +124,7 @@ meta_window_reload_property (MetaWindow *window, gboolean initial) { meta_window_reload_property_from_xwindow (window, - window->xwindow, + meta_window_x11_get_xwindow (window), property, initial); } @@ -151,7 +151,8 @@ meta_window_load_initial_properties (MetaWindow *window) } n_properties = j; - meta_prop_get_values (window->display->x11_display, window->xwindow, + meta_prop_get_values (window->display->x11_display, + meta_window_x11_get_xwindow (window), values, n_properties); j = 0; @@ -525,7 +526,7 @@ set_title_text (MetaWindow *window, if (modified && atom != None) meta_prop_set_utf8_string_hint (window->display->x11_display, - window->xwindow, + meta_window_x11_get_xwindow (window), atom, *target); /* Bug 330671 -- Don't forget to clear _NET_WM_VISIBLE_(ICON_)NAME */ @@ -533,7 +534,7 @@ set_title_text (MetaWindow *window, { meta_x11_error_trap_push (window->display->x11_display); XDeleteProperty (window->display->x11_display->xdisplay, - window->xwindow, + meta_window_x11_get_xwindow (window), atom); meta_x11_error_trap_pop (window->display->x11_display); } @@ -680,7 +681,7 @@ reload_opaque_region (MetaWindow *window, } out: - if (value->source_xwindow == window->xwindow) + if (value->source_xwindow == meta_window_x11_get_xwindow (window)) meta_window_set_opaque_region (window, opaque_region); else if (window->frame && value->source_xwindow == window->frame->xwindow) meta_frame_set_opaque_region (window->frame, opaque_region); @@ -1026,7 +1027,7 @@ reload_update_counter (MetaWindow *window, { MetaSyncCounter *sync_counter; - if (value->source_xwindow == window->xwindow) + if (value->source_xwindow == meta_window_x11_get_xwindow (window)) sync_counter = meta_window_x11_get_sync_counter (window); else if (window->frame && value->source_xwindow == window->frame->xwindow) sync_counter = meta_frame_get_sync_counter (window->frame); diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h index 7d9abc4c6..cbf5b173c 100644 --- a/src/x11/window-x11-private.h +++ b/src/x11/window-x11-private.h @@ -77,6 +77,8 @@ struct _MetaWindowX11Private Visual *xvisual; + Window xwindow; + /* Bypass compositor hints */ MetaBypassCompositorHint bypass_compositor; diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index a052f1a97..c7e2f28fc 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -79,6 +79,7 @@ enum PROP_0, PROP_ATTRIBUTES, + PROP_XWINDOW, PROP_LAST, }; @@ -130,7 +131,7 @@ send_icccm_message (MetaWindow *window, MetaX11Display *x11_display = window->display->x11_display; ev.type = ClientMessage; - ev.window = window->xwindow; + ev.window = meta_window_x11_get_xwindow (window); ev.message_type = x11_display->atom_WM_PROTOCOLS; ev.format = 32; ev.data.l[0] = atom; @@ -138,7 +139,7 @@ send_icccm_message (MetaWindow *window, meta_x11_error_trap_push (x11_display); XSendEvent (x11_display->xdisplay, - window->xwindow, False, 0, (XEvent*) &ev); + meta_window_x11_get_xwindow (window), False, 0, (XEvent*) &ev); meta_x11_error_trap_pop (x11_display); } @@ -169,7 +170,7 @@ find_client_leader_func (MetaWindow *ancestor, d = data; d->leader = read_client_leader (ancestor->display, - ancestor->xwindow); + meta_window_x11_get_xwindow (ancestor)); /* keep going if no client leader found */ return d->leader == None; @@ -187,7 +188,8 @@ update_sm_hints (MetaWindow *window) * leader from transient parents. If we find a client * leader, we read the SM_CLIENT_ID from it. */ - leader = read_client_leader (window->display, window->xwindow); + leader = read_client_leader (window->display, + meta_window_x11_get_xwindow (window)); if (leader == None) { ClientLeaderData d; @@ -214,7 +216,8 @@ update_sm_hints (MetaWindow *window) /* Some broken apps (kdelibs fault?) set SM_CLIENT_ID on the app * instead of the client leader */ - meta_prop_get_latin1_string (window->display->x11_display, window->xwindow, + meta_prop_get_latin1_string (window->display->x11_display, + meta_window_x11_get_xwindow (window), window->display->x11_display->atom_SM_CLIENT_ID, &window->sm_client_id); @@ -243,8 +246,8 @@ send_configure_notify (MetaWindow *window) event.type = ConfigureNotify; event.xconfigure.display = x11_display->xdisplay; - event.xconfigure.event = window->xwindow; - event.xconfigure.window = window->xwindow; + event.xconfigure.event = priv->xwindow; + event.xconfigure.window = priv->xwindow; event.xconfigure.x = priv->client_rect.x - priv->border_width; event.xconfigure.y = priv->client_rect.y - priv->border_width; if (window->frame) @@ -282,7 +285,7 @@ send_configure_notify (MetaWindow *window) meta_x11_error_trap_push (x11_display); XSendEvent (x11_display->xdisplay, - window->xwindow, + priv->xwindow, False, StructureNotifyMask, &event); meta_x11_error_trap_pop (x11_display); } @@ -545,10 +548,10 @@ meta_window_x11_manage (MetaWindow *window) MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); - meta_sync_counter_init (&priv->sync_counter, window, window->xwindow); + meta_sync_counter_init (&priv->sync_counter, window, priv->xwindow); meta_x11_display_register_x_window (display->x11_display, - &window->xwindow, + &priv->xwindow, window); /* assign the window to its group, or create a new group if needed */ @@ -639,13 +642,13 @@ meta_window_x11_unmanage (MetaWindow *window) */ meta_verbose ("Cleaning state from window %s", window->desc); XDeleteProperty (x11_display->xdisplay, - window->xwindow, + priv->xwindow, x11_display->atom__NET_WM_DESKTOP); XDeleteProperty (x11_display->xdisplay, - window->xwindow, + priv->xwindow, x11_display->atom__NET_WM_STATE); XDeleteProperty (x11_display->xdisplay, - window->xwindow, + priv->xwindow, x11_display->atom__NET_WM_FULLSCREEN_MONITORS); meta_window_x11_set_wm_state (window); } @@ -665,20 +668,20 @@ meta_window_x11_unmanage (MetaWindow *window) * the X Window. */ XMapWindow (x11_display->xdisplay, - window->xwindow); + priv->xwindow); } - meta_x11_display_unregister_x_window (x11_display, window->xwindow); + meta_x11_display_unregister_x_window (x11_display, priv->xwindow); /* Put back anything we messed up */ if (priv->border_width != 0) XSetWindowBorderWidth (x11_display->xdisplay, - window->xwindow, + priv->xwindow, priv->border_width); /* No save set */ XRemoveFromSaveSet (x11_display->xdisplay, - window->xwindow); + priv->xwindow); /* Even though the window is now unmanaged, we can't unselect events. This * window might be a window from this process, like a GdkMenu, in @@ -702,7 +705,7 @@ meta_window_x11_unmanage (MetaWindow *window) } if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) - XShapeSelectInput (x11_display->xdisplay, window->xwindow, NoEventMask); + XShapeSelectInput (x11_display->xdisplay, priv->xwindow, NoEventMask); meta_window_ungrab_keys (window); meta_display_ungrab_window_buttons (window->display, window); @@ -787,7 +790,7 @@ meta_window_x11_delete (MetaWindow *window, meta_topic (META_DEBUG_WINDOW_OPS, "Deleting %s with explicit kill", window->desc); - XKillClient (x11_display->xdisplay, window->xwindow); + XKillClient (x11_display->xdisplay, priv->xwindow); } meta_x11_error_trap_pop (x11_display); } @@ -802,7 +805,8 @@ meta_window_x11_kill (MetaWindow *window) window->desc); meta_x11_error_trap_push (x11_display); - XKillClient (x11_display->xdisplay, window->xwindow); + XKillClient (x11_display->xdisplay, + meta_window_x11_get_xwindow (window)); meta_x11_error_trap_pop (x11_display); } @@ -1130,6 +1134,7 @@ update_net_frame_extents (MetaWindow *window) unsigned long data[4]; MetaFrameBorders borders; + Window xwindow = meta_window_x11_get_xwindow (window); meta_frame_calc_borders (window->frame, &borders); /* Left */ @@ -1144,10 +1149,10 @@ update_net_frame_extents (MetaWindow *window) meta_topic (META_DEBUG_GEOMETRY, "Setting _NET_FRAME_EXTENTS on managed window 0x%lx " "to left = %lu, right = %lu, top = %lu, bottom = %lu", - window->xwindow, data[0], data[1], data[2], data[3]); + xwindow, data[0], data[1], data[2], data[3]); meta_x11_error_trap_push (x11_display); - XChangeProperty (x11_display->xdisplay, window->xwindow, + XChangeProperty (x11_display->xdisplay, xwindow, x11_display->atom__NET_FRAME_EXTENTS, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 4); @@ -1226,7 +1231,7 @@ update_gtk_edge_constraints (MetaWindow *window) meta_x11_error_trap_push (x11_display); XChangeProperty (x11_display->xdisplay, - window->frame ? window->frame->xwindow : window->xwindow, + window->frame ? window->frame->xwindow : meta_window_x11_get_xwindow (window), x11_display->atom__GTK_EDGE_CONSTRAINTS, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); @@ -1260,7 +1265,8 @@ meta_window_x11_current_workspace_changed (MetaWindow *window) window->desc, data[0]); meta_x11_error_trap_push (x11_display); - XChangeProperty (x11_display->xdisplay, window->xwindow, + XChangeProperty (x11_display->xdisplay, + meta_window_x11_get_xwindow (window), x11_display->atom__NET_WM_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); @@ -1504,7 +1510,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window, if (mask != 0) { XConfigureWindow (window->display->x11_display->xdisplay, - window->xwindow, + priv->xwindow, mask, &values); } @@ -1551,11 +1557,12 @@ meta_window_x11_update_struts (MetaWindow *window) meta_verbose ("Updating struts for %s", window->desc); + Window xwindow = meta_window_x11_get_xwindow (window); old_struts = window->struts; new_struts = NULL; if (meta_prop_get_cardinal_list (window->display->x11_display, - window->xwindow, + xwindow, window->display->x11_display->atom__NET_WM_STRUT_PARTIAL, &struts, &nitems)) { @@ -1622,7 +1629,7 @@ meta_window_x11_update_struts (MetaWindow *window) if (!new_struts && meta_prop_get_cardinal_list (window->display->x11_display, - window->xwindow, + xwindow, window->display->x11_display->atom__NET_WM_STRUT, &struts, &nitems)) { @@ -1736,7 +1743,7 @@ meta_window_x11_get_client_pid (MetaWindow *window) xcb_res_query_client_ids_cookie_t cookie; xcb_res_query_client_ids_reply_t *reply = NULL; - spec.client = window->xwindow; + spec.client = meta_window_x11_get_xwindow (window); spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID; cookie = xcb_res_query_client_ids (xcb, 1, &spec); @@ -1956,7 +1963,8 @@ meta_window_x11_map (MetaWindow *window) MetaX11Display *x11_display = window->display->x11_display; meta_x11_error_trap_push (x11_display); - XMapWindow (x11_display->xdisplay, window->xwindow); + XMapWindow (x11_display->xdisplay, + meta_window_x11_get_xwindow (window)); meta_x11_error_trap_pop (x11_display); } @@ -1966,7 +1974,8 @@ meta_window_x11_unmap (MetaWindow *window) MetaX11Display *x11_display = window->display->x11_display; meta_x11_error_trap_push (x11_display); - XUnmapWindow (x11_display->xdisplay, window->xwindow); + XUnmapWindow (x11_display->xdisplay, + meta_window_x11_get_xwindow (window)); meta_x11_error_trap_pop (x11_display); window->unmaps_pending ++; } @@ -2048,6 +2057,9 @@ meta_window_x11_get_property (GObject *object, case PROP_ATTRIBUTES: g_value_set_pointer (value, &priv->attributes); break; + case PROP_XWINDOW: + g_value_set_ulong (value, priv->xwindow); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2068,6 +2080,9 @@ meta_window_x11_set_property (GObject *object, case PROP_ATTRIBUTES: priv->attributes = *((XWindowAttributes *) g_value_get_pointer (value)); break; + case PROP_XWINDOW: + priv->xwindow = g_value_get_ulong (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2119,6 +2134,11 @@ meta_window_x11_class_init (MetaWindowX11Class *klass) g_param_spec_pointer ("attributes", NULL, NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); + obj_props[PROP_XWINDOW] = + g_param_spec_ulong ("xwindow", NULL, NULL, + 0, G_MAXULONG, 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); + g_object_class_install_properties (object_class, PROP_LAST, obj_props); } @@ -2196,7 +2216,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window) meta_verbose ("Setting _NET_WM_STATE with %d atoms", i); meta_x11_error_trap_push (x11_display); - XChangeProperty (x11_display->xdisplay, window->xwindow, + XChangeProperty (x11_display->xdisplay, priv->xwindow, x11_display->atom__NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (guchar*) data, i); @@ -2232,7 +2252,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window) meta_verbose ("Setting _NET_WM_FULLSCREEN_MONITORS"); meta_x11_error_trap_push (x11_display); XChangeProperty (x11_display->xdisplay, - window->xwindow, + priv->xwindow, x11_display->atom__NET_WM_FULLSCREEN_MONITORS, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 4); @@ -2243,7 +2263,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window) meta_verbose ("Clearing _NET_WM_FULLSCREEN_MONITORS"); meta_x11_error_trap_push (x11_display); XDeleteProperty (x11_display->xdisplay, - window->xwindow, + priv->xwindow, x11_display->atom__NET_WM_FULLSCREEN_MONITORS); meta_x11_error_trap_pop (x11_display); } @@ -2328,7 +2348,7 @@ meta_window_x11_update_input_region (MetaWindow *window) } else { - xwindow = window->xwindow; + xwindow = priv->xwindow; } if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) @@ -2445,7 +2465,7 @@ meta_window_x11_update_shape_region (MetaWindow *window) int bounding_shaped, clip_shaped; meta_x11_error_trap_push (x11_display); - XShapeQueryExtents (x11_display->xdisplay, window->xwindow, + XShapeQueryExtents (x11_display->xdisplay, priv->xwindow, &bounding_shaped, &x_bounding, &y_bounding, &w_bounding, &h_bounding, &clip_shaped, &x_clip, &y_clip, @@ -2454,7 +2474,7 @@ meta_window_x11_update_shape_region (MetaWindow *window) if (bounding_shaped) { rects = XShapeGetRectangles (x11_display->xdisplay, - window->xwindow, + priv->xwindow, ShapeBounding, &n_rects, &ordering); @@ -2509,8 +2529,8 @@ meta_window_same_client (MetaWindow *window, { int resource_mask = window->display->x11_display->xdisplay->resource_mask; - return ((window->xwindow & ~resource_mask) == - (other_window->xwindow & ~resource_mask)); + return ((meta_window_x11_get_xwindow (window) & ~resource_mask) == + (meta_window_x11_get_xwindow (other_window) & ~resource_mask)); } static void @@ -2818,7 +2838,7 @@ static void meta_window_x11_impl_process_property_notify (MetaWindow *window, XPropertyEvent *event) { - Window xid = window->xwindow; + Window xid = meta_window_x11_get_xwindow (window); if (meta_is_verbose ()) /* avoid looking up the name if we don't have to */ { @@ -3526,7 +3546,9 @@ meta_window_x11_set_wm_state (MetaWindow *window) else state = NormalState; - set_wm_state_on_xwindow (window->display, window->xwindow, state); + set_wm_state_on_xwindow (window->display, + meta_window_x11_get_xwindow (window), + state); } /* The MUTTER_WM_CLASS_FILTER environment variable is designed for @@ -4082,7 +4104,7 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window) meta_x11_error_trap_push (x11_display); XChangeProperty (x11_display->xdisplay, - window->xwindow, + meta_window_x11_get_xwindow (window), x11_display->atom__NET_WM_ALLOWED_ACTIONS, XA_ATOM, 32, PropModeReplace, (guchar*) data, i); @@ -4127,7 +4149,7 @@ meta_window_x11_destroy_sync_request_alarm (MetaWindow *window) Window meta_window_x11_get_toplevel_xwindow (MetaWindow *window) { - return window->frame ? window->frame->xwindow : window->xwindow; + return window->frame ? window->frame->xwindow : meta_window_x11_get_xwindow (window); } void @@ -4331,3 +4353,22 @@ meta_window_x11_has_alpha_channel (MetaWindow *window) return has_alpha; } + +/** + * meta_window_x11_get_xwindow: (skip) + * @window: a #MetaWindow + * + */ +Window +meta_window_x11_get_xwindow (MetaWindow *window) +{ + MetaWindowX11 *window_x11; + MetaWindowX11Private *priv; + + g_return_val_if_fail (META_IS_WINDOW (window), None); + + window_x11 = META_WINDOW_X11 (window); + priv = meta_window_x11_get_instance_private (window_x11); + + return priv->xwindow; +} diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h index cdb475ef1..205eaaa63 100644 --- a/src/x11/window-x11.h +++ b/src/x11/window-x11.h @@ -109,3 +109,6 @@ gboolean meta_window_x11_is_awaiting_sync_response (MetaWindow *window); void meta_window_x11_check_update_resize (MetaWindow *window); gboolean meta_window_x11_has_alpha_channel (MetaWindow *window); + +META_EXPORT +Window meta_window_x11_get_xwindow (MetaWindow *window);