[mutter] Start populating MetaX11Display
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Start populating MetaX11Display
- Date: Sat, 7 Jul 2018 09:58:58 +0000 (UTC)
commit 18779109deb3d0fe89fc4aa0ca80002c24f71b81
Author: Armin Krezović <krezovic armin gmail com>
Date: Sat Aug 26 18:26:30 2017 +0200
Start populating MetaX11Display
- Moved xdisplay, name and various atoms from MetaDisplay
- Moved xroot, screen_name, default_depth and default_xvisual
from MetaScreen
- Moved some X11 specific functions from screen.c and display.c
to meta-x11-display.c
https://bugzilla.gnome.org/show_bug.cgi?id=759538
src/backends/x11/cm/meta-cursor-sprite-xfixes.c | 7 +-
src/backends/x11/meta-barrier-x11.c | 8 +-
src/compositor/compositor.c | 37 +--
src/compositor/meta-dnd.c | 5 +-
src/compositor/meta-surface-actor-x11.c | 13 +-
src/compositor/meta-window-actor.c | 10 +-
src/core/bell.c | 15 +-
src/core/display-private.h | 13 -
src/core/display.c | 174 +++++--------
src/core/frame.c | 37 ++-
src/core/keybindings.c | 30 ++-
src/core/meta-close-dialog-default.c | 3 +-
src/core/restart.c | 4 +-
src/core/screen-private.h | 9 -
src/core/screen.c | 291 ++++++++--------------
src/core/stack-tracker.c | 18 +-
src/core/stack.c | 13 +-
src/core/startup-notification.c | 3 +-
src/core/window.c | 10 +-
src/meta/display.h | 1 -
src/meta/meta-x11-display.h | 4 +
src/meta/screen.h | 2 -
src/tests/test-runner.c | 5 +-
src/tests/test-utils.c | 10 +-
src/wayland/meta-xwayland-selection.c | 11 +-
src/x11/events.c | 113 +++++----
src/x11/group-props.c | 11 +-
src/x11/group.c | 9 +-
src/x11/iconcache.c | 21 +-
src/x11/meta-x11-display-private.h | 23 ++
src/x11/meta-x11-display.c | 212 ++++++++++++++++
src/x11/session.c | 3 +-
src/x11/window-props.c | 155 ++++++------
src/x11/window-x11.c | 317 +++++++++++++-----------
src/x11/xprops.c | 34 +--
35 files changed, 903 insertions(+), 728 deletions(-)
---
diff --git a/src/backends/x11/cm/meta-cursor-sprite-xfixes.c b/src/backends/x11/cm/meta-cursor-sprite-xfixes.c
index 143ebb791..0c524668e 100644
--- a/src/backends/x11/cm/meta-cursor-sprite-xfixes.c
+++ b/src/backends/x11/cm/meta-cursor-sprite-xfixes.c
@@ -23,6 +23,7 @@
#include <X11/extensions/Xfixes.h>
#include "core/display-private.h"
+#include "meta/meta-x11-display.h"
enum
{
@@ -118,6 +119,8 @@ meta_cursor_sprite_xfixes_initable_init (GInitable *initable,
MetaCursorSpriteXfixes *sprite_xfixes =
META_CURSOR_SPRITE_XFIXES (initable);
MetaCursorSprite *sprite = META_CURSOR_SPRITE (sprite_xfixes);
+ MetaX11Display *x11_display;
+ Display *xdisplay;
XFixesCursorImage *cursor_image;
CoglTexture2D *texture;
uint8_t *cursor_data;
@@ -125,7 +128,9 @@ meta_cursor_sprite_xfixes_initable_init (GInitable *initable,
ClutterBackend *clutter_backend;
CoglContext *cogl_context;
- cursor_image = XFixesGetCursorImage (sprite_xfixes->display->xdisplay);
+ x11_display = meta_display_get_x11_display (sprite_xfixes->display);
+ xdisplay = meta_x11_display_get_xdisplay (x11_display);
+ cursor_image = XFixesGetCursorImage (xdisplay);
if (!cursor_image)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
diff --git a/src/backends/x11/meta-barrier-x11.c b/src/backends/x11/meta-barrier-x11.c
index 054e5cdc6..c56e3442e 100644
--- a/src/backends/x11/meta-barrier-x11.c
+++ b/src/backends/x11/meta-barrier-x11.c
@@ -40,6 +40,7 @@
#include <meta/barrier.h>
#include "backends/x11/meta-barrier-x11.h"
#include "display-private.h"
+#include "x11/meta-x11-display-private.h"
struct _MetaBarrierImplX11Private
{
@@ -68,10 +69,11 @@ _meta_barrier_impl_x11_release (MetaBarrierImpl *impl,
MetaBarrierImplX11Private *priv =
meta_barrier_impl_x11_get_instance_private (self);
MetaDisplay *display = priv->barrier->priv->display;
+ Display *dpy = meta_x11_display_get_xdisplay (display->x11_display);
if (META_DISPLAY_HAS_XINPUT_23 (display))
{
- XIBarrierReleasePointer (display->xdisplay,
+ XIBarrierReleasePointer (dpy,
META_VIRTUAL_CORE_POINTER_ID,
priv->xbarrier, event->event_id);
}
@@ -89,7 +91,7 @@ _meta_barrier_impl_x11_destroy (MetaBarrierImpl *impl)
if (display == NULL)
return;
- dpy = display->xdisplay;
+ dpy = meta_x11_display_get_xdisplay (display->x11_display);
if (!meta_barrier_is_active (priv->barrier))
return;
@@ -119,7 +121,7 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
priv = meta_barrier_impl_x11_get_instance_private (self);
priv->barrier = barrier;
- dpy = display->xdisplay;
+ dpy = meta_x11_display_get_xdisplay (display->x11_display);
root = DefaultRootWindow (dpy);
allowed_motion_dirs =
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 6c6708792..6f7fd65af 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -80,6 +80,8 @@
#include "backends/x11/meta-backend-x11.h"
#include "clutter/clutter-mutter.h"
+#include "x11/meta-x11-display-private.h"
+
#ifdef HAVE_WAYLAND
#include "wayland/meta-wayland-private.h"
#endif
@@ -232,7 +234,7 @@ meta_set_stage_input_region (MetaScreen *screen,
{
MetaDisplay *display = screen->display;
MetaCompositor *compositor = display->compositor;
- Display *xdpy = meta_display_get_xdisplay (display);
+ Display *xdpy = meta_x11_display_get_xdisplay (display->x11_display);
Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
@@ -256,7 +258,7 @@ meta_empty_stage_input_region (MetaScreen *screen)
if (region == None)
{
MetaDisplay *display = meta_screen_get_display (screen);
- Display *xdpy = meta_display_get_xdisplay (display);
+ Display *xdpy = meta_x11_display_get_xdisplay (display->x11_display);
region = XFixesCreateRegion (xdpy, NULL, 0);
}
@@ -365,10 +367,10 @@ meta_begin_modal_for_plugin (MetaCompositor *compositor,
return FALSE;
/* XXX: why is this needed? */
- XIUngrabDevice (display->xdisplay,
+ XIUngrabDevice (display->x11_display->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
timestamp);
- XSync (display->xdisplay, False);
+ XSync (display->x11_display->xdisplay, False);
if (!grab_devices (options, timestamp))
return FALSE;
@@ -447,12 +449,13 @@ after_stage_paint (ClutterStage *stage,
static void
redirect_windows (MetaScreen *screen)
{
- MetaDisplay *display = meta_screen_get_display (screen);
- Display *xdisplay = meta_display_get_xdisplay (display);
- Window xroot = meta_screen_get_xroot (screen);
- int screen_number = meta_screen_get_screen_number (screen);
- guint n_retries;
- guint max_retries;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ MetaX11Display *x11_display = meta_display_get_x11_display (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
+ Window xroot = meta_x11_display_get_xroot (x11_display);
+ int screen_number = meta_x11_display_get_screen_number (x11_display);
+ guint n_retries;
+ guint max_retries;
if (meta_get_replace_current_wm ())
max_retries = 5;
@@ -479,7 +482,7 @@ redirect_windows (MetaScreen *screen)
/* This probably means that a non-WM compositor like xcompmgr is running;
* we have no way to get it to exit */
meta_fatal (_("Another compositing manager is already running on screen %i on display “%s”."),
- screen_number, display->name);
+ screen_number, x11_display->name);
}
n_retries++;
@@ -491,7 +494,7 @@ void
meta_compositor_manage (MetaCompositor *compositor)
{
MetaDisplay *display = compositor->display;
- Display *xdisplay = display->xdisplay;
+ Display *xdisplay = display->x11_display->xdisplay;
MetaScreen *screen = display->screen;
MetaBackend *backend = meta_get_backend ();
@@ -571,9 +574,9 @@ meta_compositor_unmanage (MetaCompositor *compositor)
{
if (!meta_is_wayland_compositor ())
{
- MetaDisplay *display = compositor->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
- Window xroot = display->screen->xroot;
+ MetaX11Display *display = compositor->display->x11_display;
+ Display *xdisplay = display->xdisplay;
+ Window xroot = display->xroot;
/* This is the most important part of cleanup - we have to do this
* before giving up the window manager selection or the next
@@ -598,7 +601,7 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
MetaWindow *window)
{
MetaDisplay *display = compositor->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (window == NULL)
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
@@ -1169,7 +1172,7 @@ meta_pre_paint_func (gpointer data)
if (compositor->have_x11_sync_object)
compositor->have_x11_sync_object = meta_sync_ring_insert_wait ();
else
- XSync (compositor->display->xdisplay, False);
+ XSync (compositor->display->x11_display->xdisplay, False);
}
return TRUE;
diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c
index aae68c216..a30f5be7c 100644
--- a/src/compositor/meta-dnd.c
+++ b/src/compositor/meta-dnd.c
@@ -27,6 +27,7 @@
#include "core/display-private.h"
#include "backends/meta-dnd-private.h"
#include "meta/meta-dnd.h"
+#include "x11/meta-x11-display-private.h"
struct _MetaDndClass
{
@@ -159,7 +160,7 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
memset (&xevent, 0, sizeof(xevent));
xevent.xany.type = ClientMessage;
- xevent.xany.display = display->xdisplay;
+ xevent.xany.display = display->x11_display->xdisplay;
xevent.xclient.window = src;
xevent.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndStatus");
xevent.xclient.format = 32;
@@ -168,7 +169,7 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
xevent.xclient.data.l[1] = 2;
xevent.xclient.data.l[4] = None;
- XSendEvent (display->xdisplay, src, False, 0, &xevent);
+ XSendEvent (display->x11_display->xdisplay, src, False, 0, &xevent);
meta_dnd_notify_dnd_position_change (dnd,
(int)(xev->xclient.data.l[2] >> 16),
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index d32aeb68a..e521c9aee 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -35,6 +35,7 @@
#include "meta-shaped-texture-private.h"
#include "meta-cullable.h"
#include "x11/window-x11.h"
+#include "x11/meta-x11-display-private.h"
struct _MetaSurfaceActorX11Private
{
@@ -68,7 +69,7 @@ free_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (priv->damage == None)
return;
@@ -84,7 +85,7 @@ detach_pixmap (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->pixmap == None)
@@ -138,7 +139,7 @@ update_pixmap (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (priv->size_changed)
{
@@ -223,7 +224,7 @@ meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (priv->received_damage)
{
@@ -311,7 +312,7 @@ sync_unredirected (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
meta_error_trap_push (display);
@@ -403,7 +404,7 @@ static void
create_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
- Display *xdisplay = meta_display_get_xdisplay (priv->display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (priv->display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 49ed6d5b3..c4b8fe1ef 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -37,6 +37,8 @@
#include "meta-surface-actor.h"
#include "meta-surface-actor-x11.h"
+#include "x11/meta-x11-display-private.h"
+
#ifdef HAVE_WAYLAND
#include "meta-surface-actor-wayland.h"
#include "wayland/meta-wayland-surface.h"
@@ -1971,7 +1973,7 @@ do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
{
MetaWindowActorPrivate *priv = self->priv;
MetaDisplay *display = meta_window_get_display (priv->window);
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
XClientMessageEvent ev = { 0, };
@@ -1981,7 +1983,7 @@ do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
ev.type = ClientMessage;
ev.window = meta_window_get_xwindow (priv->window);
- ev.message_type = display->atom__NET_WM_FRAME_DRAWN;
+ ev.message_type = display->x11_display->atom__NET_WM_FRAME_DRAWN;
ev.format = 32;
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
ev.data.l[1] = frame->sync_request_serial >> 32;
@@ -2039,13 +2041,13 @@ do_send_frame_timings (MetaWindowActor *self,
{
MetaWindowActorPrivate *priv = self->priv;
MetaDisplay *display = meta_window_get_display (priv->window);
- Display *xdisplay = meta_display_get_xdisplay (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
XClientMessageEvent ev = { 0, };
ev.type = ClientMessage;
ev.window = meta_window_get_xwindow (priv->window);
- ev.message_type = display->atom__NET_WM_FRAME_TIMINGS;
+ ev.message_type = display->x11_display->atom__NET_WM_FRAME_TIMINGS;
ev.format = 32;
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
ev.data.l[1] = frame->sync_request_serial >> 32;
diff --git a/src/core/bell.c b/src/core/bell.c
index 56967bbfb..4a0f062f0 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -53,6 +53,7 @@
#include "window-private.h"
#include "util-private.h"
#include "compositor/compositor-private.h"
+#include "x11/meta-x11-display-private.h"
#include <meta/prefs.h>
#include <meta/compositor.h>
#ifdef HAVE_LIBCANBERRA
@@ -229,6 +230,7 @@ meta_bell_notify (MetaDisplay *display,
void
meta_bell_set_audible (MetaDisplay *display, gboolean audible)
{
+ MetaX11Display *x11_display = display->x11_display;
#ifdef HAVE_LIBCANBERRA
/* When we are playing sounds using libcanberra support, we handle the
* bell whether its an audible bell or a visible bell */
@@ -237,7 +239,7 @@ meta_bell_set_audible (MetaDisplay *display, gboolean audible)
gboolean enable_system_bell = audible;
#endif /* HAVE_LIBCANBERRA */
- XkbChangeEnabledControls (display->xdisplay,
+ XkbChangeEnabledControls (x11_display->xdisplay,
XkbUseCoreKbd,
XkbAudibleBellMask,
enable_system_bell ? XkbAudibleBellMask : 0);
@@ -247,8 +249,9 @@ gboolean
meta_bell_init (MetaDisplay *display)
{
int xkb_base_error_type, xkb_opcode;
+ MetaX11Display *x11_display = display->x11_display;
- if (!XkbQueryExtension (display->xdisplay, &xkb_opcode,
+ if (!XkbQueryExtension (x11_display->xdisplay, &xkb_opcode,
&display->xkb_base_event_type,
&xkb_base_error_type,
NULL, NULL))
@@ -262,13 +265,13 @@ meta_bell_init (MetaDisplay *display)
unsigned int mask = XkbBellNotifyMask;
gboolean visual_bell_auto_reset = FALSE;
/* TRUE if and when non-broken version is available */
- XkbSelectEvents (display->xdisplay,
+ XkbSelectEvents (x11_display->xdisplay,
XkbUseCoreKbd,
XkbBellNotifyMask,
XkbBellNotifyMask);
meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
if (visual_bell_auto_reset) {
- XkbSetAutoResetControls (display->xdisplay,
+ XkbSetAutoResetControls (x11_display->xdisplay,
XkbAudibleBellMask,
&mask,
&mask);
@@ -281,8 +284,10 @@ meta_bell_init (MetaDisplay *display)
void
meta_bell_shutdown (MetaDisplay *display)
{
+ MetaX11Display *x11_display = display->x11_display;
+
/* TODO: persist initial bell state in display, reset here */
- XkbChangeEnabledControls (display->xdisplay,
+ XkbChangeEnabledControls (x11_display->xdisplay,
XkbUseCoreKbd,
XkbAudibleBellMask,
XkbAudibleBellMask);
diff --git a/src/core/display-private.h b/src/core/display-private.h
index a3b4cca4d..9a22cc5a8 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -112,21 +112,11 @@ struct _MetaDisplay
MetaX11Display *x11_display;
- char *name;
- Display *xdisplay;
-
int clutter_event_filter;
Window leader_window;
Window timestamp_pinging_window;
- /* Pull in all the names of atoms as fields; we will intern them when the
- * class is constructed.
- */
-#define item(x) Atom atom_##x;
-#include <x11/atomnames.h>
-#undef item
-
/* The window and serial of the most recent FocusIn event. */
Window server_focus_window;
gulong server_focus_serial;
@@ -391,9 +381,6 @@ GSList* meta_display_list_windows (MetaDisplay *display,
MetaDisplay* meta_display_for_x_display (Display *xdisplay);
MetaDisplay* meta_get_display (void);
-Cursor meta_display_create_x_cursor (MetaDisplay *display,
- MetaCursor cursor);
-
void meta_display_update_cursor (MetaDisplay *display);
void meta_display_check_threshold_reached (MetaDisplay *display,
diff --git a/src/core/display.c b/src/core/display.c
index e20ebc116..1bf044233 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -572,7 +572,7 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
META_VIRTUAL_CORE_POINTER_ID,
clutter_x11_event_sequence_get_touch_detail (sequence),
- DefaultRootWindow (display->xdisplay), event_mode);
+ DefaultRootWindow (display->x11_display->xdisplay), event_mode);
}
}
@@ -612,33 +612,6 @@ meta_display_open (void)
guint32 timestamp;
Window old_active_xwindow = None;
- /* A list of all atom names, so that we can intern them in one go. */
- const char *atom_names[] = {
-#define item(x) #x,
-#include <x11/atomnames.h>
-#undef item
- };
- Atom atoms[G_N_ELEMENTS(atom_names)];
-
- meta_verbose ("Opening display '%s'\n", XDisplayName (NULL));
-
- xdisplay = meta_ui_get_display ();
-
- if (xdisplay == NULL)
- {
- meta_warning (_("Failed to open X Window System display “%s”\n"),
- XDisplayName (NULL));
- return FALSE;
- }
-
-#ifdef HAVE_WAYLAND
- if (meta_is_wayland_compositor ())
- meta_xwayland_complete_init ();
-#endif
-
- if (meta_is_syncing ())
- XSynchronize (xdisplay, True);
-
g_assert (the_display == NULL);
display = the_display = g_object_new (META_TYPE_DISPLAY, NULL);
@@ -693,12 +666,7 @@ meta_display_open (void)
display->x11_display = x11_display;
g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
- /* here we use XDisplayName which is what the user
- * probably put in, vs. DisplayString(display) which is
- * canonicalized by XOpenDisplay()
- */
- display->name = g_strdup (XDisplayName (NULL));
- display->xdisplay = xdisplay;
+ xdisplay = display->x11_display->xdisplay;
display->focus_serial = 0;
display->server_focus_window = None;
@@ -706,15 +674,6 @@ meta_display_open (void)
meta_bell_init (display);
- meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
- XInternAtoms (display->xdisplay, (char **)atom_names, G_N_ELEMENTS (atom_names),
- False, atoms);
-
- i = 0;
-#define item(x) display->atom_##x = atoms[i++];
-#include <x11/atomnames.h>
-#undef item
-
display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display);
display->group_prop_hooks = NULL;
@@ -745,10 +704,10 @@ meta_display_open (void)
major = SYNC_MAJOR_VERSION;
minor = SYNC_MINOR_VERSION;
- if (!XSyncQueryExtension (display->xdisplay,
+ if (!XSyncQueryExtension (xdisplay,
&display->xsync_event_base,
&display->xsync_error_base) ||
- !XSyncInitialize (display->xdisplay,
+ !XSyncInitialize (xdisplay,
&major, &minor))
{
display->xsync_error_base = 0;
@@ -757,7 +716,7 @@ meta_display_open (void)
else
{
display->have_xsync = TRUE;
- XSyncSetPriority (display->xdisplay, None, 10);
+ XSyncSetPriority (xdisplay, None, 10);
}
meta_verbose ("Attempted to init Xsync, found version %d.%d error base %d event base %d\n",
@@ -772,7 +731,7 @@ meta_display_open (void)
display->shape_error_base = 0;
display->shape_event_base = 0;
- if (!XShapeQueryExtension (display->xdisplay,
+ if (!XShapeQueryExtension (xdisplay,
&display->shape_event_base,
&display->shape_error_base))
{
@@ -793,7 +752,7 @@ meta_display_open (void)
display->composite_error_base = 0;
display->composite_event_base = 0;
- if (!XCompositeQueryExtension (display->xdisplay,
+ if (!XCompositeQueryExtension (xdisplay,
&display->composite_event_base,
&display->composite_error_base))
{
@@ -804,7 +763,7 @@ meta_display_open (void)
{
display->composite_major_version = 0;
display->composite_minor_version = 0;
- if (XCompositeQueryVersion (display->xdisplay,
+ if (XCompositeQueryVersion (xdisplay,
&display->composite_major_version,
&display->composite_minor_version))
{
@@ -829,7 +788,7 @@ meta_display_open (void)
display->damage_error_base = 0;
display->damage_event_base = 0;
- if (!XDamageQueryExtension (display->xdisplay,
+ if (!XDamageQueryExtension (xdisplay,
&display->damage_event_base,
&display->damage_error_base))
{
@@ -846,13 +805,13 @@ meta_display_open (void)
display->xfixes_error_base = 0;
display->xfixes_event_base = 0;
- if (XFixesQueryExtension (display->xdisplay,
+ if (XFixesQueryExtension (xdisplay,
&display->xfixes_event_base,
&display->xfixes_error_base))
{
int xfixes_major, xfixes_minor;
- XFixesQueryVersion (display->xdisplay, &xfixes_major, &xfixes_minor);
+ XFixesQueryVersion (xdisplay, &xfixes_major, &xfixes_minor);
if (xfixes_major * 100 + xfixes_minor < 500)
meta_fatal ("Mutter requires XFixes 5.0");
@@ -871,13 +830,13 @@ meta_display_open (void)
int major = 2, minor = 3;
gboolean has_xi = FALSE;
- if (XQueryExtension (display->xdisplay,
+ if (XQueryExtension (xdisplay,
"XInputExtension",
&display->xinput_opcode,
&display->xinput_error_base,
&display->xinput_event_base))
{
- if (XIQueryVersion (display->xdisplay, &major, &minor) == Success)
+ if (XIQueryVersion (xdisplay, &major, &minor) == Success)
{
int version = (major * 10) + minor;
if (version >= 22)
@@ -910,33 +869,33 @@ meta_display_open (void)
* 354213 for details.
*/
display->leader_window =
- meta_create_offscreen_window (display->xdisplay,
- DefaultRootWindow (display->xdisplay),
- PropertyChangeMask);
+ meta_x11_display_create_offscreen_window (display->x11_display,
+ DefaultRootWindow (xdisplay),
+ PropertyChangeMask);
meta_prop_set_utf8_string_hint (display,
display->leader_window,
- display->atom__NET_WM_NAME,
+ display->x11_display->atom__NET_WM_NAME,
net_wm_name);
meta_prop_set_utf8_string_hint (display,
display->leader_window,
- display->atom__GNOME_WM_KEYBINDINGS,
+ display->x11_display->atom__GNOME_WM_KEYBINDINGS,
gnome_wm_keybindings);
meta_prop_set_utf8_string_hint (display,
display->leader_window,
- display->atom__MUTTER_VERSION,
+ display->x11_display->atom__MUTTER_VERSION,
VERSION);
data[0] = display->leader_window;
- XChangeProperty (display->xdisplay,
+ XChangeProperty (xdisplay,
display->leader_window,
- display->atom__NET_SUPPORTING_WM_CHECK,
+ display->x11_display->atom__NET_SUPPORTING_WM_CHECK,
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
- XWindowEvent (display->xdisplay,
+ XWindowEvent (xdisplay,
display->leader_window,
PropertyChangeMask,
&event);
@@ -946,7 +905,7 @@ meta_display_open (void)
/* Make it painfully clear that we can't rely on PropertyNotify events on
* this window, as per bug 354213.
*/
- XSelectInput(display->xdisplay,
+ XSelectInput(xdisplay,
display->leader_window,
NoEventMask);
}
@@ -955,9 +914,9 @@ meta_display_open (void)
* that meta_create_offscreen_window already selects for PropertyChangeMask.
*/
display->timestamp_pinging_window =
- meta_create_offscreen_window (display->xdisplay,
- DefaultRootWindow (display->xdisplay),
- PropertyChangeMask);
+ meta_x11_display_create_offscreen_window (display->x11_display,
+ DefaultRootWindow (xdisplay),
+ PropertyChangeMask);
display->last_focus_time = timestamp;
display->last_user_time = timestamp;
@@ -981,8 +940,8 @@ meta_display_open (void)
display->screen = screen;
if (!meta_is_wayland_compositor ())
- meta_prop_get_window (display, display->screen->xroot,
- display->atom__NET_ACTIVE_WINDOW,
+ meta_prop_get_window (display, display->x11_display->xroot,
+ display->x11_display->atom__NET_ACTIVE_WINDOW,
&old_active_xwindow);
display->startup_notification = meta_startup_notification_get (display);
@@ -1178,15 +1137,11 @@ meta_display_close (MetaDisplay *display,
g_hash_table_destroy (display->xids);
if (display->leader_window != None)
- XDestroyWindow (display->xdisplay, display->leader_window);
-
- XFlush (display->xdisplay);
+ XDestroyWindow (display->x11_display->xdisplay, display->leader_window);
meta_display_free_window_prop_hooks (display);
meta_display_free_group_prop_hooks (display);
- g_free (display->name);
-
if (display->x11_display)
{
g_signal_emit (display, display_signals[X11_DISPLAY_CLOSING], 0);
@@ -1218,7 +1173,7 @@ meta_display_close (MetaDisplay *display,
MetaDisplay*
meta_display_for_x_display (Display *xdisplay)
{
- if (the_display->xdisplay == xdisplay)
+ if (the_display->x11_display->xdisplay == xdisplay)
return the_display;
meta_warning ("Could not find display for X display %p, probably going to crash\n",
@@ -1354,7 +1309,7 @@ find_timestamp_predicate (Display *xdisplay,
MetaDisplay *display = (MetaDisplay *) arg;
return (ev->type == PropertyNotify &&
- ev->xproperty.atom == display->atom__MUTTER_TIMESTAMP_PING);
+ ev->xproperty.atom == display->x11_display->atom__MUTTER_TIMESTAMP_PING);
}
/* Get a timestamp, even if it means a roundtrip */
@@ -1368,10 +1323,11 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
{
XEvent property_event;
- XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
- display->atom__MUTTER_TIMESTAMP_PING,
+ XChangeProperty (display->x11_display->xdisplay,
+ display->timestamp_pinging_window,
+ display->x11_display->atom__MUTTER_TIMESTAMP_PING,
XA_STRING, 8, PropModeAppend, NULL, 0);
- XIfEvent (display->xdisplay,
+ XIfEvent (display->x11_display->xdisplay,
&property_event,
find_timestamp_predicate,
(XPointer) display);
@@ -1588,21 +1544,22 @@ request_xserver_input_focus_change (MetaDisplay *display,
* we know which is which by making two requests that the server will
* process at the same time.
*/
- XGrabServer (display->xdisplay);
+ XGrabServer (display->x11_display->xdisplay);
- serial = XNextRequest (display->xdisplay);
+ serial = XNextRequest (display->x11_display->xdisplay);
- XSetInputFocus (display->xdisplay,
+ XSetInputFocus (display->x11_display->xdisplay,
xwindow,
RevertToPointerRoot,
timestamp);
- XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
- display->atom__MUTTER_FOCUS_SET,
+ XChangeProperty (display->x11_display->xdisplay,
+ display->timestamp_pinging_window,
+ display->x11_display->atom__MUTTER_FOCUS_SET,
XA_STRING, 8, PropModeAppend, NULL, 0);
- XUngrabServer (display->xdisplay);
- XFlush (display->xdisplay);
+ XUngrabServer (display->x11_display->xdisplay);
+ XFlush (display->x11_display->xdisplay);
meta_display_update_focus_window (display,
meta_window,
@@ -1934,10 +1891,10 @@ meta_display_begin_grab_op (MetaDisplay *display,
* pointer operations on the display X11 connection, we need
* to ungrab here to ensure that the backend's X11 can take
* the device grab. */
- XIUngrabDevice (display->xdisplay,
+ XIUngrabDevice (display->x11_display->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
timestamp);
- XSync (display->xdisplay, False);
+ XSync (display->x11_display->xdisplay, False);
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
display->grab_have_pointer = TRUE;
@@ -2116,8 +2073,9 @@ void
meta_display_increment_event_serial (MetaDisplay *display)
{
/* We just make some random X request */
- XDeleteProperty (display->xdisplay, display->leader_window,
- display->atom__MOTIF_WM_HINTS);
+ XDeleteProperty (display->x11_display->xdisplay,
+ display->leader_window,
+ display->x11_display->atom__MOTIF_WM_HINTS);
}
void
@@ -2134,8 +2092,9 @@ meta_display_update_active_window_hint (MetaDisplay *display)
data[0] = None;
meta_error_trap_push (display);
- XChangeProperty (display->xdisplay, display->screen->xroot,
- display->atom__NET_ACTIVE_WINDOW,
+ XChangeProperty (display->x11_display->xdisplay,
+ display->x11_display->xroot,
+ display->x11_display->atom__NET_ACTIVE_WINDOW,
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (display);
@@ -2184,7 +2143,7 @@ update_cursor_theme (void)
{
{
MetaDisplay *display = meta_get_display ();
- set_cursor_theme (display->xdisplay);
+ set_cursor_theme (display->x11_display->xdisplay);
if (display->screen)
meta_screen_update_cursor (display->screen);
@@ -2237,7 +2196,7 @@ meta_set_syncing (gboolean setting)
{
is_syncing = setting;
if (meta_get_display ())
- XSynchronize (meta_get_display ()->xdisplay, is_syncing);
+ XSynchronize (meta_get_display ()->x11_display->xdisplay, is_syncing);
}
}
@@ -2699,7 +2658,8 @@ meta_display_unmanage_screen (MetaDisplay *display,
guint32 timestamp)
{
meta_verbose ("Unmanaging screen %d on display %s\n",
- meta_ui_get_screen_number (), display->name);
+ meta_ui_get_screen_number (),
+ display->x11_display->name);
meta_display_close (display, timestamp);
}
@@ -2797,9 +2757,9 @@ meta_display_increment_focus_sentinel (MetaDisplay *display)
data[0] = meta_display_get_current_time (display);
- XChangeProperty (display->xdisplay,
- display->screen->xroot,
- display->atom__MUTTER_SENTINEL,
+ XChangeProperty (display->x11_display->xdisplay,
+ display->x11_display->xroot,
+ display->x11_display->atom__MUTTER_SENTINEL,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
@@ -2984,17 +2944,6 @@ meta_display_supports_extended_barriers (MetaDisplay *display)
g_assert_not_reached ();
}
-/**
- * meta_display_get_xdisplay: (skip)
- * @display: a #MetaDisplay
- *
- */
-Display *
-meta_display_get_xdisplay (MetaDisplay *display)
-{
- return display->xdisplay;
-}
-
/**
* meta_display_get_compositor: (skip)
* @display: a #MetaDisplay
@@ -3066,13 +3015,6 @@ meta_display_clear_mouse_mode (MetaDisplay *display)
display->mouse_mode = FALSE;
}
-Cursor
-meta_display_create_x_cursor (MetaDisplay *display,
- MetaCursor cursor)
-{
- return meta_create_x_cursor (display->xdisplay, cursor);
-}
-
MetaGestureTracker *
meta_display_get_gesture_tracker (MetaDisplay *display)
{
diff --git a/src/core/frame.c b/src/core/frame.c
index 47174f24d..22183d67b 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -27,6 +27,7 @@
#include <meta/errors.h>
#include "keybindings-private.h"
#include "backends/x11/meta-backend-x11.h"
+#include "x11/meta-x11-display-private.h"
#define EVENT_MASK (SubstructureRedirectMask | \
StructureNotifyMask | SubstructureNotifyMask | \
@@ -38,10 +39,13 @@ meta_window_ensure_frame (MetaWindow *window)
MetaFrame *frame;
XSetWindowAttributes attrs;
gulong create_serial;
+ MetaX11Display *x11_display;
if (window->frame)
return;
+ x11_display = window->display->x11_display;
+
frame = g_new (MetaFrame, 1);
frame->window = window;
@@ -62,7 +66,7 @@ meta_window_ensure_frame (MetaWindow *window)
frame->rect.width, frame->rect.height);
frame->ui_frame = meta_ui_create_frame (window->screen->ui,
- window->display->xdisplay,
+ x11_display->xdisplay,
frame->window,
window->xvisual,
frame->rect.x,
@@ -78,7 +82,7 @@ meta_window_ensure_frame (MetaWindow *window)
meta_verbose ("Frame for %s is 0x%lx\n", frame->window->desc, frame->xwindow);
attrs.event_mask = EVENT_MASK;
- XChangeWindowAttributes (window->display->xdisplay,
+ XChangeWindowAttributes (x11_display->xdisplay,
frame->xwindow, CWEventMask, &attrs);
meta_display_register_x_window (window->display, &frame->xwindow, window);
@@ -96,8 +100,8 @@ meta_window_ensure_frame (MetaWindow *window)
meta_stack_tracker_record_remove (window->screen->stack_tracker,
window->xwindow,
- XNextRequest (window->display->xdisplay));
- XReparentWindow (window->display->xdisplay,
+ XNextRequest (x11_display->xdisplay));
+ XReparentWindow (x11_display->xdisplay,
window->xwindow,
frame->xwindow,
frame->child_x,
@@ -125,7 +129,7 @@ meta_window_ensure_frame (MetaWindow *window)
/* Since the backend selects for events on another connection,
* make sure to sync the GTK+ connection to ensure that the
* frame window has been created on the server at this point. */
- XSync (window->display->xdisplay, False);
+ XSync (x11_display->xdisplay, False);
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
@@ -152,10 +156,13 @@ meta_window_destroy_frame (MetaWindow *window)
{
MetaFrame *frame;
MetaFrameBorders borders;
+ MetaX11Display *x11_display;
if (window->frame == NULL)
return;
+ x11_display = window->display->x11_display;
+
meta_verbose ("Unframing window %s\n", window->desc);
frame = window->frame;
@@ -180,10 +187,10 @@ meta_window_destroy_frame (MetaWindow *window)
}
meta_stack_tracker_record_add (window->screen->stack_tracker,
window->xwindow,
- XNextRequest (window->display->xdisplay));
- XReparentWindow (window->display->xdisplay,
+ XNextRequest (x11_display->xdisplay));
+ XReparentWindow (x11_display->xdisplay,
window->xwindow,
- window->screen->xroot,
+ x11_display->xroot,
/* Using anything other than client root window coordinates
* coordinates here means we'll need to ensure a configure
* notify event is sent; see bug 399552.
@@ -369,18 +376,22 @@ void
meta_frame_set_screen_cursor (MetaFrame *frame,
MetaCursor cursor)
{
+ MetaX11Display *x11_display;
Cursor xcursor;
if (cursor == frame->current_cursor)
return;
+
frame->current_cursor = cursor;
+ x11_display = frame->window->display->x11_display;
+
if (cursor == META_CURSOR_DEFAULT)
- XUndefineCursor (frame->window->display->xdisplay, frame->xwindow);
+ XUndefineCursor (x11_display->xdisplay, frame->xwindow);
else
{
- xcursor = meta_display_create_x_cursor (frame->window->display, cursor);
- XDefineCursor (frame->window->display->xdisplay, frame->xwindow, xcursor);
- XFlush (frame->window->display->xdisplay);
- XFreeCursor (frame->window->display->xdisplay, xcursor);
+ xcursor = meta_x11_display_create_x_cursor (x11_display, cursor);
+ XDefineCursor (x11_display->xdisplay, frame->xwindow, xcursor);
+ XFlush (x11_display->xdisplay);
+ XFreeCursor (x11_display->xdisplay, xcursor);
}
}
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index fd9bdb391..437b08ebe 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -48,6 +48,7 @@
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/x11/meta-backend-x11.h"
+#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#ifdef HAVE_NATIVE_BACKEND
@@ -1484,12 +1485,15 @@ meta_screen_change_keygrabs (MetaScreen *screen,
int i;
if (keys->overlay_resolved_key_combo.len != 0)
- meta_change_keygrab (keys, screen->xroot, grab, &keys->overlay_resolved_key_combo);
+ meta_change_keygrab (keys, display->x11_display->xroot,
+ grab, &keys->overlay_resolved_key_combo);
for (i = 0; i < keys->n_iso_next_group_combos; i++)
- meta_change_keygrab (keys, screen->xroot, grab, &keys->iso_next_group_combo[i]);
+ meta_change_keygrab (keys, display->x11_display->xroot,
+ grab, &keys->iso_next_group_combo[i]);
- change_binding_keygrabs (keys, screen->xroot, FALSE, grab);
+ change_binding_keygrabs (keys, display->x11_display->xroot,
+ FALSE, grab);
}
void
@@ -1621,7 +1625,7 @@ meta_display_grab_accelerator (MetaDisplay *display,
return META_KEYBINDING_ACTION_NONE;
}
- meta_change_keygrab (keys, display->screen->xroot, TRUE, &resolved_combo);
+ meta_change_keygrab (keys, display->x11_display->xroot, TRUE, &resolved_combo);
grab = g_new0 (MetaKeyGrab, 1);
grab->action = next_dynamic_keybinding_action ();
@@ -1665,7 +1669,8 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
{
int i;
- meta_change_keygrab (keys, display->screen->xroot, FALSE, &binding->resolved_combo);
+ meta_change_keygrab (keys, display->x11_display->xroot,
+ FALSE, &binding->resolved_combo);
for (i = 0; i < binding->resolved_combo.len; i++)
{
@@ -3030,6 +3035,7 @@ handle_panel (MetaDisplay *display,
gpointer dummy)
{
MetaKeyBindingAction action = binding->handler->data;
+ MetaX11Display *x11_display = display->x11_display;
Atom action_atom;
XClientMessageEvent ev;
@@ -3038,18 +3044,18 @@ handle_panel (MetaDisplay *display,
{
/* FIXME: The numbers are wrong */
case META_KEYBINDING_ACTION_PANEL_MAIN_MENU:
- action_atom = display->atom__GNOME_PANEL_ACTION_MAIN_MENU;
+ action_atom = x11_display->atom__GNOME_PANEL_ACTION_MAIN_MENU;
break;
case META_KEYBINDING_ACTION_PANEL_RUN_DIALOG:
- action_atom = display->atom__GNOME_PANEL_ACTION_RUN_DIALOG;
+ action_atom = x11_display->atom__GNOME_PANEL_ACTION_RUN_DIALOG;
break;
default:
return;
}
ev.type = ClientMessage;
- ev.window = screen->xroot;
- ev.message_type = display->atom__GNOME_PANEL_ACTION;
+ ev.window = x11_display->xroot;
+ ev.message_type = x11_display->atom__GNOME_PANEL_ACTION;
ev.format = 32;
ev.data.l[0] = action_atom;
ev.data.l[1] = event->time;
@@ -3062,10 +3068,10 @@ handle_panel (MetaDisplay *display,
meta_error_trap_push (display);
/* Release the grab for the panel before sending the event */
- XUngrabKeyboard (display->xdisplay, event->time);
+ XUngrabKeyboard (x11_display->xdisplay, event->time);
- XSendEvent (display->xdisplay,
- screen->xroot,
+ XSendEvent (x11_display->xdisplay,
+ x11_display->xroot,
False,
StructureNotifyMask,
(XEvent*) &ev);
diff --git a/src/core/meta-close-dialog-default.c b/src/core/meta-close-dialog-default.c
index 747a0ae34..4db017aff 100644
--- a/src/core/meta-close-dialog-default.c
+++ b/src/core/meta-close-dialog-default.c
@@ -28,6 +28,7 @@
#include "window-private.h"
#include <meta/meta-close-dialog.h>
#include "meta-close-dialog-default-private.h"
+#include "x11/meta-x11-display-private.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -157,7 +158,7 @@ meta_close_dialog_default_show (MetaCloseDialog *dialog)
dialog_pid =
meta_show_dialog ("--question",
window_content, NULL,
- window->screen->screen_name,
+ window->display->x11_display->screen_name,
_("_Force Quit"), _("_Wait"),
"face-sad-symbolic", window->xwindow,
NULL, NULL);
diff --git a/src/core/restart.c b/src/core/restart.c
index 1fa1c88b0..dec799b16 100644
--- a/src/core/restart.c
+++ b/src/core/restart.c
@@ -43,6 +43,7 @@
#include "ui.h"
#include "util-private.h"
#include "display-private.h"
+#include "x11/meta-x11-display-private.h"
static gboolean restart_helper_started = FALSE;
static gboolean restart_message_shown = FALSE;
@@ -191,7 +192,8 @@ meta_restart_finish (void)
{
if (is_restart)
{
- Display *xdisplay = meta_display_get_xdisplay (meta_get_display ());
+ MetaDisplay *display = meta_get_display ();
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Atom atom_restart_helper = XInternAtom (xdisplay, "_MUTTER_RESTART_HELPER", False);
XSetSelectionOwner (xdisplay, atom_restart_helper, None, CurrentTime);
}
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index ff796f01a..99680b731 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -48,10 +48,6 @@ struct _MetaScreen
GObject parent_instance;
MetaDisplay *display;
- char *screen_name;
- Window xroot;
- int default_depth;
- Visual *default_xvisual;
MetaRectangle rect; /* Size of screen; rect.x & rect.y are always 0 */
MetaUI *ui;
@@ -136,11 +132,6 @@ void meta_screen_update_workspace_names (MetaScreen *scree
void meta_screen_queue_workarea_recalc (MetaScreen *screen);
void meta_screen_queue_check_fullscreen (MetaScreen *screen);
-
-Window meta_create_offscreen_window (Display *xdisplay,
- Window parent,
- long valuemask);
-
typedef struct MetaWorkspaceLayout MetaWorkspaceLayout;
struct MetaWorkspaceLayout
diff --git a/src/core/screen.c b/src/core/screen.c
index 048104150..dc6d39a76 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -56,15 +56,13 @@
#include <stdio.h>
#include <stdlib.h>
+#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#include "x11/xprops.h"
#include "backends/x11/meta-backend-x11.h"
#include "backends/meta-cursor-sprite-xcursor.h"
-static char* get_screen_name (MetaDisplay *display,
- int number);
-
static void update_num_workspaces (MetaScreen *screen,
guint32 timestamp);
static void set_workspace_names (MetaScreen *screen);
@@ -278,14 +276,15 @@ meta_screen_init (MetaScreen *screen)
static int
set_wm_check_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
unsigned long data[1];
g_return_val_if_fail (screen->display->leader_window != None, 0);
data[0] = screen->display->leader_window;
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_SUPPORTING_WM_CHECK,
+ XChangeProperty (x11_display->xdisplay, x11_display->xroot,
+ x11_display->atom__NET_SUPPORTING_WM_CHECK,
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
@@ -295,27 +294,32 @@ set_wm_check_hint (MetaScreen *screen)
static void
unset_wm_check_hint (MetaScreen *screen)
{
- XDeleteProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_SUPPORTING_WM_CHECK);
+ MetaX11Display *x11_display = screen->display->x11_display;
+
+ XDeleteProperty (x11_display->xdisplay, x11_display->xroot,
+ x11_display->atom__NET_SUPPORTING_WM_CHECK);
}
static int
set_supported_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
+
Atom atoms[] = {
#define EWMH_ATOMS_ONLY
-#define item(x) screen->display->atom_##x,
+#define item(x) x11_display->atom_##x,
#include <x11/atomnames.h>
#undef item
#undef EWMH_ATOMS_ONLY
- screen->display->atom__GTK_FRAME_EXTENTS,
- screen->display->atom__GTK_SHOW_WINDOW_MENU,
- screen->display->atom__GTK_EDGE_CONSTRAINTS,
+ x11_display->atom__GTK_FRAME_EXTENTS,
+ x11_display->atom__GTK_SHOW_WINDOW_MENU,
+ x11_display->atom__GTK_EDGE_CONSTRAINTS,
};
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_SUPPORTED,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_SUPPORTED,
XA_ATOM,
32, PropModeReplace,
(guchar*) atoms, G_N_ELEMENTS(atoms));
@@ -326,6 +330,8 @@ set_supported_hint (MetaScreen *screen)
static int
set_wm_icon_size_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
+
#define N_VALS 6
gulong vals[N_VALS];
@@ -344,8 +350,9 @@ set_wm_icon_size_hint (MetaScreen *screen)
vals[5] = 0;
#undef LEGACY_ICON_SIZE
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom_WM_ICON_SIZE,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom_WM_ICON_SIZE,
XA_CARDINAL,
32, PropModeReplace, (guchar*) vals, N_VALS);
@@ -393,10 +400,11 @@ meta_screen_ensure_xinerama_indices (MetaScreen *screen)
screen->has_xinerama_indices = TRUE;
- if (!XineramaIsActive (screen->display->xdisplay))
+ if (!XineramaIsActive (screen->display->x11_display->xdisplay))
return;
- infos = XineramaQueryScreens (screen->display->xdisplay, &n_infos);
+ infos = XineramaQueryScreens (screen->display->x11_display->xdisplay,
+ &n_infos);
if (n_infos <= 0 || infos == NULL)
{
meta_XFree (infos);
@@ -498,6 +506,7 @@ static Window
create_guard_window (Display *xdisplay, MetaScreen *screen)
{
XSetWindowAttributes attributes;
+ MetaX11Display *x11_display = screen->display->x11_display;
Window guard_window;
gulong create_serial;
@@ -509,7 +518,7 @@ create_guard_window (Display *xdisplay, MetaScreen *screen)
create_serial = XNextRequest(xdisplay);
guard_window =
XCreateWindow (xdisplay,
- screen->xroot,
+ x11_display->xroot,
0, /* x */
0, /* y */
screen->rect.width,
@@ -562,10 +571,10 @@ take_manager_selection (MetaDisplay *display,
int timestamp,
gboolean should_replace)
{
- Display *xdisplay = display->xdisplay;
+ MetaX11Display *x11_display = display->x11_display;
Window current_owner, new_owner;
- current_owner = XGetSelectionOwner (xdisplay, manager_atom);
+ current_owner = XGetSelectionOwner (x11_display->xdisplay, manager_atom);
if (current_owner != None)
{
XSetWindowAttributes attrs;
@@ -575,14 +584,14 @@ take_manager_selection (MetaDisplay *display,
/* We want to find out when the current selection owner dies */
meta_error_trap_push (display);
attrs.event_mask = StructureNotifyMask;
- XChangeWindowAttributes (xdisplay, current_owner, CWEventMask, &attrs);
+ XChangeWindowAttributes (x11_display->xdisplay, current_owner, CWEventMask, &attrs);
if (meta_error_trap_pop_with_return (display) != Success)
current_owner = None; /* don't wait for it to die later on */
}
else
{
meta_warning (_("Display “%s” already has a window manager; try using the --replace option to
replace the current window manager."),
- display->name);
+ x11_display->name);
return None;
}
}
@@ -590,13 +599,13 @@ take_manager_selection (MetaDisplay *display,
/* We need SelectionClear and SelectionRequest events on the new owner,
* but those cannot be masked, so we only need NoEventMask.
*/
- new_owner = meta_create_offscreen_window (xdisplay, xroot, NoEventMask);
+ new_owner = meta_x11_display_create_offscreen_window (x11_display, xroot, NoEventMask);
- XSetSelectionOwner (xdisplay, manager_atom, new_owner, timestamp);
+ XSetSelectionOwner (x11_display->xdisplay, manager_atom, new_owner, timestamp);
- if (XGetSelectionOwner (xdisplay, manager_atom) != new_owner)
+ if (XGetSelectionOwner (x11_display->xdisplay, manager_atom) != new_owner)
{
- meta_warning ("Could not acquire selection: %s", XGetAtomName (xdisplay, manager_atom));
+ meta_warning ("Could not acquire selection: %s", XGetAtomName (x11_display->xdisplay, manager_atom));
return None;
}
@@ -606,12 +615,12 @@ take_manager_selection (MetaDisplay *display,
ev.type = ClientMessage;
ev.window = xroot;
- ev.message_type = display->atom_MANAGER;
+ ev.message_type = x11_display->atom_MANAGER;
ev.format = 32;
ev.data.l[0] = timestamp;
ev.data.l[1] = manager_atom;
- XSendEvent (xdisplay, xroot, False, StructureNotifyMask, (XEvent *) &ev);
+ XSendEvent (x11_display->xdisplay, xroot, False, StructureNotifyMask, (XEvent *) &ev);
}
/* Wait for old window manager to go away */
@@ -623,7 +632,7 @@ take_manager_selection (MetaDisplay *display,
meta_verbose ("Waiting for old window manager to exit\n");
do
- XWindowEvent (xdisplay, current_owner, StructureNotifyMask, &event);
+ XWindowEvent (x11_display->xdisplay, current_owner, StructureNotifyMask, &event);
while (event.type != DestroyNotify);
}
@@ -636,9 +645,8 @@ meta_screen_new (MetaDisplay *display,
{
MetaScreen *screen;
int number;
- Screen *xscreen;
- Window xroot;
- Display *xdisplay;
+ Window xroot = meta_x11_display_get_xroot (display->x11_display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window new_wm_sn_owner;
gboolean replace_current_wm;
Atom wm_sn_atom;
@@ -649,27 +657,8 @@ meta_screen_new (MetaDisplay *display,
number = meta_ui_get_screen_number ();
- /* Only display->name, display->xdisplay, and display->error_traps
- * can really be used in this function, since normally screens are
- * created from the MetaDisplay constructor
- */
-
- xdisplay = display->xdisplay;
-
meta_verbose ("Trying screen %d on display '%s'\n",
- number, display->name);
-
- xroot = RootWindow (xdisplay, number);
-
- /* FVWM checks for None here, I don't know if this
- * ever actually happens
- */
- if (xroot == None)
- {
- meta_warning (_("Screen %d on display “%s” is invalid\n"),
- number, display->name);
- return NULL;
- }
+ number, display->x11_display->name);
sprintf (buf, "WM_S%d", number);
@@ -708,8 +697,6 @@ meta_screen_new (MetaDisplay *display,
screen->closing = 0;
screen->display = display;
- screen->screen_name = get_screen_name (display, number);
- screen->xroot = xroot;
screen->rect.x = screen->rect.y = 0;
manager = meta_monitor_manager_get ();
@@ -721,10 +708,8 @@ meta_screen_new (MetaDisplay *display,
meta_monitor_manager_get_screen_size (manager,
&screen->rect.width,
&screen->rect.height);
- xscreen = ScreenOfDisplay (xdisplay, number);
+
screen->current_cursor = -1; /* invalid/unset */
- screen->default_xvisual = DefaultVisualOfScreen (xscreen);
- screen->default_depth = DefaultDepthOfScreen (xscreen);
screen->wm_sn_selection_window = new_wm_sn_owner;
screen->wm_sn_atom = wm_sn_atom;
@@ -755,10 +740,10 @@ meta_screen_new (MetaDisplay *display,
/* Handle creating a no_focus_window for this screen */
screen->no_focus_window =
- meta_create_offscreen_window (display->xdisplay,
- screen->xroot,
- FocusChangeMask|KeyPressMask|KeyReleaseMask);
- XMapWindow (display->xdisplay, screen->no_focus_window);
+ meta_x11_display_create_offscreen_window (display->x11_display,
+ xroot,
+ FocusChangeMask|KeyPressMask|KeyReleaseMask);
+ XMapWindow (xdisplay, screen->no_focus_window);
/* Done with no_focus_window stuff */
set_wm_icon_size_hint (screen);
@@ -781,7 +766,7 @@ meta_screen_new (MetaDisplay *display,
screen->keys_grabbed = FALSE;
meta_screen_grab_keys (screen);
- screen->ui = meta_ui_new (screen->display->xdisplay);
+ screen->ui = meta_ui_new (xdisplay);
screen->tile_preview_timeout_id = 0;
@@ -791,7 +776,8 @@ meta_screen_new (MetaDisplay *display,
meta_prefs_add_listener (prefs_changed_callback, screen);
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
- number, screen->screen_name, screen->xroot);
+ number, display->x11_display->screen_name,
+ xroot);
return screen;
}
@@ -799,6 +785,7 @@ meta_screen_new (MetaDisplay *display,
void
meta_screen_init_workspaces (MetaScreen *screen)
{
+ MetaDisplay *display = screen->display;
MetaWorkspace *current_workspace;
uint32_t current_workspace_index = 0;
guint32 timestamp;
@@ -808,9 +795,9 @@ meta_screen_init_workspaces (MetaScreen *screen)
timestamp = screen->wm_sn_timestamp;
/* Get current workspace */
- if (meta_prop_get_cardinal (screen->display,
- screen->xroot,
- screen->display->atom__NET_CURRENT_DESKTOP,
+ if (meta_prop_get_cardinal (display,
+ display->x11_display->xroot,
+ display->x11_display->atom__NET_CURRENT_DESKTOP,
¤t_workspace_index))
meta_verbose ("Read existing _NET_CURRENT_DESKTOP = %d\n",
(int) current_workspace_index);
@@ -835,9 +822,8 @@ void
meta_screen_free (MetaScreen *screen,
guint32 timestamp)
{
- MetaDisplay *display;
-
- display = screen->display;
+ MetaDisplay *display = screen->display;
+ MetaX11Display *x11_display = display->x11_display;
screen->closing += 1;
@@ -854,15 +840,9 @@ meta_screen_free (MetaScreen *screen,
meta_stack_free (screen->stack);
meta_stack_tracker_free (screen->stack_tracker);
- meta_error_trap_push (screen->display);
- XSelectInput (screen->display->xdisplay, screen->xroot, 0);
- if (meta_error_trap_pop_with_return (screen->display) != Success)
- meta_warning ("Could not release screen %d on display \"%s\"\n",
- meta_ui_get_screen_number (), screen->display->name);
-
unset_wm_check_hint (screen);
- XDestroyWindow (screen->display->xdisplay,
+ XDestroyWindow (x11_display->xdisplay,
screen->wm_sn_selection_window);
if (screen->work_area_later != 0)
@@ -873,16 +853,16 @@ meta_screen_free (MetaScreen *screen,
if (screen->tile_preview_timeout_id)
g_source_remove (screen->tile_preview_timeout_id);
- g_free (screen->screen_name);
-
g_object_unref (screen);
}
void
meta_screen_create_guard_window (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
+
if (screen->guard_window == None)
- screen->guard_window = create_guard_window (screen->display->xdisplay, screen);
+ screen->guard_window = create_guard_window (x11_display->xdisplay, screen);
}
void
@@ -932,37 +912,6 @@ prefs_changed_callback (MetaPreference pref,
}
}
-
-static char*
-get_screen_name (MetaDisplay *display,
- int number)
-{
- char *p;
- char *dname;
- char *scr;
-
- /* DisplayString gives us a sort of canonical display,
- * vs. the user-entered name from XDisplayName()
- */
- dname = g_strdup (DisplayString (display->xdisplay));
-
- /* Change display name to specify this screen.
- */
- p = strrchr (dname, ':');
- if (p)
- {
- p = strchr (p, '.');
- if (p)
- *p = '\0';
- }
-
- scr = g_strdup_printf ("%s.%d", dname, number);
-
- g_free (dname);
-
- return scr;
-}
-
void
meta_screen_foreach_window (MetaScreen *screen,
MetaListWindowsFlags flags,
@@ -1011,6 +960,7 @@ static void
set_number_of_spaces_hint (MetaScreen *screen,
int n_spaces)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
unsigned long data[1];
if (screen->closing > 0)
@@ -1021,8 +971,9 @@ set_number_of_spaces_hint (MetaScreen *screen,
meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %lu\n", data[0]);
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_NUMBER_OF_DESKTOPS,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_NUMBER_OF_DESKTOPS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
@@ -1031,6 +982,7 @@ set_number_of_spaces_hint (MetaScreen *screen,
static void
set_desktop_geometry_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
unsigned long data[2];
if (screen->closing > 0)
@@ -1042,8 +994,9 @@ set_desktop_geometry_hint (MetaScreen *screen)
meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu\n", data[0], data[1]);
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_DESKTOP_GEOMETRY,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_DESKTOP_GEOMETRY,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 2);
meta_error_trap_pop (screen->display);
@@ -1052,6 +1005,7 @@ set_desktop_geometry_hint (MetaScreen *screen)
static void
set_desktop_viewport_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
unsigned long data[2];
if (screen->closing > 0)
@@ -1066,8 +1020,9 @@ set_desktop_viewport_hint (MetaScreen *screen)
meta_verbose ("Setting _NET_DESKTOP_VIEWPORT to 0, 0\n");
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_DESKTOP_VIEWPORT,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_DESKTOP_VIEWPORT,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 2);
meta_error_trap_pop (screen->display);
@@ -1186,6 +1141,7 @@ static void
update_num_workspaces (MetaScreen *screen,
guint32 timestamp)
{
+ MetaDisplay *display = screen->display;
int new_num, old_num;
GList *l;
int i;
@@ -1201,8 +1157,9 @@ update_num_workspaces (MetaScreen *screen,
n_items = 0;
list = NULL;
- if (meta_prop_get_cardinal_list (screen->display, screen->xroot,
- screen->display->atom__NET_NUMBER_OF_DESKTOPS,
+ if (meta_prop_get_cardinal_list (display,
+ display->x11_display->xroot,
+ display->x11_display->atom__NET_NUMBER_OF_DESKTOPS,
&list, &n_items))
{
new_num = list[0];
@@ -1377,6 +1334,7 @@ void
meta_screen_update_cursor (MetaScreen *screen)
{
MetaDisplay *display = screen->display;
+ MetaX11Display *x11_display = display->x11_display;
MetaCursor cursor = screen->current_cursor;
Cursor xcursor;
MetaCursorSpriteXcursor *sprite_xcursor;
@@ -1393,11 +1351,11 @@ meta_screen_update_cursor (MetaScreen *screen)
g_object_unref (sprite_xcursor);
/* Set a cursor for X11 applications that don't specify their own */
- xcursor = meta_display_create_x_cursor (display, cursor);
+ xcursor = meta_x11_display_create_x_cursor (x11_display, cursor);
- XDefineCursor (display->xdisplay, screen->xroot, xcursor);
- XFlush (display->xdisplay);
- XFreeCursor (display->xdisplay, xcursor);
+ XDefineCursor (x11_display->xdisplay, x11_display->xroot, xcursor);
+ XFlush (x11_display->xdisplay);
+ XFreeCursor (x11_display->xdisplay, xcursor);
}
void
@@ -1669,6 +1627,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
{
uint32_t *list;
int n_items;
+ MetaDisplay *display = screen->display;
if (screen->workspace_layout_overridden)
return;
@@ -1676,9 +1635,9 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
list = NULL;
n_items = 0;
- if (meta_prop_get_cardinal_list (screen->display,
- screen->xroot,
- screen->display->atom__NET_DESKTOP_LAYOUT,
+ if (meta_prop_get_cardinal_list (display,
+ display->x11_display->xroot,
+ display->x11_display->atom__NET_DESKTOP_LAYOUT,
&list, &n_items))
{
if (n_items == 3 || n_items == 4)
@@ -1802,6 +1761,7 @@ set_workspace_names (MetaScreen *screen)
* note we only get prefs change notify if things have
* really changed.
*/
+ MetaX11Display *x11_display = screen->display->x11_display;
GString *flattened;
int i;
int n_spaces;
@@ -1826,10 +1786,10 @@ set_workspace_names (MetaScreen *screen)
}
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay,
- screen->xroot,
- screen->display->atom__NET_DESKTOP_NAMES,
- screen->display->atom_UTF8_STRING,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_DESKTOP_NAMES,
+ x11_display->atom_UTF8_STRING,
8, PropModeReplace,
(unsigned char *)flattened->str, flattened->len);
meta_error_trap_pop (screen->display);
@@ -1840,6 +1800,7 @@ set_workspace_names (MetaScreen *screen)
void
meta_screen_update_workspace_names (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
char **names;
int n_names;
int i;
@@ -1851,8 +1812,8 @@ meta_screen_update_workspace_names (MetaScreen *screen)
names = NULL;
n_names = 0;
if (!meta_prop_get_utf8_list (screen->display,
- screen->xroot,
- screen->display->atom__NET_DESKTOP_NAMES,
+ x11_display->xroot,
+ x11_display->atom__NET_DESKTOP_NAMES,
&names, &n_names))
{
meta_verbose ("Failed to get workspace names from root window\n");
@@ -1873,34 +1834,10 @@ meta_screen_update_workspace_names (MetaScreen *screen)
g_strfreev (names);
}
-Window
-meta_create_offscreen_window (Display *xdisplay,
- Window parent,
- long valuemask)
-{
- XSetWindowAttributes attrs;
-
- /* we want to be override redirect because sometimes we
- * create a window on a screen we aren't managing.
- * (but on a display we are managing at least one screen for)
- */
- attrs.override_redirect = True;
- attrs.event_mask = valuemask;
-
- return XCreateWindow (xdisplay,
- parent,
- -100, -100, 1, 1,
- 0,
- CopyFromParent,
- CopyFromParent,
- (Visual *)CopyFromParent,
- CWOverrideRedirect | CWEventMask,
- &attrs);
-}
-
static void
set_work_area_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
int num_workspaces;
GList *l;
unsigned long *data, *tmp;
@@ -1924,8 +1861,9 @@ set_work_area_hint (MetaScreen *screen)
}
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_WORKAREA,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_WORKAREA,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, num_workspaces*4);
g_free (data);
@@ -2293,7 +2231,7 @@ on_monitors_changed_internal (MetaMonitorManager *manager,
changes.width = screen->rect.width;
changes.height = screen->rect.height;
- XConfigureWindow(screen->display->xdisplay,
+ XConfigureWindow(screen->display->x11_display->xdisplay,
screen->guard_window,
CWX | CWY | CWWidth | CWHeight,
&changes);
@@ -2319,13 +2257,15 @@ on_monitors_changed (MetaMonitorManager *manager,
void
meta_screen_update_showing_desktop_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
unsigned long data[1];
data[0] = screen->active_workspace->showing_desktop ? 1 : 0;
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_SHOWING_DESKTOP,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_SHOWING_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
@@ -2557,12 +2497,6 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
return FALSE;
}
-int
-meta_screen_get_screen_number (MetaScreen *screen)
-{
- return meta_ui_get_screen_number ();
-}
-
/**
* meta_screen_get_display:
* @screen: A #MetaScreen
@@ -2577,17 +2511,6 @@ meta_screen_get_display (MetaScreen *screen)
return screen->display;
}
-/**
- * meta_screen_get_xroot: (skip)
- * @screen: A #MetaScreen
- *
- */
-Window
-meta_screen_get_xroot (MetaScreen *screen)
-{
- return screen->xroot;
-}
-
/**
* meta_screen_get_size:
* @screen: A #MetaScreen
@@ -2611,6 +2534,7 @@ meta_screen_get_size (MetaScreen *screen,
void
meta_screen_set_cm_selection (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
char selection[32];
Atom a;
guint32 timestamp;
@@ -2618,8 +2542,8 @@ meta_screen_set_cm_selection (MetaScreen *screen)
timestamp = meta_display_get_current_time_roundtrip (screen->display);
g_snprintf (selection, sizeof (selection), "_NET_WM_CM_S%d",
meta_ui_get_screen_number ());
- a = XInternAtom (screen->display->xdisplay, selection, False);
- screen->wm_cm_selection_window = take_manager_selection (screen->display, screen->xroot, a, timestamp,
TRUE);
+ a = XInternAtom (x11_display->xdisplay, selection, False);
+ screen->wm_cm_selection_window = take_manager_selection (screen->display, x11_display->xroot, a,
timestamp, TRUE);
}
/**
@@ -2685,6 +2609,8 @@ meta_screen_workspace_switched (MetaScreen *screen,
void
meta_screen_set_active_workspace_hint (MetaScreen *screen)
{
+ MetaX11Display *x11_display = screen->display->x11_display;
+
unsigned long data[1];
/* this is because we destroy the spaces in order,
@@ -2701,8 +2627,9 @@ meta_screen_set_active_workspace_hint (MetaScreen *screen)
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
meta_error_trap_push (screen->display);
- XChangeProperty (screen->display->xdisplay, screen->xroot,
- screen->display->atom__NET_CURRENT_DESKTOP,
+ XChangeProperty (x11_display->xdisplay,
+ x11_display->xroot,
+ x11_display->atom__NET_CURRENT_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index 82afd644a..5b5d79545 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -44,6 +44,8 @@
#include <meta/compositor.h>
+#include "x11/meta-x11-display-private.h"
+
/* The complexity here comes from resolving two competing factors:
*
* - We need to have a view of the stacking order that takes into
@@ -482,10 +484,10 @@ query_xserver_stack (MetaStackTracker *tracker)
guint n_children;
guint i;
- tracker->xserver_serial = XNextRequest (screen->display->xdisplay);
+ tracker->xserver_serial = XNextRequest (screen->display->x11_display->xdisplay);
- XQueryTree (screen->display->xdisplay,
- screen->xroot,
+ XQueryTree (screen->display->x11_display->xdisplay,
+ screen->display->x11_display->xroot,
&ignored1, &ignored2, &children, &n_children);
tracker->verified_stack = g_array_sized_new (FALSE, FALSE, sizeof (guint64), n_children);
@@ -977,6 +979,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
guint64 sibling)
{
gulong serial = 0;
+ MetaX11Display *x11_display = tracker->screen->display->x11_display;
if (META_STACK_ID_IS_X11 (window))
{
@@ -985,13 +988,13 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
if (changes.sibling != find_x11_sibling_upwards (tracker, window))
{
- serial = XNextRequest (tracker->screen->display->xdisplay);
+ serial = XNextRequest (x11_display->xdisplay);
meta_error_trap_push (tracker->screen->display);
changes.stack_mode = changes.sibling ? Below : Above;
- XConfigureWindow (tracker->screen->display->xdisplay,
+ XConfigureWindow (x11_display->xdisplay,
window,
(changes.sibling ? CWSibling : 0) | CWStackMode,
&changes);
@@ -1011,6 +1014,7 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
guint64 sibling)
{
gulong serial = 0;
+ MetaX11Display *x11_display = tracker->screen->display->x11_display;
if (META_STACK_ID_IS_X11 (window))
{
@@ -1019,13 +1023,13 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
if (changes.sibling != find_x11_sibling_downwards (tracker, window))
{
- serial = XNextRequest (tracker->screen->display->xdisplay);
+ serial = XNextRequest (x11_display->xdisplay);
meta_error_trap_push (tracker->screen->display);
changes.stack_mode = changes.sibling ? Above : Below;
- XConfigureWindow (tracker->screen->display->xdisplay,
+ XConfigureWindow (x11_display->xdisplay,
(Window)window,
(changes.sibling ? CWSibling : 0) | CWStackMode,
&changes);
diff --git a/src/core/stack.c b/src/core/stack.c
index fc51aa165..217ba44ae 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -37,6 +37,7 @@
#include <X11/Xatom.h>
+#include "x11/meta-x11-display-private.h"
#include "x11/group-private.h"
#define WINDOW_HAS_TRANSIENT_TYPE(w) \
@@ -1068,16 +1069,16 @@ stack_sync_to_xserver (MetaStack *stack)
/* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */
- XChangeProperty (stack->screen->display->xdisplay,
- stack->screen->xroot,
- stack->screen->display->atom__NET_CLIENT_LIST,
+ XChangeProperty (stack->screen->display->x11_display->xdisplay,
+ stack->screen->display->x11_display->xroot,
+ stack->screen->display->x11_display->atom__NET_CLIENT_LIST,
XA_WINDOW,
32, PropModeReplace,
(unsigned char *)stack->xwindows->data,
stack->xwindows->len);
- XChangeProperty (stack->screen->display->xdisplay,
- stack->screen->xroot,
- stack->screen->display->atom__NET_CLIENT_LIST_STACKING,
+ XChangeProperty (stack->screen->display->x11_display->xdisplay,
+ stack->screen->display->x11_display->xroot,
+ stack->screen->display->x11_display->atom__NET_CLIENT_LIST_STACKING,
XA_WINDOW,
32, PropModeReplace,
(unsigned char *)x11_stacked->data,
diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c
index 30dfccc76..c3e887598 100644
--- a/src/core/startup-notification.c
+++ b/src/core/startup-notification.c
@@ -28,6 +28,7 @@
#include <meta/errors.h>
#include "display-private.h"
+#include "x11/meta-x11-display-private.h"
#include "screen-private.h"
#include "startup-notification-private.h"
@@ -670,7 +671,7 @@ meta_startup_notification_constructed (GObject *object)
g_assert (sn->display != NULL);
#ifdef HAVE_STARTUP_NOTIFICATION
- sn->sn_display = sn_display_new (sn->display->xdisplay,
+ sn->sn_display = sn_display_new (sn->display->x11_display->xdisplay,
sn_error_trap_push,
sn_error_trap_pop);
sn->sn_context =
diff --git a/src/core/window.c b/src/core/window.c
index 5761f5d48..8b0046506 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -52,6 +52,7 @@
#include <meta/meta-cursor-tracker.h>
#include "meta/compositor-mutter.h"
+#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#include "x11/window-props.h"
#include "x11/xprops.h"
@@ -763,11 +764,11 @@ sync_client_window_mapped (MetaWindow *window)
meta_error_trap_push (window->display);
if (should_be_mapped)
{
- XMapWindow (window->display->xdisplay, window->xwindow);
+ XMapWindow (window->display->x11_display->xdisplay, window->xwindow);
}
else
{
- XUnmapWindow (window->display->xdisplay, window->xwindow);
+ XUnmapWindow (window->display->x11_display->xdisplay, window->xwindow);
window->unmaps_pending ++;
}
meta_error_trap_pop (window->display);
@@ -8050,7 +8051,6 @@ static gboolean
window_has_pointer_x11 (MetaWindow *window)
{
MetaDisplay *display = window->display;
- MetaScreen *screen = window->screen;
Window root, child;
double root_x, root_y, x, y;
XIButtonState buttons;
@@ -8058,9 +8058,9 @@ window_has_pointer_x11 (MetaWindow *window)
XIGroupState group;
meta_error_trap_push (display);
- XIQueryPointer (display->xdisplay,
+ XIQueryPointer (display->x11_display->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
- screen->xroot,
+ display->x11_display->xroot,
&root, &child,
&root_x, &root_y, &x, &y,
&buttons, &mods, &group);
diff --git a/src/meta/display.h b/src/meta/display.h
index 26e8df767..150ec958c 100644
--- a/src/meta/display.h
+++ b/src/meta/display.h
@@ -75,7 +75,6 @@ GType meta_display_get_type (void) G_GNUC_CONST;
int meta_display_get_xinput_opcode (MetaDisplay *display);
gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
-Display *meta_display_get_xdisplay (MetaDisplay *display);
MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
MetaX11Display *meta_display_get_x11_display (MetaDisplay *display);
diff --git a/src/meta/meta-x11-display.h b/src/meta/meta-x11-display.h
index 2ecd694c1..ca150833d 100644
--- a/src/meta/meta-x11-display.h
+++ b/src/meta/meta-x11-display.h
@@ -30,4 +30,8 @@
#define META_TYPE_X11_DISPLAY (meta_x11_display_get_type ())
G_DECLARE_FINAL_TYPE (MetaX11Display, meta_x11_display, META, X11_DISPLAY, GObject)
+int meta_x11_display_get_screen_number (MetaX11Display *x11_display);
+Display *meta_x11_display_get_xdisplay (MetaX11Display *x11_display);
+Window meta_x11_display_get_xroot (MetaX11Display *x11_display);
+
#endif /* META_X11_DISPLAY_H */
diff --git a/src/meta/screen.h b/src/meta/screen.h
index 13c92516e..42ff69700 100644
--- a/src/meta/screen.h
+++ b/src/meta/screen.h
@@ -36,10 +36,8 @@ typedef struct _MetaScreenClass MetaScreenClass;
GType meta_screen_get_type (void);
-int meta_screen_get_screen_number (MetaScreen *screen);
MetaDisplay *meta_screen_get_display (MetaScreen *screen);
-Window meta_screen_get_xroot (MetaScreen *screen);
void meta_screen_get_size (MetaScreen *screen,
int *width,
int *height);
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index 8867945c1..2fef451a3 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -30,6 +30,7 @@
#include "wayland/meta-wayland.h"
#include "window-private.h"
#include "tests/test-utils.h"
+#include "x11/meta-x11-display-private.h"
typedef struct {
GHashTable *clients;
@@ -301,8 +302,8 @@ test_case_check_xserver_stacking (TestCase *test,
Window parent;
Window *children;
unsigned int n_children;
- XQueryTree (display->xdisplay,
- meta_screen_get_xroot (display->screen),
+ XQueryTree (display->x11_display->xdisplay,
+ display->x11_display->xroot,
&root, &parent, &children, &n_children);
for (i = 0; i < (int)n_children; i++)
diff --git a/src/tests/test-utils.c b/src/tests/test-utils.c
index 18b6da356..9faf2a9b8 100644
--- a/src/tests/test-utils.c
+++ b/src/tests/test-utils.c
@@ -27,6 +27,7 @@
#include "core/display-private.h"
#include "core/window-private.h"
#include "wayland/meta-wayland.h"
+#include "x11/meta-x11-display-private.h"
struct _TestClient {
char *id;
@@ -78,7 +79,8 @@ async_waiter_new (void)
{
AsyncWaiter *waiter = g_new0 (AsyncWaiter, 1);
- Display *xdisplay = meta_get_display ()->xdisplay;
+ MetaDisplay *display = meta_get_display ();
+ Display *xdisplay = display->x11_display->xdisplay;
XSyncValue value;
XSyncAlarmAttributes attr;
@@ -118,7 +120,8 @@ async_waiter_new (void)
void
async_waiter_destroy (AsyncWaiter *waiter)
{
- Display *xdisplay = meta_get_display ()->xdisplay;
+ MetaDisplay *display = meta_get_display ();
+ Display *xdisplay = display->x11_display->xdisplay;
XSyncDestroyAlarm (xdisplay, waiter->alarm);
XSyncDestroyCounter (xdisplay, waiter->counter);
@@ -146,7 +149,8 @@ async_waiter_wait (AsyncWaiter *waiter,
void
async_waiter_set_and_wait (AsyncWaiter *waiter)
{
- Display *xdisplay = meta_get_display ()->xdisplay;
+ MetaDisplay *display = meta_get_display ();
+ Display *xdisplay = display->x11_display->xdisplay;
int wait_value = async_waiter_next_value (waiter);
XSyncValue sync_value;
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index f629a1302..be09898cc 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -39,6 +39,7 @@
#include "meta-xwayland-private.h"
#include "meta-xwayland-selection-private.h"
#include "meta-wayland-data-device.h"
+#include "x11/meta-x11-display-private.h"
#define INCR_CHUNK_SIZE (128 * 1024)
#define XDND_VERSION 5
@@ -562,7 +563,7 @@ wayland_selection_data_new (XSelectionRequestEvent *request_event,
MetaWaylandCompositor *compositor)
{
MetaDisplay *display = meta_get_display ();
- MetaScreen *screen = display->screen;
+ MetaX11Display *x11_display = display->x11_display;
MetaWaylandDataDevice *data_device;
MetaWaylandDataSource *wayland_source;
MetaSelectionBridge *selection;
@@ -609,11 +610,11 @@ wayland_selection_data_new (XSelectionRequestEvent *request_event,
data->cancellable = g_cancellable_new ();
data->stream = g_unix_input_stream_new (p[0], TRUE);
- data->window = meta_display_lookup_x_window (meta_get_display (),
+ data->window = meta_display_lookup_x_window (display,
data->request_event.requestor);
/* Do *not* change the event mask on the root window, bugger! */
- if (!data->window && data->request_event.requestor != screen->xroot)
+ if (!data->window && data->request_event.requestor != x11_display->xroot)
{
/* Not a managed window, set the PropertyChangeMask
* for INCR deletion notifications.
@@ -648,10 +649,10 @@ static void
wayland_selection_data_free (WaylandSelectionData *data)
{
MetaDisplay *display = meta_get_display ();
- MetaScreen *screen = display->screen;
+ MetaX11Display *x11_display = display->x11_display;
/* Do *not* change the event mask on the root window, bugger! */
- if (!data->window && data->request_event.requestor != screen->xroot)
+ if (!data->window && data->request_event.requestor != x11_display->xroot)
{
meta_error_trap_push (display);
XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
diff --git a/src/x11/events.c b/src/x11/events.c
index f60f650a6..6789409ba 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -34,6 +34,7 @@
#include "window-private.h"
#include "workspace-private.h"
#include "backends/x11/meta-backend-x11.h"
+#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#include "x11/xprops.h"
@@ -535,7 +536,7 @@ meta_spew_core_event (MetaDisplay *display,
name = "PropertyNotify";
meta_error_trap_push (display);
- str = XGetAtomName (display->xdisplay,
+ str = XGetAtomName (display->x11_display->xdisplay,
event->xproperty.atom);
meta_error_trap_pop (display);
@@ -569,7 +570,7 @@ meta_spew_core_event (MetaDisplay *display,
char *str;
name = "ClientMessage";
meta_error_trap_push (display);
- str = XGetAtomName (display->xdisplay,
+ str = XGetAtomName (display->x11_display->xdisplay,
event->xclient.message_type);
meta_error_trap_pop (display);
extra = g_strdup_printf ("type: %s format: %d\n",
@@ -634,7 +635,6 @@ static char *
meta_spew_event (MetaDisplay *display,
XEvent *event)
{
- MetaScreen *screen = display->screen;
const char *name = NULL;
char *extra = NULL;
char *winname;
@@ -648,7 +648,7 @@ meta_spew_event (MetaDisplay *display,
else
meta_spew_core_event (display, event, &name, &extra);
- if (event->xany.window == screen->xroot)
+ if (event->xany.window == display->x11_display->xroot)
winname = g_strdup_printf ("root");
else
winname = g_strdup_printf ("0x%lx", event->xany.window);
@@ -681,7 +681,8 @@ meta_spew_event_print (MetaDisplay *display,
if (event->type == (display->xsync_event_base + XSyncAlarmNotify))
return;
- if (event->type == PropertyNotify && event->xproperty.atom == display->atom__NET_WM_USER_TIME)
+ if (event->type == PropertyNotify &&
+ event->xproperty.atom == display->x11_display->atom__NET_WM_USER_TIME)
return;
event_str = meta_spew_event (display, event);
@@ -713,7 +714,7 @@ handle_window_focus_event (MetaDisplay *display,
}
else if (meta_display_xwindow_is_a_no_focus_window (display, event->event))
window_type = "no_focus_window";
- else if (event->event == display->screen->xroot)
+ else if (event->event == display->x11_display->xroot)
window_type = "root window";
else
window_type = "unknown window";
@@ -949,7 +950,7 @@ process_request_frame_extents (MetaDisplay *display,
/* See if the window is decorated. */
hints_set = meta_prop_get_motif_hints (display,
xwindow,
- display->atom__MOTIF_WM_HINTS,
+ display->x11_display->atom__MOTIF_WM_HINTS,
&hints);
if ((hints_set && hints->decorations) || !hints_set)
{
@@ -972,8 +973,8 @@ process_request_frame_extents (MetaDisplay *display,
xwindow, data[0], data[1], data[2], data[3]);
meta_error_trap_push (display);
- XChangeProperty (display->xdisplay, xwindow,
- display->atom__NET_FRAME_EXTENTS,
+ XChangeProperty (display->x11_display->xdisplay, xwindow,
+ display->x11_display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_error_trap_pop (display);
@@ -989,26 +990,27 @@ convert_property (MetaDisplay *display,
Atom target,
Atom property)
{
+ MetaX11Display *x11_display = display->x11_display;
#define N_TARGETS 4
Atom conversion_targets[N_TARGETS];
long icccm_version[] = { 2, 0 };
- conversion_targets[0] = display->atom_TARGETS;
- conversion_targets[1] = display->atom_MULTIPLE;
- conversion_targets[2] = display->atom_TIMESTAMP;
- conversion_targets[3] = display->atom_VERSION;
+ conversion_targets[0] = x11_display->atom_TARGETS;
+ conversion_targets[1] = x11_display->atom_MULTIPLE;
+ conversion_targets[2] = x11_display->atom_TIMESTAMP;
+ conversion_targets[3] = x11_display->atom_VERSION;
meta_error_trap_push (display);
- if (target == display->atom_TARGETS)
- XChangeProperty (display->xdisplay, w, property,
+ if (target == x11_display->atom_TARGETS)
+ XChangeProperty (x11_display->xdisplay, w, property,
XA_ATOM, 32, PropModeReplace,
(unsigned char *)conversion_targets, N_TARGETS);
- else if (target == display->atom_TIMESTAMP)
- XChangeProperty (display->xdisplay, w, property,
+ else if (target == x11_display->atom_TIMESTAMP)
+ XChangeProperty (x11_display->xdisplay, w, property,
XA_INTEGER, 32, PropModeReplace,
(unsigned char *)&screen->wm_sn_timestamp, 1);
- else if (target == display->atom_VERSION)
- XChangeProperty (display->xdisplay, w, property,
+ else if (target == x11_display->atom_VERSION)
+ XChangeProperty (x11_display->xdisplay, w, property,
XA_INTEGER, 32, PropModeReplace,
(unsigned char *)icccm_version, 2);
else
@@ -1025,7 +1027,7 @@ convert_property (MetaDisplay *display,
*/
/* FIXME the error trap pop synced anyway, right? */
meta_topic (META_DEBUG_SYNC, "Syncing on %s\n", G_STRFUNC);
- XSync (display->xdisplay, False);
+ XSync (x11_display->xdisplay, False);
return TRUE;
}
@@ -1035,6 +1037,7 @@ static void
process_selection_request (MetaDisplay *display,
XEvent *event)
{
+ MetaX11Display *x11_display = display->x11_display;
MetaScreen *screen = display->screen;
XSelectionEvent reply;
@@ -1044,7 +1047,7 @@ process_selection_request (MetaDisplay *display,
char *str;
meta_error_trap_push (display);
- str = XGetAtomName (display->xdisplay,
+ str = XGetAtomName (x11_display->xdisplay,
event->xselectionrequest.selection);
meta_error_trap_pop (display);
@@ -1057,14 +1060,14 @@ process_selection_request (MetaDisplay *display,
}
reply.type = SelectionNotify;
- reply.display = display->xdisplay;
+ reply.display = x11_display->xdisplay;
reply.requestor = event->xselectionrequest.requestor;
reply.selection = event->xselectionrequest.selection;
reply.target = event->xselectionrequest.target;
reply.property = None;
reply.time = event->xselectionrequest.time;
- if (event->xselectionrequest.target == display->atom_MULTIPLE)
+ if (event->xselectionrequest.target == x11_display->atom_MULTIPLE)
{
if (event->xselectionrequest.property != None)
{
@@ -1074,10 +1077,10 @@ process_selection_request (MetaDisplay *display,
unsigned char *data;
meta_error_trap_push (display);
- if (XGetWindowProperty (display->xdisplay,
+ if (XGetWindowProperty (x11_display->xdisplay,
event->xselectionrequest.requestor,
event->xselectionrequest.property, 0, 256, False,
- display->atom_ATOM_PAIR,
+ x11_display->atom_ATOM_PAIR,
&type, &format, &num, &rest, &data) != Success)
{
meta_error_trap_pop_with_return (display);
@@ -1102,10 +1105,10 @@ process_selection_request (MetaDisplay *display,
}
meta_error_trap_push (display);
- XChangeProperty (display->xdisplay,
+ XChangeProperty (x11_display->xdisplay,
event->xselectionrequest.requestor,
event->xselectionrequest.property,
- display->atom_ATOM_PAIR,
+ x11_display->atom_ATOM_PAIR,
32, PropModeReplace, data, num);
meta_error_trap_pop (display);
meta_XFree (data);
@@ -1124,7 +1127,7 @@ process_selection_request (MetaDisplay *display,
reply.property = event->xselectionrequest.property;
}
- XSendEvent (display->xdisplay,
+ XSendEvent (x11_display->xdisplay,
event->xselectionrequest.requestor,
False, 0L, (XEvent*)&reply);
@@ -1143,7 +1146,7 @@ process_selection_clear (MetaDisplay *display,
char *str;
meta_error_trap_push (display);
- str = XGetAtomName (display->xdisplay,
+ str = XGetAtomName (display->x11_display->xdisplay,
event->xselectionclear.selection);
meta_error_trap_pop (display);
@@ -1156,7 +1159,7 @@ process_selection_clear (MetaDisplay *display,
}
meta_verbose ("Got selection clear for on display %s\n",
- display->name);
+ display->x11_display->name);
meta_display_unmanage_screen (display, display->screen,
event->xselectionclear.time);
@@ -1179,7 +1182,7 @@ notify_bell (MetaDisplay *display,
meta_prefs_bell_is_audible ())
{
/* Force a classic bell if the libcanberra bell failed. */
- XkbForceDeviceBell (display->xdisplay,
+ XkbForceDeviceBell (display->x11_display->xdisplay,
xkb_bell_event->device,
xkb_bell_event->bell_class,
xkb_bell_event->bell_id,
@@ -1191,6 +1194,7 @@ static gboolean
handle_other_xevent (MetaDisplay *display,
XEvent *event)
{
+ MetaX11Display *x11_display = display->x11_display;
Window modified;
MetaWindow *window;
MetaWindow *property_for_window;
@@ -1277,7 +1281,7 @@ handle_other_xevent (MetaDisplay *display,
break;
case CreateNotify:
{
- if (event->xcreatewindow.parent == display->screen->xroot)
+ if (event->xcreatewindow.parent == x11_display->xroot)
meta_stack_tracker_create_event (display->screen->stack_tracker,
&event->xcreatewindow);
}
@@ -1285,7 +1289,7 @@ handle_other_xevent (MetaDisplay *display,
case DestroyNotify:
{
- if (event->xdestroywindow.event == display->screen->xroot)
+ if (event->xdestroywindow.event == x11_display->xroot)
meta_stack_tracker_destroy_event (display->screen->stack_tracker,
&event->xdestroywindow);
}
@@ -1360,7 +1364,7 @@ handle_other_xevent (MetaDisplay *display,
/* NB: override redirect windows wont cause a map request so we
* watch out for map notifies against any root windows too if a
* compositor is enabled: */
- if (window == NULL && event->xmap.event == display->screen->xroot)
+ if (window == NULL && event->xmap.event == x11_display->xroot)
{
window = meta_window_x11_new (display, event->xmap.window,
FALSE, META_COMP_EFFECT_CREATE);
@@ -1403,7 +1407,7 @@ handle_other_xevent (MetaDisplay *display,
break;
case ReparentNotify:
{
- if (event->xreparent.event == display->screen->xroot)
+ if (event->xreparent.event == x11_display->xroot)
meta_stack_tracker_reparent_event (display->screen->stack_tracker,
&event->xreparent);
}
@@ -1411,7 +1415,7 @@ handle_other_xevent (MetaDisplay *display,
case ConfigureNotify:
if (event->xconfigure.event != event->xconfigure.window)
{
- if (event->xconfigure.event == display->screen->xroot &&
+ if (event->xconfigure.event == x11_display->xroot &&
event->xconfigure.window != display->screen->composite_overlay_window)
meta_stack_tracker_configure_event (display->screen->stack_tracker,
&event->xconfigure);
@@ -1446,7 +1450,7 @@ handle_other_xevent (MetaDisplay *display,
meta_verbose ("Configuring withdrawn window to %d,%d %dx%d border %d (some values may not be in
mask)\n",
xwc.x, xwc.y, xwc.width, xwc.height, xwc.border_width);
meta_error_trap_push (display);
- XConfigureWindow (display->xdisplay, event->xconfigurerequest.window,
+ XConfigureWindow (x11_display->xdisplay, event->xconfigurerequest.window,
xwcm, &xwc);
meta_error_trap_pop (display);
}
@@ -1478,13 +1482,13 @@ handle_other_xevent (MetaDisplay *display,
if (group != NULL)
meta_group_property_notify (group, event);
- if (event->xproperty.window == display->screen->xroot)
+ if (event->xproperty.window == x11_display->xroot)
{
if (event->xproperty.atom ==
- display->atom__NET_DESKTOP_LAYOUT)
+ x11_display->atom__NET_DESKTOP_LAYOUT)
meta_screen_update_workspace_layout (display->screen);
else if (event->xproperty.atom ==
- display->atom__NET_DESKTOP_NAMES)
+ x11_display->atom__NET_DESKTOP_NAMES)
meta_screen_update_workspace_names (display->screen);
/* we just use this property as a sentinel to avoid
@@ -1492,7 +1496,7 @@ handle_other_xevent (MetaDisplay *display,
* sentinel_counter variable declaration in display.h
*/
if (event->xproperty.atom ==
- display->atom__MUTTER_SENTINEL)
+ x11_display->atom__MUTTER_SENTINEL)
{
meta_display_decrement_focus_sentinel (display);
}
@@ -1510,12 +1514,13 @@ handle_other_xevent (MetaDisplay *display,
if (window)
{
#ifdef HAVE_WAYLAND
- if (event->xclient.message_type == display->atom_WL_SURFACE_ID)
+ if (event->xclient.message_type == x11_display->atom_WL_SURFACE_ID)
{
guint32 surface_id = event->xclient.data.l[0];
meta_xwayland_handle_wl_surface_id (window, surface_id);
}
- else if (event->xclient.message_type == display->atom__XWAYLAND_MAY_GRAB_KEYBOARD)
+ else if (event->xclient.message_type ==
+ x11_display->atom__XWAYLAND_MAY_GRAB_KEYBOARD)
{
if (meta_is_wayland_compositor ())
g_object_set (G_OBJECT (window),
@@ -1529,10 +1534,10 @@ handle_other_xevent (MetaDisplay *display,
}
else
{
- if (event->xclient.window == display->screen->xroot)
+ if (event->xclient.window == x11_display->xroot)
{
if (event->xclient.message_type ==
- display->atom__NET_CURRENT_DESKTOP)
+ x11_display->atom__NET_CURRENT_DESKTOP)
{
int space;
MetaWorkspace *workspace;
@@ -1562,7 +1567,7 @@ handle_other_xevent (MetaDisplay *display,
meta_verbose ("Don't know about workspace %d\n", space);
}
else if (event->xclient.message_type ==
- display->atom__NET_NUMBER_OF_DESKTOPS)
+ x11_display->atom__NET_NUMBER_OF_DESKTOPS)
{
int num_spaces;
@@ -1574,7 +1579,7 @@ handle_other_xevent (MetaDisplay *display,
meta_prefs_set_num_workspaces (num_spaces);
}
else if (event->xclient.message_type ==
- display->atom__NET_SHOWING_DESKTOP)
+ x11_display->atom__NET_SHOWING_DESKTOP)
{
gboolean showing_desktop;
guint32 timestamp;
@@ -1594,11 +1599,11 @@ handle_other_xevent (MetaDisplay *display,
}
}
else if (event->xclient.message_type ==
- display->atom_WM_PROTOCOLS)
+ x11_display->atom_WM_PROTOCOLS)
{
meta_verbose ("Received WM_PROTOCOLS message\n");
- if ((Atom)event->xclient.data.l[0] == display->atom__NET_WM_PING)
+ if ((Atom)event->xclient.data.l[0] == x11_display->atom__NET_WM_PING)
{
guint32 timestamp = event->xclient.data.l[1];
@@ -1614,7 +1619,7 @@ handle_other_xevent (MetaDisplay *display,
}
if (event->xclient.message_type ==
- display->atom__NET_REQUEST_FRAME_EXTENTS)
+ x11_display->atom__NET_REQUEST_FRAME_EXTENTS)
{
meta_verbose ("Received _NET_REQUEST_FRAME_EXTENTS message\n");
process_request_frame_extents (display, event);
@@ -1631,11 +1636,11 @@ handle_other_xevent (MetaDisplay *display,
* event. If it is, ignore the current event, we'll update
* when we get the next one.
*/
- if (XPending (display->xdisplay))
+ if (XPending (x11_display->xdisplay))
{
XEvent next_event;
- XPeekEvent (display->xdisplay, &next_event);
+ XPeekEvent (x11_display->xdisplay, &next_event);
if (next_event.type == MappingNotify &&
next_event.xmapping.request == event->xmapping.request)
@@ -1749,7 +1754,7 @@ meta_display_handle_xevent (MetaDisplay *display,
FALSE);
}
- if (event->xany.window == display->screen->xroot)
+ if (event->xany.window == display->x11_display->xroot)
{
if (meta_screen_handle_xevent (display->screen, event))
{
@@ -1764,7 +1769,7 @@ meta_display_handle_xevent (MetaDisplay *display,
if (event->type == UnmapNotify)
{
- if (meta_ui_window_should_not_cause_focus (display->xdisplay,
+ if (meta_ui_window_should_not_cause_focus (display->x11_display->xdisplay,
modified))
{
meta_display_add_ignored_crossing_serial (display, event->xany.serial);
diff --git a/src/x11/group-props.c b/src/x11/group-props.c
index 6cc178181..124beeec1 100644
--- a/src/x11/group-props.c
+++ b/src/x11/group-props.c
@@ -23,6 +23,7 @@
#include "group-props.h"
#include "group-private.h"
#include "xprops.h"
+#include "x11/meta-x11-display-private.h"
#include <X11/Xatom.h>
typedef void (* InitValueFunc) (MetaDisplay *display,
@@ -124,7 +125,7 @@ init_wm_client_machine (MetaDisplay *display,
MetaPropValue *value)
{
value->type = META_PROP_VALUE_STRING;
- value->atom = display->atom_WM_CLIENT_MACHINE;
+ value->atom = display->x11_display->atom_WM_CLIENT_MACHINE;
}
static void
@@ -147,7 +148,7 @@ init_net_startup_id (MetaDisplay *display,
MetaPropValue *value)
{
value->type = META_PROP_VALUE_UTF8;
- value->atom = display->atom__NET_STARTUP_ID;
+ value->atom = display->x11_display->atom__NET_STARTUP_ID;
}
static void
@@ -179,17 +180,17 @@ meta_display_init_group_prop_hooks (MetaDisplay *display)
i = 0;
- hooks[i].property = display->atom_WM_CLIENT_MACHINE;
+ hooks[i].property = display->x11_display->atom_WM_CLIENT_MACHINE;
hooks[i].init_func = init_wm_client_machine;
hooks[i].reload_func = reload_wm_client_machine;
++i;
- hooks[i].property = display->atom__NET_WM_PID;
+ hooks[i].property = display->x11_display->atom__NET_WM_PID;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
++i;
- hooks[i].property = display->atom__NET_STARTUP_ID;
+ hooks[i].property = display->x11_display->atom__NET_STARTUP_ID;
hooks[i].init_func = init_net_startup_id;
hooks[i].reload_func = reload_net_startup_id;
++i;
diff --git a/src/x11/group.c b/src/x11/group.c
index 123b9e153..0973cd70f 100644
--- a/src/x11/group.c
+++ b/src/x11/group.c
@@ -30,6 +30,7 @@
#include "group-private.h"
#include "group-props.h"
#include "window-private.h"
+#include "x11/meta-x11-display-private.h"
#include <meta/window.h>
#include <X11/Xlib-xcb.h>
@@ -51,7 +52,7 @@ meta_group_new (MetaDisplay *display,
group->group_leader = group_leader;
group->refcount = 1; /* owned by caller, hash table has only weak ref */
- xcb_connection_t *xcb_conn = XGetXCBConnection (display->xdisplay);
+ xcb_connection_t *xcb_conn = XGetXCBConnection (display->x11_display->xdisplay);
xcb_generic_error_t *e;
g_autofree xcb_get_window_attributes_reply_t *attrs =
xcb_get_window_attributes_reply (xcb_conn,
@@ -76,9 +77,9 @@ meta_group_new (MetaDisplay *display,
/* Fill these in the order we want them to be gotten */
i = 0;
- initial_props[i++] = display->atom_WM_CLIENT_MACHINE;
- initial_props[i++] = display->atom__NET_WM_PID;
- initial_props[i++] = display->atom__NET_STARTUP_ID;
+ initial_props[i++] = display->x11_display->atom_WM_CLIENT_MACHINE;
+ initial_props[i++] = display->x11_display->atom__NET_WM_PID;
+ initial_props[i++] = display->x11_display->atom__NET_STARTUP_ID;
g_assert (N_INITIAL_PROPS == i);
meta_group_reload_properties (group, initial_props, N_INITIAL_PROPS);
diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c
index 508dd82b1..7bca0d5fd 100644
--- a/src/x11/iconcache.c
+++ b/src/x11/iconcache.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include "x11/meta-x11-display-private.h"
#include "iconcache.h"
#include <meta/errors.h>
@@ -212,9 +213,9 @@ read_rgb_icon (MetaDisplay *display,
meta_error_trap_push (display);
type = None;
data = NULL;
- result = XGetWindowProperty (display->xdisplay,
+ result = XGetWindowProperty (display->x11_display->xdisplay,
xwindow,
- display->atom__NET_WM_ICON,
+ display->x11_display->atom__NET_WM_ICON,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, &data);
@@ -276,7 +277,7 @@ get_pixmap_geometry (MetaDisplay *display,
if (d)
*d = 1;
- XGetGeometry (display->xdisplay,
+ XGetGeometry (display->x11_display->xdisplay,
pixmap, &root_ignored, &x_ignored, &y_ignored,
&width, &height, &border_width_ignored, &depth);
@@ -332,7 +333,7 @@ try_pixmap_and_mask (MetaDisplay *display,
Pixmap src_mask,
cairo_surface_t **iconp)
{
- Display *xdisplay = display->xdisplay;
+ Display *xdisplay = display->x11_display->xdisplay;
cairo_surface_t *icon, *mask = NULL;
int w, h, d;
@@ -405,11 +406,11 @@ get_kwm_win_icon (MetaDisplay *display,
meta_error_trap_push (display);
icons = NULL;
- result = XGetWindowProperty (display->xdisplay, xwindow,
- display->atom__KWM_WIN_ICON,
+ result = XGetWindowProperty (display->x11_display->xdisplay, xwindow,
+ display->x11_display->atom__KWM_WIN_ICON,
0, G_MAXLONG,
False,
- display->atom__KWM_WIN_ICON,
+ display->x11_display->atom__KWM_WIN_ICON,
&type, &format, &nitems,
&bytes_after, &data);
icons = (Pixmap *)data;
@@ -419,7 +420,7 @@ get_kwm_win_icon (MetaDisplay *display,
result != Success)
return;
- if (type != display->atom__KWM_WIN_ICON)
+ if (type != display->x11_display->atom__KWM_WIN_ICON)
{
XFree (icons);
return;
@@ -451,9 +452,9 @@ meta_icon_cache_property_changed (MetaIconCache *icon_cache,
MetaDisplay *display,
Atom atom)
{
- if (atom == display->atom__NET_WM_ICON)
+ if (atom == display->x11_display->atom__NET_WM_ICON)
icon_cache->net_wm_icon_dirty = TRUE;
- else if (atom == display->atom__KWM_WIN_ICON)
+ else if (atom == display->x11_display->atom__KWM_WIN_ICON)
icon_cache->kwm_win_icon_dirty = TRUE;
else if (atom == XA_WM_HINTS)
icon_cache->wm_hints_dirty = TRUE;
diff --git a/src/x11/meta-x11-display-private.h b/src/x11/meta-x11-display-private.h
index 6d7cf5cc6..b559485b7 100644
--- a/src/x11/meta-x11-display-private.h
+++ b/src/x11/meta-x11-display-private.h
@@ -26,6 +26,7 @@
#define META_X11_DISPLAY_PRIVATE_H
#include <glib.h>
+#include <X11/Xlib.h>
#include "core/display-private.h"
#include "meta/common.h"
@@ -37,8 +38,30 @@ struct _MetaX11Display
GObject parent;
MetaDisplay *display;
+
+ char *name;
+ char *screen_name;
+
+ Display *xdisplay;
+ Window xroot;
+ int default_depth;
+ Visual *default_xvisual;
+
+ /* Pull in all the names of atoms as fields; we will intern them when the
+ * class is constructed.
+ */
+#define item(x) Atom atom_##x;
+#include "x11/atomnames.h"
+#undef item
};
MetaX11Display *meta_x11_display_new (MetaDisplay *display, GError **error);
+Window meta_x11_display_create_offscreen_window (MetaX11Display *x11_display,
+ Window parent,
+ long valuemask);
+
+Cursor meta_x11_display_create_x_cursor (MetaX11Display *x11_display,
+ MetaCursor cursor);
+
#endif /* META_X11_DISPLAY_PRIVATE_H */
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index e8ff4813c..6239aa095 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -30,13 +30,55 @@
#include "config.h"
+#include "core/display-private.h"
#include "x11/meta-x11-display-private.h"
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <X11/Xatom.h>
+
+#include "core/util-private.h"
+#include "meta/errors.h"
+
+#ifdef HAVE_WAYLAND
+#include "wayland/meta-xwayland-private.h"
+#endif
+
G_DEFINE_TYPE (MetaX11Display, meta_x11_display, G_TYPE_OBJECT)
+static char *get_screen_name (Display *xdisplay,
+ int number);
+
static void
meta_x11_display_dispose (GObject *object)
{
+ MetaX11Display *x11_display = META_X11_DISPLAY (object);
+
+ if (x11_display->xroot != None)
+ {
+ meta_error_trap_push (x11_display->display);
+ XSelectInput (x11_display->xdisplay, x11_display->xroot, 0);
+ if (meta_error_trap_pop_with_return (x11_display->display) != Success)
+ meta_warning ("Could not release screen %d on display \"%s\"\n",
+ meta_ui_get_screen_number (), x11_display->name);
+
+ x11_display->xroot = None;
+ }
+
+
+ if (x11_display->xdisplay)
+ {
+ x11_display->xdisplay = NULL;
+ }
+
+ g_free (x11_display->name);
+ x11_display->name = NULL;
+
+ g_free (x11_display->screen_name);
+ x11_display->screen_name = NULL;
+
G_OBJECT_CLASS (meta_x11_display_parent_class)->dispose (object);
}
@@ -67,9 +109,179 @@ MetaX11Display *
meta_x11_display_new (MetaDisplay *display, GError **error)
{
MetaX11Display *x11_display;
+ Display *xdisplay;
+ Screen *xscreen;
+ Window xroot;
+ int i, number;
+
+ /* A list of all atom names, so that we can intern them in one go. */
+ const char *atom_names[] = {
+#define item(x) #x,
+#include "x11/atomnames.h"
+#undef item
+ };
+ Atom atoms[G_N_ELEMENTS(atom_names)];
+
+ meta_verbose ("Opening display '%s'\n", XDisplayName (NULL));
+
+ xdisplay = meta_ui_get_display ();
+
+ if (xdisplay == NULL)
+ {
+ meta_warning (_("Failed to open X Window System display “%s”\n"),
+ XDisplayName (NULL));
+
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to open X11 display");
+
+ return NULL;
+ }
+
+#ifdef HAVE_WAYLAND
+ if (meta_is_wayland_compositor ())
+ meta_xwayland_complete_init ();
+#endif
+
+ if (meta_is_syncing ())
+ XSynchronize (xdisplay, True);
+
+ number = meta_ui_get_screen_number ();
+
+ xroot = RootWindow (xdisplay, number);
+
+ /* FVWM checks for None here, I don't know if this
+ * ever actually happens
+ */
+ if (xroot == None)
+ {
+
+ meta_warning (_("Screen %d on display “%s” is invalid\n"),
+ number, XDisplayName (NULL));
+
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to open default X11 screen");
+
+ XFlush (xdisplay);
+ XCloseDisplay (xdisplay);
+
+ return NULL;
+ }
+
+ xscreen = ScreenOfDisplay (xdisplay, number);
x11_display = g_object_new (META_TYPE_X11_DISPLAY, NULL);
x11_display->display = display;
+ /* here we use XDisplayName which is what the user
+ * probably put in, vs. DisplayString(display) which is
+ * canonicalized by XOpenDisplay()
+ */
+ x11_display->xdisplay = xdisplay;
+ x11_display->xroot = xroot;
+
+ x11_display->name = g_strdup (XDisplayName (NULL));
+ x11_display->screen_name = get_screen_name (xdisplay, number);
+ x11_display->default_xvisual = DefaultVisualOfScreen (xscreen);
+ x11_display->default_depth = DefaultDepthOfScreen (xscreen);
+
+ meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
+ XInternAtoms (xdisplay, (char **)atom_names, G_N_ELEMENTS (atom_names),
+ False, atoms);
+
+ i = 0;
+#define item(x) x11_display->atom_##x = atoms[i++];
+#include "x11/atomnames.h"
+#undef item
+
return x11_display;
}
+
+int
+meta_x11_display_get_screen_number (MetaX11Display *x11_display)
+{
+ return meta_ui_get_screen_number ();
+}
+
+/**
+ * meta_x11_display_get_xdisplay: (skip)
+ * @x11_display: a #MetaX11Display
+ *
+ */
+Display *
+meta_x11_display_get_xdisplay (MetaX11Display *x11_display)
+{
+ return x11_display->xdisplay;
+}
+
+/**
+ * meta_x11_display_get_xroot: (skip)
+ * @x11_display: A #MetaX11Display
+ *
+ */
+Window
+meta_x11_display_get_xroot (MetaX11Display *x11_display)
+{
+ return x11_display->xroot;
+}
+
+Window
+meta_x11_display_create_offscreen_window (MetaX11Display *x11_display,
+ Window parent,
+ long valuemask)
+{
+ XSetWindowAttributes attrs;
+
+ /* we want to be override redirect because sometimes we
+ * create a window on a screen we aren't managing.
+ * (but on a display we are managing at least one screen for)
+ */
+ attrs.override_redirect = True;
+ attrs.event_mask = valuemask;
+
+ return XCreateWindow (x11_display->xdisplay,
+ parent,
+ -100, -100, 1, 1,
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ (Visual *)CopyFromParent,
+ CWOverrideRedirect | CWEventMask,
+ &attrs);
+}
+
+Cursor
+meta_x11_display_create_x_cursor (MetaX11Display *x11_display,
+ MetaCursor cursor)
+{
+ return meta_create_x_cursor (x11_display->xdisplay, cursor);
+}
+
+static char *
+get_screen_name (Display *xdisplay,
+ int number)
+{
+ char *p;
+ char *dname;
+ char *scr;
+
+ /* DisplayString gives us a sort of canonical display,
+ * vs. the user-entered name from XDisplayName()
+ */
+ dname = g_strdup (DisplayString (xdisplay));
+
+ /* Change display name to specify this screen.
+ */
+ p = strrchr (dname, ':');
+ if (p)
+ {
+ p = strchr (p, '.');
+ if (p)
+ *p = '\0';
+ }
+
+ scr = g_strdup_printf ("%s.%d", dname, number);
+
+ g_free (dname);
+
+ return scr;
+}
diff --git a/src/x11/session.c b/src/x11/session.c
index 8b2a89f1c..92ba3d25e 100644
--- a/src/x11/session.c
+++ b/src/x11/session.c
@@ -26,6 +26,7 @@
#include "util-private.h"
#include <meta/main.h>
#include "session.h"
+#include "x11/meta-x11-display-private.h"
#include <X11/Xatom.h>
#include <time.h>
@@ -1819,7 +1820,7 @@ warn_about_lame_clients_and_finish_interact (gboolean shutdown)
"and will have to be restarted manually next time "
"you log in."),
"240",
- meta_get_display()->screen->screen_name,
+ meta_get_display()->x11_display->screen_name,
NULL, NULL, NULL,
None,
columns,
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 2f4dfeb31..fe75bf5a8 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -40,6 +40,7 @@
#include "window-props.h"
#include "window-x11.h"
#include "window-x11-private.h"
+#include "x11/meta-x11-display-private.h"
#include <meta/errors.h>
#include "xprops.h"
#include "frame.h"
@@ -240,6 +241,7 @@ reload_net_wm_window_type (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = window_x11->priv;
@@ -254,20 +256,20 @@ reload_net_wm_window_type (MetaWindow *window,
/* We break as soon as we find one we recognize,
* supposed to prefer those near the front of the list
*/
- if (atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_DOCK ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_MENU ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_DND ||
- atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
+ if (atom == x11_display->atom__NET_WM_WINDOW_TYPE_DESKTOP ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_DOCK ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_TOOLBAR ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_MENU ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_UTILITY ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_SPLASH ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_DIALOG ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_TOOLTIP ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_COMBO ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_DND ||
+ atom == x11_display->atom__NET_WM_WINDOW_TYPE_NORMAL)
{
priv->type_atom = atom;
break;
@@ -296,7 +298,7 @@ reload_net_wm_icon (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
- reload_icon (window, window->display->atom__NET_WM_ICON);
+ reload_icon (window, window->display->x11_display->atom__NET_WM_ICON);
}
static void
@@ -304,7 +306,7 @@ reload_kwm_win_icon (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
- reload_icon (window, window->display->atom__KWM_WIN_ICON);
+ reload_icon (window, window->display->x11_display->atom__KWM_WIN_ICON);
}
static void
@@ -469,7 +471,7 @@ reload_net_wm_user_time_window (MetaWindow *window,
meta_display_unregister_x_window (window->display,
window->user_time_window);
/* Don't get events on not-managed windows */
- XSelectInput (window->display->xdisplay,
+ XSelectInput (window->display->x11_display->xdisplay,
window->user_time_window,
NoEventMask);
}
@@ -504,7 +506,7 @@ reload_net_wm_user_time_window (MetaWindow *window,
&window->user_time_window,
window);
/* Just listen for property notify events */
- XSelectInput (window->display->xdisplay,
+ XSelectInput (window->display->x11_display->xdisplay,
window->user_time_window,
PropertyChangeMask);
@@ -515,7 +517,7 @@ reload_net_wm_user_time_window (MetaWindow *window,
meta_window_reload_property_from_xwindow (
window,
window->user_time_window,
- window->display->atom__NET_WM_USER_TIME,
+ window->display->x11_display->atom__NET_WM_USER_TIME,
initial);
}
}
@@ -572,7 +574,7 @@ set_title_text (MetaWindow *window,
if (!modified && previous_was_modified)
{
meta_error_trap_push (window->display);
- XDeleteProperty (window->display->xdisplay,
+ XDeleteProperty (window->display->x11_display->xdisplay,
window->xwindow,
atom);
meta_error_trap_pop (window->display);
@@ -594,7 +596,7 @@ set_window_title (MetaWindow *window,
set_title_text (window,
priv->using_net_wm_visible_name,
title,
- window->display->atom__NET_WM_VISIBLE_NAME,
+ window->display->x11_display->atom__NET_WM_VISIBLE_NAME,
&new_title);
priv->using_net_wm_visible_name = modified;
@@ -775,6 +777,7 @@ reload_net_wm_state (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = window_x11->priv;
@@ -808,32 +811,32 @@ reload_net_wm_state (MetaWindow *window,
i = 0;
while (i < value->v.atom_list.n_atoms)
{
- if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SHADED)
+ if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SHADED)
window->shaded = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
window->maximize_horizontally_after_placement = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_VERT)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT)
window->maximize_vertically_after_placement = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_HIDDEN)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_HIDDEN)
window->minimize_after_placement = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MODAL)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MODAL)
priv->wm_state_modal = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_TASKBAR)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SKIP_TASKBAR)
priv->wm_state_skip_taskbar = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SKIP_PAGER)
priv->wm_state_skip_pager = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_FULLSCREEN)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_FULLSCREEN)
{
window->fullscreen = TRUE;
g_object_notify (G_OBJECT (window), "fullscreen");
}
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_ABOVE)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_ABOVE)
window->wm_state_above = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_BELOW)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_BELOW)
window->wm_state_below = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
window->wm_state_demands_attention = TRUE;
- else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_STICKY)
+ else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_STICKY)
window->on_all_workspaces_requested = TRUE;
++i;
@@ -1533,13 +1536,13 @@ reload_wm_protocols (MetaWindow *window,
while (i < value->v.atom_list.n_atoms)
{
if (value->v.atom_list.atoms[i] ==
- window->display->atom_WM_TAKE_FOCUS)
+ window->display->x11_display->atom_WM_TAKE_FOCUS)
window->take_focus = TRUE;
else if (value->v.atom_list.atoms[i] ==
- window->display->atom_WM_DELETE_WINDOW)
+ window->display->x11_display->atom_WM_DELETE_WINDOW)
window->delete_window = TRUE;
else if (value->v.atom_list.atoms[i] ==
- window->display->atom__NET_WM_PING)
+ window->display->x11_display->atom__NET_WM_PING)
window->can_ping = TRUE;
++i;
}
@@ -1663,7 +1666,8 @@ reload_transient_for (MetaWindow *window,
else
meta_verbose ("Window %s is not transient\n", window->desc);
- if (window->xtransient_for == None || window->xtransient_for == window->screen->xroot)
+ if (window->xtransient_for == None ||
+ window->xtransient_for == window->display->x11_display->xroot)
meta_window_set_transient_for (window, NULL);
else
{
@@ -1811,6 +1815,7 @@ RELOAD_STRING (gtk_menubar_object_path, "gtk-menubar-object-path")
void
meta_display_init_window_prop_hooks (MetaDisplay *display)
{
+ MetaX11Display *x11_display = display->x11_display;
/* The ordering here is significant for the properties we load
* initially: they are roughly ordered in the order we want them to
* be gotten. We want to get window name and class first so we can
@@ -1825,44 +1830,44 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
* for different types of override-redirect windows.
*/
MetaWindowPropHooks hooks[] = {
- { display->atom_WM_CLIENT_MACHINE, META_PROP_VALUE_STRING, reload_wm_client_machine, LOAD_INIT |
INCLUDE_OR },
- { display->atom__NET_WM_NAME, META_PROP_VALUE_UTF8, reload_net_wm_name, LOAD_INIT |
INCLUDE_OR },
- { XA_WM_CLASS, META_PROP_VALUE_CLASS_HINT, reload_wm_class, LOAD_INIT |
INCLUDE_OR },
- { display->atom__NET_WM_PID, META_PROP_VALUE_CARDINAL, reload_net_wm_pid, LOAD_INIT |
INCLUDE_OR },
- { XA_WM_NAME, META_PROP_VALUE_TEXT_PROPERTY, reload_wm_name, LOAD_INIT |
INCLUDE_OR },
- { display->atom__MUTTER_HINTS, META_PROP_VALUE_TEXT_PROPERTY, reload_mutter_hints, LOAD_INIT |
INCLUDE_OR },
- { display->atom__NET_WM_OPAQUE_REGION, META_PROP_VALUE_CARDINAL_LIST, reload_opaque_region, LOAD_INIT |
INCLUDE_OR },
- { display->atom__NET_WM_DESKTOP, META_PROP_VALUE_CARDINAL, reload_net_wm_desktop, LOAD_INIT |
INIT_ONLY },
- { display->atom__NET_STARTUP_ID, META_PROP_VALUE_UTF8, reload_net_startup_id, LOAD_INIT },
- { display->atom__NET_WM_SYNC_REQUEST_COUNTER, META_PROP_VALUE_SYNC_COUNTER_LIST, reload_update_counter,
LOAD_INIT | INCLUDE_OR },
- { XA_WM_NORMAL_HINTS, META_PROP_VALUE_SIZE_HINTS, reload_normal_hints, LOAD_INIT },
- { display->atom_WM_PROTOCOLS, META_PROP_VALUE_ATOM_LIST, reload_wm_protocols, LOAD_INIT },
- { XA_WM_HINTS, META_PROP_VALUE_WM_HINTS, reload_wm_hints, LOAD_INIT },
- { display->atom__NET_WM_USER_TIME, META_PROP_VALUE_CARDINAL, reload_net_wm_user_time, LOAD_INIT },
- { display->atom__NET_WM_STATE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_state, LOAD_INIT |
INIT_ONLY },
- { display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, LOAD_INIT },
- { XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, LOAD_INIT },
- { display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, LOAD_INIT },
- { display->atom__GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED, META_PROP_VALUE_CARDINAL,
reload_gtk_hide_titlebar_when_maximized, LOAD_INIT },
- { display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8,
reload_gtk_application_id, LOAD_INIT },
- { display->atom__GTK_UNIQUE_BUS_NAME, META_PROP_VALUE_UTF8,
reload_gtk_unique_bus_name, LOAD_INIT },
- { display->atom__GTK_APPLICATION_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_application_object_path, LOAD_INIT },
- { display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_window_object_path, LOAD_INIT },
- { display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_app_menu_object_path, LOAD_INIT },
- { display->atom__GTK_MENUBAR_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_menubar_object_path, LOAD_INIT },
- { display->atom__GTK_FRAME_EXTENTS,
META_PROP_VALUE_CARDINAL_LIST,reload_gtk_frame_extents, LOAD_INIT },
- { display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window,
LOAD_INIT },
- { display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, NONE },
- { display->atom__KWM_WIN_ICON, META_PROP_VALUE_INVALID, reload_kwm_win_icon, NONE },
- { display->atom__NET_WM_ICON_GEOMETRY, META_PROP_VALUE_CARDINAL_LIST, reload_icon_geometry, LOAD_INIT },
- { display->atom_WM_CLIENT_LEADER, META_PROP_VALUE_INVALID, complain_about_broken_client, NONE },
- { display->atom_SM_CLIENT_ID, META_PROP_VALUE_INVALID, complain_about_broken_client, NONE },
- { display->atom_WM_WINDOW_ROLE, META_PROP_VALUE_STRING, reload_wm_window_role, LOAD_INIT | FORCE_INIT
},
- { display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_window_type, LOAD_INIT |
INCLUDE_OR | FORCE_INIT },
- { display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, NONE },
- { display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, NONE },
- { display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor,
LOAD_INIT | INCLUDE_OR },
- { display->atom__NET_WM_WINDOW_OPACITY, META_PROP_VALUE_CARDINAL, reload_window_opacity, LOAD_INIT |
INCLUDE_OR },
+ { x11_display->atom_WM_CLIENT_MACHINE, META_PROP_VALUE_STRING, reload_wm_client_machine, LOAD_INIT |
INCLUDE_OR },
+ { x11_display->atom__NET_WM_NAME, META_PROP_VALUE_UTF8, reload_net_wm_name, LOAD_INIT |
INCLUDE_OR },
+ { XA_WM_CLASS, META_PROP_VALUE_CLASS_HINT, reload_wm_class, LOAD_INIT |
INCLUDE_OR },
+ { x11_display->atom__NET_WM_PID, META_PROP_VALUE_CARDINAL, reload_net_wm_pid, LOAD_INIT |
INCLUDE_OR },
+ { XA_WM_NAME, META_PROP_VALUE_TEXT_PROPERTY, reload_wm_name, LOAD_INIT |
INCLUDE_OR },
+ { x11_display->atom__MUTTER_HINTS, META_PROP_VALUE_TEXT_PROPERTY, reload_mutter_hints, LOAD_INIT |
INCLUDE_OR },
+ { x11_display->atom__NET_WM_OPAQUE_REGION, META_PROP_VALUE_CARDINAL_LIST, reload_opaque_region,
LOAD_INIT | INCLUDE_OR },
+ { x11_display->atom__NET_WM_DESKTOP, META_PROP_VALUE_CARDINAL, reload_net_wm_desktop, LOAD_INIT |
INIT_ONLY },
+ { x11_display->atom__NET_STARTUP_ID, META_PROP_VALUE_UTF8, reload_net_startup_id, LOAD_INIT },
+ { x11_display->atom__NET_WM_SYNC_REQUEST_COUNTER, META_PROP_VALUE_SYNC_COUNTER_LIST,
reload_update_counter, LOAD_INIT | INCLUDE_OR },
+ { XA_WM_NORMAL_HINTS, META_PROP_VALUE_SIZE_HINTS, reload_normal_hints, LOAD_INIT },
+ { x11_display->atom_WM_PROTOCOLS, META_PROP_VALUE_ATOM_LIST, reload_wm_protocols, LOAD_INIT },
+ { XA_WM_HINTS, META_PROP_VALUE_WM_HINTS, reload_wm_hints, LOAD_INIT },
+ { x11_display->atom__NET_WM_USER_TIME, META_PROP_VALUE_CARDINAL, reload_net_wm_user_time, LOAD_INIT },
+ { x11_display->atom__NET_WM_STATE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_state, LOAD_INIT |
INIT_ONLY },
+ { x11_display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, LOAD_INIT },
+ { XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, LOAD_INIT },
+ { x11_display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, LOAD_INIT },
+ { x11_display->atom__GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED, META_PROP_VALUE_CARDINAL,
reload_gtk_hide_titlebar_when_maximized, LOAD_INIT },
+ { x11_display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8,
reload_gtk_application_id, LOAD_INIT },
+ { x11_display->atom__GTK_UNIQUE_BUS_NAME, META_PROP_VALUE_UTF8,
reload_gtk_unique_bus_name, LOAD_INIT },
+ { x11_display->atom__GTK_APPLICATION_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_application_object_path, LOAD_INIT },
+ { x11_display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_window_object_path, LOAD_INIT },
+ { x11_display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_app_menu_object_path, LOAD_INIT },
+ { x11_display->atom__GTK_MENUBAR_OBJECT_PATH, META_PROP_VALUE_UTF8,
reload_gtk_menubar_object_path, LOAD_INIT },
+ { x11_display->atom__GTK_FRAME_EXTENTS,
META_PROP_VALUE_CARDINAL_LIST,reload_gtk_frame_extents, LOAD_INIT },
+ { x11_display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window,
LOAD_INIT },
+ { x11_display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, NONE },
+ { x11_display->atom__KWM_WIN_ICON, META_PROP_VALUE_INVALID, reload_kwm_win_icon, NONE },
+ { x11_display->atom__NET_WM_ICON_GEOMETRY, META_PROP_VALUE_CARDINAL_LIST, reload_icon_geometry,
LOAD_INIT },
+ { x11_display->atom_WM_CLIENT_LEADER, META_PROP_VALUE_INVALID, complain_about_broken_client, NONE },
+ { x11_display->atom_SM_CLIENT_ID, META_PROP_VALUE_INVALID, complain_about_broken_client, NONE },
+ { x11_display->atom_WM_WINDOW_ROLE, META_PROP_VALUE_STRING, reload_wm_window_role, LOAD_INIT |
FORCE_INIT },
+ { x11_display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_window_type, LOAD_INIT
| INCLUDE_OR | FORCE_INIT },
+ { x11_display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, NONE },
+ { x11_display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, NONE },
+ { x11_display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor,
LOAD_INIT | INCLUDE_OR },
+ { x11_display->atom__NET_WM_WINDOW_OPACITY, META_PROP_VALUE_CARDINAL, reload_window_opacity, LOAD_INIT |
INCLUDE_OR },
{ 0 },
};
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index e9bd8ae65..1f62e0d5b 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -22,6 +22,7 @@
#include "config.h"
+#include "meta-x11-display-private.h"
#include "window-x11.h"
#include "window-x11-private.h"
@@ -83,16 +84,17 @@ send_icccm_message (MetaWindow *window,
*/
XClientMessageEvent ev;
+ MetaX11Display *x11_display = window->display->x11_display;
ev.type = ClientMessage;
ev.window = window->xwindow;
- ev.message_type = window->display->atom_WM_PROTOCOLS;
+ ev.message_type = x11_display->atom_WM_PROTOCOLS;
ev.format = 32;
ev.data.l[0] = atom;
ev.data.l[1] = timestamp;
meta_error_trap_push (window->display);
- XSendEvent (window->display->xdisplay,
+ XSendEvent (x11_display->xdisplay,
window->xwindow, False, 0, (XEvent*) &ev);
meta_error_trap_pop (window->display);
}
@@ -104,7 +106,7 @@ read_client_leader (MetaDisplay *display,
Window retval = None;
meta_prop_get_window (display, xwindow,
- display->atom_WM_CLIENT_LEADER,
+ display->x11_display->atom_WM_CLIENT_LEADER,
&retval);
return retval;
@@ -159,7 +161,7 @@ update_sm_hints (MetaWindow *window)
window->xclient_leader = leader;
if (meta_prop_get_latin1_string (window->display, leader,
- window->display->atom_SM_CLIENT_ID,
+ window->display->x11_display->atom_SM_CLIENT_ID,
&str))
{
window->sm_client_id = g_strdup (str);
@@ -179,7 +181,7 @@ update_sm_hints (MetaWindow *window)
str = NULL;
if (meta_prop_get_latin1_string (window->display, window->xwindow,
- window->display->atom_SM_CLIENT_ID,
+ window->display->x11_display->atom_SM_CLIENT_ID,
&str))
{
if (window->sm_client_id == NULL) /* first time through */
@@ -200,6 +202,7 @@ update_sm_hints (MetaWindow *window)
static void
send_configure_notify (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
XEvent event;
@@ -209,7 +212,7 @@ send_configure_notify (MetaWindow *window)
/* from twm */
event.type = ConfigureNotify;
- event.xconfigure.display = window->display->xdisplay;
+ event.xconfigure.display = x11_display->xdisplay;
event.xconfigure.event = window->xwindow;
event.xconfigure.window = window->xwindow;
event.xconfigure.x = priv->client_rect.x - priv->border_width;
@@ -248,7 +251,7 @@ send_configure_notify (MetaWindow *window)
event.xconfigure.width, event.xconfigure.height);
meta_error_trap_push (window->display);
- XSendEvent (window->display->xdisplay,
+ XSendEvent (x11_display->xdisplay,
window->xwindow,
False, StructureNotifyMask, &event);
meta_error_trap_pop (window->display);
@@ -570,6 +573,7 @@ meta_window_x11_manage (MetaWindow *window)
static void
meta_window_x11_unmanage (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
@@ -583,15 +587,15 @@ meta_window_x11_unmanage (MetaWindow *window)
* won't be restored if the app maps it again.
*/
meta_verbose ("Cleaning state from window %s\n", window->desc);
- XDeleteProperty (window->display->xdisplay,
+ XDeleteProperty (x11_display->xdisplay,
window->xwindow,
- window->display->atom__NET_WM_DESKTOP);
- XDeleteProperty (window->display->xdisplay,
+ x11_display->atom__NET_WM_DESKTOP);
+ XDeleteProperty (x11_display->xdisplay,
window->xwindow,
- window->display->atom__NET_WM_STATE);
- XDeleteProperty (window->display->xdisplay,
+ x11_display->atom__NET_WM_STATE);
+ XDeleteProperty (x11_display->xdisplay,
window->xwindow,
- window->display->atom__NET_WM_FULLSCREEN_MONITORS);
+ x11_display->atom__NET_WM_FULLSCREEN_MONITORS);
meta_window_x11_set_wm_state (window);
}
else
@@ -609,7 +613,7 @@ meta_window_x11_unmanage (MetaWindow *window)
* current one, which will happen automatically if we re-map
* the X Window.
*/
- XMapWindow (window->display->xdisplay,
+ XMapWindow (x11_display->xdisplay,
window->xwindow);
}
@@ -617,12 +621,12 @@ meta_window_x11_unmanage (MetaWindow *window)
/* Put back anything we messed up */
if (priv->border_width != 0)
- XSetWindowBorderWidth (window->display->xdisplay,
+ XSetWindowBorderWidth (x11_display->xdisplay,
window->xwindow,
priv->border_width);
/* No save set */
- XRemoveFromSaveSet (window->display->xdisplay,
+ XRemoveFromSaveSet (x11_display->xdisplay,
window->xwindow);
/* Even though the window is now unmanaged, we can't unselect events. This
@@ -647,7 +651,7 @@ meta_window_x11_unmanage (MetaWindow *window)
}
if (META_DISPLAY_HAS_SHAPE (window->display))
- XShapeSelectInput (window->display->xdisplay, window->xwindow, NoEventMask);
+ XShapeSelectInput (x11_display->xdisplay, window->xwindow, NoEventMask);
meta_window_ungrab_keys (window);
meta_display_ungrab_window_buttons (window->display, window->xwindow);
@@ -673,27 +677,29 @@ meta_window_x11_ping (MetaWindow *window,
{
MetaDisplay *display = window->display;
- send_icccm_message (window, display->atom__NET_WM_PING, serial);
+ send_icccm_message (window, display->x11_display->atom__NET_WM_PING, serial);
}
static void
meta_window_x11_delete (MetaWindow *window,
guint32 timestamp)
{
+ MetaX11Display *x11_display = window->display->x11_display;
+
meta_error_trap_push (window->display);
if (window->delete_window)
{
meta_topic (META_DEBUG_WINDOW_OPS,
"Deleting %s with delete_window request\n",
window->desc);
- send_icccm_message (window, window->display->atom_WM_DELETE_WINDOW, timestamp);
+ send_icccm_message (window, x11_display->atom_WM_DELETE_WINDOW, timestamp);
}
else
{
meta_topic (META_DEBUG_WINDOW_OPS,
"Deleting %s with explicit kill\n",
window->desc);
- XKillClient (window->display->xdisplay, window->xwindow);
+ XKillClient (x11_display->xdisplay, window->xwindow);
}
meta_error_trap_pop (window->display);
}
@@ -701,12 +707,14 @@ meta_window_x11_delete (MetaWindow *window,
static void
meta_window_x11_kill (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
+
meta_topic (META_DEBUG_WINDOW_OPS,
"Disconnecting %s with XKillClient()\n",
window->desc);
meta_error_trap_push (window->display);
- XKillClient (window->display->xdisplay, window->xwindow);
+ XKillClient (x11_display->xdisplay, window->xwindow);
meta_error_trap_pop (window->display);
}
@@ -719,7 +727,7 @@ request_take_focus (MetaWindow *window,
meta_topic (META_DEBUG_FOCUS, "WM_TAKE_FOCUS(%s, %u)\n",
window->desc, timestamp);
- send_icccm_message (window, display->atom_WM_TAKE_FOCUS, timestamp);
+ send_icccm_message (window, display->x11_display->atom_WM_TAKE_FOCUS, timestamp);
}
static void
@@ -872,6 +880,8 @@ meta_window_x11_grab_op_ended (MetaWindow *window,
static void
update_net_frame_extents (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
+
unsigned long data[4];
MetaFrameBorders borders;
@@ -891,8 +901,8 @@ update_net_frame_extents (MetaWindow *window)
window->xwindow, data[0], data[1], data[2], data[3]);
meta_error_trap_push (window->display);
- XChangeProperty (window->display->xdisplay, window->xwindow,
- window->display->atom__NET_FRAME_EXTENTS,
+ XChangeProperty (x11_display->xdisplay, window->xwindow,
+ x11_display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_error_trap_pop (window->display);
@@ -901,6 +911,7 @@ update_net_frame_extents (MetaWindow *window)
static void
update_gtk_edge_constraints (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaEdgeConstraint *constraints = window->edge_constraints;
unsigned long data[1];
@@ -917,9 +928,9 @@ update_gtk_edge_constraints (MetaWindow *window)
meta_verbose ("Setting _GTK_EDGE_CONSTRAINTS to %lu\n", data[0]);
meta_error_trap_push (window->display);
- XChangeProperty (window->display->xdisplay,
+ XChangeProperty (x11_display->xdisplay,
window->xwindow,
- window->display->atom__GTK_EDGE_CONSTRAINTS,
+ x11_display->atom__GTK_EDGE_CONSTRAINTS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, 1);
meta_error_trap_pop (window->display);
@@ -959,6 +970,7 @@ sync_request_timeout (gpointer data)
static void
send_sync_request (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
XClientMessageEvent ev;
gint64 wait_serial;
@@ -975,9 +987,9 @@ send_sync_request (MetaWindow *window)
ev.type = ClientMessage;
ev.window = window->xwindow;
- ev.message_type = window->display->atom_WM_PROTOCOLS;
+ ev.message_type = x11_display->atom_WM_PROTOCOLS;
ev.format = 32;
- ev.data.l[0] = window->display->atom__NET_WM_SYNC_REQUEST;
+ ev.data.l[0] = x11_display->atom__NET_WM_SYNC_REQUEST;
/* FIXME: meta_display_get_current_time() is bad, but since calls
* come from meta_window_move_resize_internal (which in turn come
* from all over), I'm not sure what we can do to fix it. Do we
@@ -991,7 +1003,7 @@ send_sync_request (MetaWindow *window)
/* We don't need to trap errors here as we are already
* inside an error_trap_push()/pop() pair.
*/
- XSendEvent (window->display->xdisplay,
+ XSendEvent (x11_display->xdisplay,
window->xwindow, False, 0, (XEvent*) &ev);
/* We give the window 1 sec to respond to _NET_WM_SYNC_REQUEST;
@@ -1019,6 +1031,7 @@ meta_window_get_net_wm_desktop (MetaWindow *window)
static void
meta_window_x11_current_workspace_changed (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
/* FIXME if on more than one workspace, we claim to be "sticky",
* the WM spec doesn't say what to do here.
*/
@@ -1036,8 +1049,8 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
window->desc, data[0]);
meta_error_trap_push (window->display);
- XChangeProperty (window->display->xdisplay, window->xwindow,
- window->display->atom__NET_WM_DESKTOP,
+ XChangeProperty (x11_display->xdisplay, window->xwindow,
+ x11_display->atom__NET_WM_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (window->display);
@@ -1254,7 +1267,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
send_sync_request (window);
}
- XConfigureWindow (window->display->xdisplay,
+ XConfigureWindow (window->display->x11_display->xdisplay,
window->xwindow,
mask,
&values);
@@ -1307,7 +1320,7 @@ meta_window_x11_update_struts (MetaWindow *window)
if (meta_prop_get_cardinal_list (window->display,
window->xwindow,
- window->display->atom__NET_WM_STRUT_PARTIAL,
+ window->display->x11_display->atom__NET_WM_STRUT_PARTIAL,
&struts, &nitems))
{
if (nitems != 12)
@@ -1373,7 +1386,7 @@ meta_window_x11_update_struts (MetaWindow *window)
if (!new_struts &&
meta_prop_get_cardinal_list (window->display,
window->xwindow,
- window->display->atom__NET_WM_STRUT,
+ window->display->x11_display->atom__NET_WM_STRUT,
&struts, &nitems))
{
if (nitems != 4)
@@ -1498,7 +1511,8 @@ meta_window_x11_main_monitor_changed (MetaWindow *window,
static uint32_t
meta_window_x11_get_client_pid (MetaWindow *window)
{
- xcb_connection_t *xcb = XGetXCBConnection (window->display->xdisplay);
+ MetaX11Display *x11_display = window->display->x11_display;
+ xcb_connection_t *xcb = XGetXCBConnection (x11_display->xdisplay);
xcb_res_client_id_spec_t spec = { 0 };
xcb_res_query_client_ids_cookie_t cookie;
xcb_res_query_client_ids_reply_t *reply = NULL;
@@ -1587,6 +1601,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
void
meta_window_x11_set_net_wm_state (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
int i;
@@ -1595,75 +1610,75 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
i = 0;
if (window->shaded)
{
- data[i] = window->display->atom__NET_WM_STATE_SHADED;
+ data[i] = x11_display->atom__NET_WM_STATE_SHADED;
++i;
}
if (priv->wm_state_modal)
{
- data[i] = window->display->atom__NET_WM_STATE_MODAL;
+ data[i] = x11_display->atom__NET_WM_STATE_MODAL;
++i;
}
if (window->skip_pager)
{
- data[i] = window->display->atom__NET_WM_STATE_SKIP_PAGER;
+ data[i] = x11_display->atom__NET_WM_STATE_SKIP_PAGER;
++i;
}
if (window->skip_taskbar)
{
- data[i] = window->display->atom__NET_WM_STATE_SKIP_TASKBAR;
+ data[i] = x11_display->atom__NET_WM_STATE_SKIP_TASKBAR;
++i;
}
if (window->maximized_horizontally)
{
- data[i] = window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ;
+ data[i] = x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ;
++i;
}
if (window->maximized_vertically)
{
- data[i] = window->display->atom__NET_WM_STATE_MAXIMIZED_VERT;
+ data[i] = x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT;
++i;
}
if (window->fullscreen)
{
- data[i] = window->display->atom__NET_WM_STATE_FULLSCREEN;
+ data[i] = x11_display->atom__NET_WM_STATE_FULLSCREEN;
++i;
}
if (!meta_window_showing_on_its_workspace (window) || window->shaded)
{
- data[i] = window->display->atom__NET_WM_STATE_HIDDEN;
+ data[i] = x11_display->atom__NET_WM_STATE_HIDDEN;
++i;
}
if (window->wm_state_above)
{
- data[i] = window->display->atom__NET_WM_STATE_ABOVE;
+ data[i] = x11_display->atom__NET_WM_STATE_ABOVE;
++i;
}
if (window->wm_state_below)
{
- data[i] = window->display->atom__NET_WM_STATE_BELOW;
+ data[i] = x11_display->atom__NET_WM_STATE_BELOW;
++i;
}
if (window->wm_state_demands_attention)
{
- data[i] = window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION;
+ data[i] = x11_display->atom__NET_WM_STATE_DEMANDS_ATTENTION;
++i;
}
if (window->on_all_workspaces_requested)
{
- data[i] = window->display->atom__NET_WM_STATE_STICKY;
+ data[i] = x11_display->atom__NET_WM_STATE_STICKY;
++i;
}
if (meta_window_appears_focused (window))
{
- data[i] = window->display->atom__NET_WM_STATE_FOCUSED;
+ data[i] = x11_display->atom__NET_WM_STATE_FOCUSED;
++i;
}
meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i);
meta_error_trap_push (window->display);
- XChangeProperty (window->display->xdisplay, window->xwindow,
- window->display->atom__NET_WM_STATE,
+ XChangeProperty (x11_display->xdisplay, window->xwindow,
+ x11_display->atom__NET_WM_STATE,
XA_ATOM,
32, PropModeReplace, (guchar*) data, i);
meta_error_trap_pop (window->display);
@@ -1687,9 +1702,9 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
meta_verbose ("Setting _NET_WM_FULLSCREEN_MONITORS\n");
meta_error_trap_push (window->display);
- XChangeProperty (window->display->xdisplay,
+ XChangeProperty (x11_display->xdisplay,
window->xwindow,
- window->display->atom__NET_WM_FULLSCREEN_MONITORS,
+ x11_display->atom__NET_WM_FULLSCREEN_MONITORS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, 4);
meta_error_trap_pop (window->display);
@@ -1698,9 +1713,9 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
{
meta_verbose ("Clearing _NET_WM_FULLSCREEN_MONITORS\n");
meta_error_trap_push (window->display);
- XDeleteProperty (window->display->xdisplay,
+ XDeleteProperty (x11_display->xdisplay,
window->xwindow,
- window->display->atom__NET_WM_FULLSCREEN_MONITORS);
+ x11_display->atom__NET_WM_FULLSCREEN_MONITORS);
meta_error_trap_pop (window->display);
}
}
@@ -1766,6 +1781,7 @@ print_region (cairo_region_t *region)
void
meta_window_x11_update_input_region (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
cairo_region_t *region = NULL;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
@@ -1789,7 +1805,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
int n_rects = -1, ordering;
meta_error_trap_push (window->display);
- rects = XShapeGetRectangles (window->display->xdisplay,
+ rects = XShapeGetRectangles (x11_display->xdisplay,
window->xwindow,
ShapeInput,
&n_rects,
@@ -1879,6 +1895,7 @@ meta_window_set_shape_region (MetaWindow *window,
void
meta_window_x11_update_shape_region (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
cairo_region_t *region = NULL;
@@ -1895,7 +1912,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
int bounding_shaped, clip_shaped;
meta_error_trap_push (window->display);
- XShapeQueryExtents (window->display->xdisplay, window->xwindow,
+ XShapeQueryExtents (x11_display->xdisplay, window->xwindow,
&bounding_shaped, &x_bounding, &y_bounding,
&w_bounding, &h_bounding,
&clip_shaped, &x_clip, &y_clip,
@@ -1903,7 +1920,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
if (bounding_shaped)
{
- rects = XShapeGetRectangles (window->display->xdisplay,
+ rects = XShapeGetRectangles (x11_display->xdisplay,
window->xwindow,
ShapeBounding,
&n_rects,
@@ -1958,7 +1975,7 @@ static gboolean
meta_window_same_client (MetaWindow *window,
MetaWindow *other_window)
{
- int resource_mask = window->display->xdisplay->resource_mask;
+ int resource_mask = window->display->x11_display->xdisplay->resource_mask;
return ((window->xwindow & ~resource_mask) ==
(other_window->xwindow & ~resource_mask));
@@ -2254,7 +2271,7 @@ process_property_notify (MetaWindow *window,
if (meta_is_verbose ()) /* avoid looking up the name if we don't have to */
{
- char *property_name = XGetAtomName (window->display->xdisplay,
+ char *property_name = XGetAtomName (window->display->x11_display->xdisplay,
event->atom);
meta_verbose ("Property notify on %s for %s\n",
@@ -2262,7 +2279,7 @@ process_property_notify (MetaWindow *window,
XFree (property_name);
}
- if (event->atom == window->display->atom__NET_WM_USER_TIME &&
+ if (event->atom == window->display->x11_display->atom__NET_WM_USER_TIME &&
window->user_time_window)
{
xid = window->user_time_window;
@@ -2340,6 +2357,7 @@ gboolean
meta_window_x11_client_message (MetaWindow *window,
XEvent *event)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
MetaDisplay *display;
@@ -2357,7 +2375,7 @@ meta_window_x11_client_message (MetaWindow *window,
}
if (event->xclient.message_type ==
- display->atom__NET_CLOSE_WINDOW)
+ x11_display->atom__NET_CLOSE_WINDOW)
{
guint32 timestamp;
@@ -2377,7 +2395,7 @@ meta_window_x11_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
- display->atom__NET_WM_DESKTOP)
+ x11_display->atom__NET_WM_DESKTOP)
{
int space;
MetaWorkspace *workspace;
@@ -2404,7 +2422,7 @@ meta_window_x11_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
- display->atom__NET_WM_STATE)
+ x11_display->atom__NET_WM_STATE)
{
gulong action;
Atom first;
@@ -2420,12 +2438,12 @@ meta_window_x11_client_message (MetaWindow *window,
char *str2;
meta_error_trap_push (display);
- str1 = XGetAtomName (display->xdisplay, first);
+ str1 = XGetAtomName (x11_display->xdisplay, first);
if (meta_error_trap_pop_with_return (display) != Success)
str1 = NULL;
meta_error_trap_push (display);
- str2 = XGetAtomName (display->xdisplay, second);
+ str2 = XGetAtomName (x11_display->xdisplay, second);
if (meta_error_trap_pop_with_return (display) != Success)
str2 = NULL;
@@ -2438,8 +2456,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_XFree (str2);
}
- if (first == display->atom__NET_WM_STATE_SHADED ||
- second == display->atom__NET_WM_STATE_SHADED)
+ if (first == x11_display->atom__NET_WM_STATE_SHADED ||
+ second == x11_display->atom__NET_WM_STATE_SHADED)
{
gboolean shade;
guint32 timestamp;
@@ -2458,8 +2476,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_unshade (window, timestamp);
}
- if (first == display->atom__NET_WM_STATE_FULLSCREEN ||
- second == display->atom__NET_WM_STATE_FULLSCREEN)
+ if (first == x11_display->atom__NET_WM_STATE_FULLSCREEN ||
+ second == x11_display->atom__NET_WM_STATE_FULLSCREEN)
{
gboolean make_fullscreen;
@@ -2471,10 +2489,10 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_unmake_fullscreen (window);
}
- if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
- second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
- first == display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
- second == display->atom__NET_WM_STATE_MAXIMIZED_VERT)
+ if (first == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
+ second == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
+ first == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
+ second == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT)
{
gboolean max;
MetaMaximizeFlags directions = 0;
@@ -2483,12 +2501,12 @@ meta_window_x11_client_message (MetaWindow *window,
(action == _NET_WM_STATE_TOGGLE &&
!window->maximized_horizontally));
- if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
- second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
+ if (first == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
+ second == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
directions |= META_MAXIMIZE_HORIZONTAL;
- if (first == display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
- second == display->atom__NET_WM_STATE_MAXIMIZED_VERT)
+ if (first == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
+ second == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT)
directions |= META_MAXIMIZE_VERTICAL;
if (max && window->has_maximize_func)
@@ -2505,8 +2523,8 @@ meta_window_x11_client_message (MetaWindow *window,
}
}
- if (first == display->atom__NET_WM_STATE_MODAL ||
- second == display->atom__NET_WM_STATE_MODAL)
+ if (first == x11_display->atom__NET_WM_STATE_MODAL ||
+ second == x11_display->atom__NET_WM_STATE_MODAL)
{
priv->wm_state_modal =
(action == _NET_WM_STATE_ADD) ||
@@ -2516,8 +2534,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
}
- if (first == display->atom__NET_WM_STATE_SKIP_PAGER ||
- second == display->atom__NET_WM_STATE_SKIP_PAGER)
+ if (first == x11_display->atom__NET_WM_STATE_SKIP_PAGER ||
+ second == x11_display->atom__NET_WM_STATE_SKIP_PAGER)
{
priv->wm_state_skip_pager =
(action == _NET_WM_STATE_ADD) ||
@@ -2527,8 +2545,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_x11_set_net_wm_state (window);
}
- if (first == display->atom__NET_WM_STATE_SKIP_TASKBAR ||
- second == display->atom__NET_WM_STATE_SKIP_TASKBAR)
+ if (first == x11_display->atom__NET_WM_STATE_SKIP_TASKBAR ||
+ second == x11_display->atom__NET_WM_STATE_SKIP_TASKBAR)
{
priv->wm_state_skip_taskbar =
(action == _NET_WM_STATE_ADD) ||
@@ -2538,8 +2556,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_x11_set_net_wm_state (window);
}
- if (first == display->atom__NET_WM_STATE_ABOVE ||
- second == display->atom__NET_WM_STATE_ABOVE)
+ if (first == x11_display->atom__NET_WM_STATE_ABOVE ||
+ second == x11_display->atom__NET_WM_STATE_ABOVE)
{
if ((action == _NET_WM_STATE_ADD) ||
(action == _NET_WM_STATE_TOGGLE && !window->wm_state_demands_attention))
@@ -2548,8 +2566,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_unmake_above (window);
}
- if (first == display->atom__NET_WM_STATE_BELOW ||
- second == display->atom__NET_WM_STATE_BELOW)
+ if (first == x11_display->atom__NET_WM_STATE_BELOW ||
+ second == x11_display->atom__NET_WM_STATE_BELOW)
{
window->wm_state_below =
(action == _NET_WM_STATE_ADD) ||
@@ -2559,8 +2577,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_x11_set_net_wm_state (window);
}
- if (first == display->atom__NET_WM_STATE_DEMANDS_ATTENTION ||
- second == display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
+ if (first == x11_display->atom__NET_WM_STATE_DEMANDS_ATTENTION ||
+ second == x11_display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
{
if ((action == _NET_WM_STATE_ADD) ||
(action == _NET_WM_STATE_TOGGLE && !window->wm_state_demands_attention))
@@ -2569,8 +2587,8 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_unset_demands_attention (window);
}
- if (first == display->atom__NET_WM_STATE_STICKY ||
- second == display->atom__NET_WM_STATE_STICKY)
+ if (first == x11_display->atom__NET_WM_STATE_STICKY ||
+ second == x11_display->atom__NET_WM_STATE_STICKY)
{
if ((action == _NET_WM_STATE_ADD) ||
(action == _NET_WM_STATE_TOGGLE && !window->on_all_workspaces_requested))
@@ -2582,7 +2600,7 @@ meta_window_x11_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
- display->atom_WM_CHANGE_STATE)
+ x11_display->atom_WM_CHANGE_STATE)
{
meta_verbose ("WM_CHANGE_STATE client message, state: %ld\n",
event->xclient.data.l[0]);
@@ -2592,7 +2610,7 @@ meta_window_x11_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
- display->atom__NET_WM_MOVERESIZE)
+ x11_display->atom__NET_WM_MOVERESIZE)
{
int x_root;
int y_root;
@@ -2737,7 +2755,7 @@ meta_window_x11_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
- display->atom__NET_MOVERESIZE_WINDOW)
+ x11_display->atom__NET_MOVERESIZE_WINDOW)
{
int gravity;
guint value_mask;
@@ -2758,7 +2776,7 @@ meta_window_x11_client_message (MetaWindow *window,
event->xclient.data.l[4]); /* height */
}
else if (event->xclient.message_type ==
- display->atom__NET_ACTIVE_WINDOW)
+ x11_display->atom__NET_ACTIVE_WINDOW)
{
MetaClientType source_indication;
guint32 timestamp;
@@ -2785,7 +2803,7 @@ meta_window_x11_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
- display->atom__NET_WM_FULLSCREEN_MONITORS)
+ x11_display->atom__NET_WM_FULLSCREEN_MONITORS)
{
MetaLogicalMonitor *top, *bottom, *left, *right;
@@ -2809,7 +2827,7 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_update_fullscreen_monitors (window, top, bottom, left, right);
}
else if (event->xclient.message_type ==
- display->atom__GTK_SHOW_WINDOW_MENU)
+ x11_display->atom__GTK_SHOW_WINDOW_MENU)
{
gulong x, y;
@@ -2820,7 +2838,7 @@ meta_window_x11_client_message (MetaWindow *window,
meta_window_show_menu (window, META_WINDOW_MENU_WM, x, y);
}
else if (event->xclient.message_type ==
- display->atom__NET_RESTACK_WINDOW)
+ x11_display->atom__NET_RESTACK_WINDOW)
{
handle_net_restack_window (display, event);
}
@@ -2842,9 +2860,9 @@ set_wm_state_on_xwindow (MetaDisplay *display,
data[1] = None;
meta_error_trap_push (display);
- XChangeProperty (display->xdisplay, xwindow,
- display->atom_WM_STATE,
- display->atom_WM_STATE,
+ XChangeProperty (display->x11_display->xdisplay, xwindow,
+ display->x11_display->atom_WM_STATE,
+ display->x11_display->atom_WM_STATE,
32, PropModeReplace, (guchar*) data, 2);
meta_error_trap_pop (display);
}
@@ -2900,7 +2918,8 @@ maybe_filter_xwindow (MetaDisplay *display,
filtered = TRUE;
meta_error_trap_push (display);
- success = XGetClassHint (display->xdisplay, xwindow, &class_hint);
+ success = XGetClassHint (display->x11_display->xdisplay,
+ xwindow, &class_hint);
if (success)
{
@@ -2930,8 +2949,8 @@ maybe_filter_xwindow (MetaDisplay *display,
uint32_t old_state;
if (!meta_prop_get_cardinal_with_atom_type (display, xwindow,
- display->atom_WM_STATE,
- display->atom_WM_STATE,
+ display->x11_display->atom_WM_STATE,
+ display->x11_display->atom_WM_STATE,
&old_state))
old_state = WithdrawnState;
@@ -2940,7 +2959,7 @@ maybe_filter_xwindow (MetaDisplay *display,
}
/* Make sure filtered windows are hidden from view */
- XUnmapWindow (display->xdisplay, xwindow);
+ XUnmapWindow (display->x11_display->xdisplay, xwindow);
}
meta_error_trap_pop (display);
@@ -3010,6 +3029,7 @@ meta_window_x11_new (MetaDisplay *display,
gboolean must_be_viewable,
MetaCompEffect effect)
{
+ MetaX11Display *x11_display = display->x11_display;
MetaScreen *screen = display->screen;
XWindowAttributes attrs;
gulong existing_wm_state;
@@ -3034,14 +3054,14 @@ meta_window_x11_new (MetaDisplay *display,
* so we must be careful with X error handling.
*/
- if (!XGetWindowAttributes (display->xdisplay, xwindow, &attrs))
+ if (!XGetWindowAttributes (x11_display->xdisplay, xwindow, &attrs))
{
meta_verbose ("Failed to get attributes for window 0x%lx\n",
xwindow);
goto error;
}
- if (attrs.root != screen->xroot)
+ if (attrs.root != x11_display->xroot)
{
meta_verbose ("Not on our screen\n");
goto error;
@@ -3073,8 +3093,8 @@ meta_window_x11_new (MetaDisplay *display,
/* WM_STATE isn't a cardinal, it's type WM_STATE, but is an int */
if (!(meta_prop_get_cardinal_with_atom_type (display, xwindow,
- display->atom_WM_STATE,
- display->atom_WM_STATE,
+ x11_display->atom_WM_STATE,
+ x11_display->atom_WM_STATE,
&state) &&
(state == IconicState || state == NormalState)))
{
@@ -3094,7 +3114,7 @@ meta_window_x11_new (MetaDisplay *display,
* want this call failing to prevent the window from being managed, we
* call this before creating the return-checked error trap.
*/
- XAddToSaveSet (display->xdisplay, xwindow);
+ XAddToSaveSet (x11_display->xdisplay, xwindow);
meta_error_trap_push (display);
@@ -3106,7 +3126,7 @@ meta_window_x11_new (MetaDisplay *display,
* the event mask, not replace it. For windows from other clients,
* attrs.your_event_mask will be empty at this point.
*/
- XSelectInput (display->xdisplay, xwindow, attrs.your_event_mask | event_mask);
+ XSelectInput (x11_display->xdisplay, xwindow, attrs.your_event_mask | event_mask);
{
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
@@ -3117,15 +3137,15 @@ meta_window_x11_new (MetaDisplay *display,
XISetMask (mask.mask, XI_FocusIn);
XISetMask (mask.mask, XI_FocusOut);
- XISelectEvents (display->xdisplay, xwindow, &mask, 1);
+ XISelectEvents (x11_display->xdisplay, xwindow, &mask, 1);
}
if (META_DISPLAY_HAS_SHAPE (display))
- XShapeSelectInput (display->xdisplay, xwindow, ShapeNotifyMask);
+ XShapeSelectInput (x11_display->xdisplay, xwindow, ShapeNotifyMask);
/* Get rid of any borders */
if (attrs.border_width != 0)
- XSetWindowBorderWidth (display->xdisplay, xwindow, 0);
+ XSetWindowBorderWidth (x11_display->xdisplay, xwindow, 0);
/* Get rid of weird gravities */
if (attrs.win_gravity != NorthWestGravity)
@@ -3134,7 +3154,7 @@ meta_window_x11_new (MetaDisplay *display,
set_attrs.win_gravity = NorthWestGravity;
- XChangeWindowAttributes (display->xdisplay,
+ XChangeWindowAttributes (x11_display->xdisplay,
xwindow,
CWWinGravity,
&set_attrs);
@@ -3179,42 +3199,43 @@ error:
void
meta_window_x11_recalc_window_type (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
MetaWindowType type;
if (priv->type_atom != None)
{
- if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP)
+ if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_DESKTOP)
type = META_WINDOW_DESKTOP;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DOCK)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_DOCK)
type = META_WINDOW_DOCK;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_TOOLBAR)
type = META_WINDOW_TOOLBAR;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_MENU)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_MENU)
type = META_WINDOW_MENU;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_UTILITY)
type = META_WINDOW_UTILITY;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_SPLASH)
type = META_WINDOW_SPLASHSCREEN;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_DIALOG)
type = META_WINDOW_DIALOG;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_NORMAL)
type = META_WINDOW_NORMAL;
/* The below are *typically* override-redirect windows, but the spec does
* not disallow using them for managed windows.
*/
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
type = META_WINDOW_DROPDOWN_MENU;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU)
type = META_WINDOW_POPUP_MENU;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_TOOLTIP)
type = META_WINDOW_TOOLTIP;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION)
type = META_WINDOW_NOTIFICATION;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_COMBO)
type = META_WINDOW_COMBO;
- else if (priv->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND)
+ else if (priv->type_atom == x11_display->atom__NET_WM_WINDOW_TYPE_DND)
type = META_WINDOW_DND;
else
{
@@ -3226,7 +3247,7 @@ meta_window_x11_recalc_window_type (MetaWindow *window)
type = META_WINDOW_NORMAL;
meta_error_trap_push (window->display);
- atom_name = XGetAtomName (window->display->xdisplay,
+ atom_name = XGetAtomName (x11_display->xdisplay,
priv->type_atom);
meta_error_trap_pop (window->display);
@@ -3331,6 +3352,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
void
meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
#define MAX_N_ACTIONS 12
unsigned long data[MAX_N_ACTIONS];
int i;
@@ -3338,27 +3360,27 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
i = 0;
if (window->has_move_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_MOVE;
+ data[i] = x11_display->atom__NET_WM_ACTION_MOVE;
++i;
}
if (window->has_resize_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_RESIZE;
+ data[i] = x11_display->atom__NET_WM_ACTION_RESIZE;
++i;
}
if (window->has_fullscreen_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_FULLSCREEN;
+ data[i] = x11_display->atom__NET_WM_ACTION_FULLSCREEN;
++i;
}
if (window->has_minimize_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_MINIMIZE;
+ data[i] = x11_display->atom__NET_WM_ACTION_MINIMIZE;
++i;
}
if (window->has_shade_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_SHADE;
+ data[i] = x11_display->atom__NET_WM_ACTION_SHADE;
++i;
}
/* sticky according to EWMH is different from mutter's sticky;
@@ -3366,24 +3388,24 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
*/
if (window->has_maximize_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_HORZ;
+ data[i] = x11_display->atom__NET_WM_ACTION_MAXIMIZE_HORZ;
++i;
- data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_VERT;
+ data[i] = x11_display->atom__NET_WM_ACTION_MAXIMIZE_VERT;
++i;
}
/* We always allow this */
- data[i] = window->display->atom__NET_WM_ACTION_CHANGE_DESKTOP;
+ data[i] = x11_display->atom__NET_WM_ACTION_CHANGE_DESKTOP;
++i;
if (window->has_close_func)
{
- data[i] = window->display->atom__NET_WM_ACTION_CLOSE;
+ data[i] = x11_display->atom__NET_WM_ACTION_CLOSE;
++i;
}
/* I guess we always allow above/below operations */
- data[i] = window->display->atom__NET_WM_ACTION_ABOVE;
+ data[i] = x11_display->atom__NET_WM_ACTION_ABOVE;
++i;
- data[i] = window->display->atom__NET_WM_ACTION_BELOW;
+ data[i] = x11_display->atom__NET_WM_ACTION_BELOW;
++i;
g_assert (i <= MAX_N_ACTIONS);
@@ -3391,8 +3413,8 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
meta_verbose ("Setting _NET_WM_ALLOWED_ACTIONS with %d atoms\n", i);
meta_error_trap_push (window->display);
- XChangeProperty (window->display->xdisplay, window->xwindow,
- window->display->atom__NET_WM_ALLOWED_ACTIONS,
+ XChangeProperty (x11_display->xdisplay, window->xwindow,
+ x11_display->atom__NET_WM_ALLOWED_ACTIONS,
XA_ATOM,
32, PropModeReplace, (guchar*) data, i);
meta_error_trap_pop (window->display);
@@ -3402,6 +3424,7 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
void
meta_window_x11_create_sync_request_alarm (MetaWindow *window)
{
+ MetaX11Display *x11_display = window->display->x11_display;
XSyncAlarmAttributes values;
XSyncValue init;
@@ -3417,7 +3440,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
*/
if (window->extended_sync_request_counter)
{
- if (!XSyncQueryCounter(window->display->xdisplay,
+ if (!XSyncQueryCounter(x11_display->xdisplay,
window->sync_request_counter,
&init))
{
@@ -3432,7 +3455,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
else
{
XSyncIntToValue (&init, 0);
- XSyncSetCounter (window->display->xdisplay,
+ XSyncSetCounter (x11_display->xdisplay,
window->sync_request_counter, init);
window->sync_request_serial = 0;
}
@@ -3451,7 +3474,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
/* we want events (on by default anyway) */
values.events = True;
- window->sync_request_alarm = XSyncCreateAlarm (window->display->xdisplay,
+ window->sync_request_alarm = XSyncCreateAlarm (x11_display->xdisplay,
XSyncCACounter |
XSyncCAValueType |
XSyncCAValue |
@@ -3476,7 +3499,7 @@ meta_window_x11_destroy_sync_request_alarm (MetaWindow *window)
{
/* Has to be unregistered _before_ clearing the structure field */
meta_display_unregister_sync_alarm (window->display, window->sync_request_alarm);
- XSyncDestroyAlarm (window->display->xdisplay,
+ XSyncDestroyAlarm (window->display->x11_display->xdisplay,
window->sync_request_alarm);
window->sync_request_alarm = None;
}
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index cffa5958a..816838d49 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -89,6 +89,7 @@ from The Open Group.
#include "ui.h"
#include "mutter-Xatomtype.h"
#include "window-private.h"
+#include "x11/meta-x11-display-private.h"
#include <X11/Xatom.h>
#include <X11/Xlib-xcb.h>
@@ -111,6 +112,7 @@ validate_or_free_results (GetPropertyResults *results,
Atom expected_type,
gboolean must_have_items)
{
+ MetaX11Display *x11_display = results->display->x11_display;
char *type_name;
char *expected_name;
char *prop_name;
@@ -125,9 +127,9 @@ validate_or_free_results (GetPropertyResults *results,
return TRUE;
meta_error_trap_push (results->display);
- type_name = XGetAtomName (results->display->xdisplay, results->type);
- expected_name = XGetAtomName (results->display->xdisplay, expected_type);
- prop_name = XGetAtomName (results->display->xdisplay, results->xatom);
+ type_name = XGetAtomName (x11_display->xdisplay, results->type);
+ expected_name = XGetAtomName (x11_display->xdisplay, expected_type);
+ prop_name = XGetAtomName (x11_display->xdisplay, results->xatom);
meta_error_trap_pop (results->display);
w = meta_display_lookup_x_window (results->display, results->xwindow);
@@ -232,7 +234,7 @@ get_property (MetaDisplay *display,
GetPropertyResults *results)
{
xcb_get_property_cookie_t cookie;
- xcb_connection_t *xcb_conn = XGetXCBConnection (display->xdisplay);
+ xcb_connection_t *xcb_conn = XGetXCBConnection (display->x11_display->xdisplay);
results->display = display;
results->xwindow = xwindow;
@@ -389,7 +391,7 @@ utf8_string_from_results (GetPropertyResults *results,
*str_p = NULL;
if (!validate_or_free_results (results, 8,
- results->display->atom_UTF8_STRING, FALSE))
+ results->display->x11_display->atom_UTF8_STRING, FALSE))
return FALSE;
if (results->n_items > 0 &&
@@ -397,7 +399,7 @@ utf8_string_from_results (GetPropertyResults *results,
{
char *name;
- name = XGetAtomName (results->display->xdisplay, results->xatom);
+ name = XGetAtomName (results->display->x11_display->xdisplay, results->xatom);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8\n",
name, results->xwindow);
meta_XFree (name);
@@ -430,7 +432,7 @@ utf8_list_from_results (GetPropertyResults *results,
*n_str_p = 0;
if (!validate_or_free_results (results, 8,
- results->display->atom_UTF8_STRING, FALSE))
+ results->display->x11_display->atom_UTF8_STRING, FALSE))
return FALSE;
/* I'm not sure this is right, but I'm guessing the
@@ -463,7 +465,7 @@ utf8_list_from_results (GetPropertyResults *results,
char *name;
meta_error_trap_push (results->display);
- name = XGetAtomName (results->display->xdisplay, results->xatom);
+ name = XGetAtomName (results->display->x11_display->xdisplay, results->xatom);
meta_error_trap_pop (results->display);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8 for item %d in the list\n",
name, results->xwindow, i);
@@ -503,7 +505,7 @@ meta_prop_get_utf8_list (MetaDisplay *display,
*str_p = NULL;
if (!get_property (display, xwindow, xatom,
- display->atom_UTF8_STRING,
+ display->x11_display->atom_UTF8_STRING,
&results))
return FALSE;
@@ -516,10 +518,12 @@ meta_prop_set_utf8_string_hint (MetaDisplay *display,
Atom atom,
const char *val)
{
+ MetaX11Display *x11_display = display->x11_display;
+
meta_error_trap_push (display);
- XChangeProperty (display->xdisplay,
+ XChangeProperty (x11_display->xdisplay,
xwindow, atom,
- display->atom_UTF8_STRING,
+ x11_display->atom_UTF8_STRING,
8, PropModeReplace, (guchar*) val, strlen (val));
meta_error_trap_pop (display);
}
@@ -668,7 +672,7 @@ text_property_from_results (GetPropertyResults *results,
tp.format = results->format;
tp.nitems = results->n_items;
- *utf8_str_p = text_property_to_utf8 (results->display->xdisplay, &tp);
+ *utf8_str_p = text_property_to_utf8 (results->display->x11_display->xdisplay, &tp);
if (tp.value != NULL)
XFree (tp.value);
@@ -859,7 +863,7 @@ meta_prop_get_values (MetaDisplay *display,
{
int i;
xcb_get_property_cookie_t *tasks;
- xcb_connection_t *xcb_conn = XGetXCBConnection (display->xdisplay);
+ xcb_connection_t *xcb_conn = XGetXCBConnection (display->x11_display->xdisplay);
meta_verbose ("Requesting %d properties of 0x%lx at once\n",
n_values, xwindow);
@@ -888,7 +892,7 @@ meta_prop_get_values (MetaDisplay *display,
break;
case META_PROP_VALUE_UTF8_LIST:
case META_PROP_VALUE_UTF8:
- values[i].required_type = display->atom_UTF8_STRING;
+ values[i].required_type = display->x11_display->atom_UTF8_STRING;
break;
case META_PROP_VALUE_STRING:
case META_PROP_VALUE_STRING_AS_UTF8:
@@ -934,7 +938,7 @@ meta_prop_get_values (MetaDisplay *display,
/* Get replies for all our tasks */
meta_topic (META_DEBUG_SYNC, "Syncing to get %d GetProperty replies in %s\n",
n_values, G_STRFUNC);
- XSync (display->xdisplay, False);
+ XSync (display->x11_display->xdisplay, False);
/* Collect results, should arrive in order requested */
i = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]