[mutter/wip/wayland-stacking: 6/7] adapt to runtime control over display server mode
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-stacking: 6/7] adapt to runtime control over display server mode
- Date: Fri, 3 May 2013 14:47:21 +0000 (UTC)
commit 47272df66acf84a0b109f59ff50467c29de421d0
Author: Robert Bragg <robert linux intel com>
Date: Fri May 3 02:23:52 2013 +0100
adapt to runtime control over display server mode
Instead of relying on #ifdef HAVE_WAYLAND guards everywhere to handle
the different modes of running Mutter we now check the status of
meta_is_display_server() at runtime.
Note: this is only a partial adaptation currently, in particular
meta-shaped-texture.c currently still depends on compile time guards
since we conditionally subclass ClutterWaylandSurface currently which
isn't conducive to being handled at runtime.
src/compositor/compositor-private.h | 2 -
src/compositor/compositor.c | 368 ++++++++++++++--------------
src/compositor/meta-window-actor-private.h | 8 -
src/compositor/meta-window-actor.c | 337 ++++++++++++--------------
src/core/display.c | 36 ++--
src/core/main.c | 48 ++--
src/core/screen.c | 25 +-
7 files changed, 394 insertions(+), 430 deletions(-)
---
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index a5948c7..acb8d3c 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -49,9 +49,7 @@ struct _MetaCompScreen
/* Used for unredirecting fullscreen windows */
guint disable_unredirect_count;
-#ifndef HAVE_WAYLAND
MetaWindowActor *unredirected_window;
-#endif
/* Before we create the output window */
XserverRegion pending_input_region;
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index e38d320..eeedb55 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -163,7 +163,6 @@ add_win (MetaWindow *window)
sync_actor_stacking (info);
}
-#ifndef HAVE_WAYLAND
static void
process_damage (MetaCompositor *compositor,
XDamageNotifyEvent *event,
@@ -180,7 +179,6 @@ process_damage (MetaCompositor *compositor,
meta_window_actor_process_damage (window_actor, event);
}
-#endif
static void
process_property_notify (MetaCompositor *compositor,
@@ -207,7 +205,6 @@ process_property_notify (MetaCompositor *compositor,
DEBUG_TRACE ("process_property_notify: unknown\n");
}
-#ifndef HAVE_WAYLAND
static Window
get_output_window (MetaScreen *screen)
{
@@ -243,7 +240,6 @@ get_output_window (MetaScreen *screen)
return output;
}
-#endif /* HAVE_WAYLAND */
/**
* meta_get_stage_for_screen:
@@ -330,7 +326,6 @@ meta_get_window_actors (MetaScreen *screen)
return info->windows;
}
-#ifndef HAVE_WAYLAND
static void
do_set_stage_input_region (MetaScreen *screen,
XserverRegion region)
@@ -349,7 +344,6 @@ do_set_stage_input_region (MetaScreen *screen,
meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
XFixesSetWindowShapeRegion (xdpy, info->output, ShapeInput, 0, 0, region);
}
-#endif
void
meta_set_stage_input_region (MetaScreen *screen,
@@ -360,31 +354,32 @@ meta_set_stage_input_region (MetaScreen *screen,
* clutter since all input comes to us first and we get to choose
* who else see it.
*/
-#ifndef HAVE_WAYLAND
- MetaCompScreen *info = meta_screen_get_compositor_data (screen);
- MetaDisplay *display = meta_screen_get_display (screen);
- Display *xdpy = meta_display_get_xdisplay (display);
-
- if (info->stage && info->output)
- {
- do_set_stage_input_region (screen, region);
- }
- else
+ if (!meta_is_display_server ())
{
- /* Reset info->pending_input_region if one existed before and set the new
- * one to use it later. */
- if (info->pending_input_region)
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdpy = meta_display_get_xdisplay (display);
+
+ if (info->stage && info->output)
{
- XFixesDestroyRegion (xdpy, info->pending_input_region);
- info->pending_input_region = None;
+ do_set_stage_input_region (screen, region);
}
- if (region != None)
+ else
{
- info->pending_input_region = XFixesCreateRegion (xdpy, NULL, 0);
- XFixesCopyRegion (xdpy, info->pending_input_region, region);
- }
- }
-#endif
+ /* Reset info->pending_input_region if one existed before and set the new
+ * one to use it later. */
+ if (info->pending_input_region)
+ {
+ XFixesDestroyRegion (xdpy, info->pending_input_region);
+ info->pending_input_region = None;
+ }
+ if (region != None)
+ {
+ info->pending_input_region = XFixesCreateRegion (xdpy, NULL, 0);
+ XFixesCopyRegion (xdpy, info->pending_input_region, region);
+ }
+ }
+ }
}
void
@@ -546,7 +541,6 @@ after_stage_paint (gpointer data)
return TRUE;
}
-#ifndef HAVE_WAYLAND
static void
redirect_windows (MetaCompositor *compositor,
MetaScreen *screen)
@@ -595,19 +589,17 @@ redirect_windows (MetaCompositor *compositor,
g_usleep (G_USEC_PER_SEC);
}
}
-#endif
void
meta_compositor_manage_screen (MetaCompositor *compositor,
MetaScreen *screen)
{
MetaCompScreen *info;
-#ifndef HAVE_WAYLAND
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
Window xwin;
gint width, height;
-#else
+#ifdef HAVE_WAYLAND
MetaWaylandCompositor *wayland_compositor;
#endif
@@ -622,13 +614,14 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
* We have to initialize info->pending_input_region to an empty region explicitly,
* because None value is used to mean that the whole screen is an input region.
*/
-#ifndef HAVE_WAYLAND
- info->pending_input_region = XFixesCreateRegion (xdisplay, NULL, 0);
-#else
- /* Stage input region trickery isn't needed when we're running as a
- * wayland compositor. */
- info->pending_input_region = None;
-#endif
+ if (!meta_is_display_server ())
+ info->pending_input_region = XFixesCreateRegion (xdisplay, NULL, 0);
+ else
+ {
+ /* Stage input region trickery isn't needed when we're running as a
+ * wayland compositor. */
+ info->pending_input_region = None;
+ }
info->screen = screen;
@@ -642,50 +635,55 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
/* We will have already created a stage if running as a wayland
* compositor... */
#ifdef HAVE_WAYLAND
- wayland_compositor = meta_wayland_compositor_get_default ();
- info->stage = wayland_compositor->stage;
-#else
- info->stage = clutter_stage_new ();
-
- clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_POST_PAINT,
- after_stage_paint,
- info, NULL);
-
- clutter_stage_set_sync_delay (CLUTTER_STAGE (info->stage), META_SYNC_DELAY);
-
- meta_screen_get_size (screen, &width, &height);
- clutter_actor_realize (info->stage);
-
- xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+ if (meta_is_display_server ())
+ {
+ wayland_compositor = meta_wayland_compositor_get_default ();
+ info->stage = wayland_compositor->stage;
+ }
+ else
+#endif /* HAVE_WAYLAND */
+ {
+ info->stage = clutter_stage_new ();
- XResizeWindow (xdisplay, xwin, width, height);
+ clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_POST_PAINT,
+ after_stage_paint,
+ info, NULL);
- {
- long event_mask;
- unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
- XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
- XWindowAttributes attr;
+ clutter_stage_set_sync_delay (CLUTTER_STAGE (info->stage), META_SYNC_DELAY);
- meta_core_add_old_event_mask (xdisplay, xwin, &mask);
+ meta_screen_get_size (screen, &width, &height);
+ clutter_actor_realize (info->stage);
- XISetMask (mask.mask, XI_KeyPress);
- XISetMask (mask.mask, XI_KeyRelease);
- XISetMask (mask.mask, XI_ButtonPress);
- XISetMask (mask.mask, XI_ButtonRelease);
- XISetMask (mask.mask, XI_Enter);
- XISetMask (mask.mask, XI_Leave);
- XISetMask (mask.mask, XI_FocusIn);
- XISetMask (mask.mask, XI_FocusOut);
- XISetMask (mask.mask, XI_Motion);
- XISelectEvents (xdisplay, xwin, &mask, 1);
+ xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
- event_mask = ExposureMask | PropertyChangeMask | StructureNotifyMask;
- if (XGetWindowAttributes (xdisplay, xwin, &attr))
- event_mask |= attr.your_event_mask;
+ XResizeWindow (xdisplay, xwin, width, height);
- XSelectInput (xdisplay, xwin, event_mask);
- }
-#endif /* HAVE_WAYLAND */
+ {
+ long event_mask;
+ unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+ XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
+ XWindowAttributes attr;
+
+ meta_core_add_old_event_mask (xdisplay, xwin, &mask);
+
+ XISetMask (mask.mask, XI_KeyPress);
+ XISetMask (mask.mask, XI_KeyRelease);
+ XISetMask (mask.mask, XI_ButtonPress);
+ XISetMask (mask.mask, XI_ButtonRelease);
+ XISetMask (mask.mask, XI_Enter);
+ XISetMask (mask.mask, XI_Leave);
+ XISetMask (mask.mask, XI_FocusIn);
+ XISetMask (mask.mask, XI_FocusOut);
+ XISetMask (mask.mask, XI_Motion);
+ XISelectEvents (xdisplay, xwin, &mask, 1);
+
+ event_mask = ExposureMask | PropertyChangeMask | StructureNotifyMask;
+ if (XGetWindowAttributes (xdisplay, xwin, &attr))
+ event_mask |= attr.your_event_mask;
+
+ XSelectInput (xdisplay, xwin, event_mask);
+ }
+ }
info->window_group = meta_window_group_new (screen);
info->top_window_group = meta_window_group_new (screen);
@@ -697,50 +695,49 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
info->plugin_mgr = meta_plugin_manager_new (screen);
-#ifndef HAVE_WAYLAND
-
- /*
- * Delay the creation of the overlay window as long as we can, to avoid
- * blanking out the screen. This means that during the plugin loading, the
- * overlay window is not accessible; if the plugin needs to access it
- * directly, it should hook into the "show" signal on stage, and do
- * its stuff there.
- */
- info->output = get_output_window (screen);
- XReparentWindow (xdisplay, xwin, info->output, 0, 0);
-
- /* Make sure there isn't any left-over output shape on the
- * overlay window by setting the whole screen to be an
- * output region.
- *
- * Note: there doesn't seem to be any real chance of that
- * because the X server will destroy the overlay window
- * when the last client using it exits.
- */
- XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
-
- do_set_stage_input_region (screen, info->pending_input_region);
- if (info->pending_input_region != None)
+ if (meta_is_display_server ())
{
- XFixesDestroyRegion (xdisplay, info->pending_input_region);
- info->pending_input_region = None;
+ /* NB: When running as a wayland compositor we don't need an X
+ * composite overlay window, and we don't need to play any input
+ * region tricks to redirect events into clutter. */
+ info->output = None;
}
+ else
+ {
+ /*
+ * Delay the creation of the overlay window as long as we can, to avoid
+ * blanking out the screen. This means that during the plugin loading, the
+ * overlay window is not accessible; if the plugin needs to access it
+ * directly, it should hook into the "show" signal on stage, and do
+ * its stuff there.
+ */
+ info->output = get_output_window (screen);
+ XReparentWindow (xdisplay, xwin, info->output, 0, 0);
+
+ /* Make sure there isn't any left-over output shape on the
+ * overlay window by setting the whole screen to be an
+ * output region.
+ *
+ * Note: there doesn't seem to be any real chance of that
+ * because the X server will destroy the overlay window
+ * when the last client using it exits.
+ */
+ XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
- /* Map overlay window before redirecting windows offscreen so we catch their
- * contents until we show the stage.
- */
- XMapWindow (xdisplay, info->output);
-
- redirect_windows (compositor, screen);
-
-#else /* HAVE_WAYLAND */
+ do_set_stage_input_region (screen, info->pending_input_region);
+ if (info->pending_input_region != None)
+ {
+ XFixesDestroyRegion (xdisplay, info->pending_input_region);
+ info->pending_input_region = None;
+ }
- /* NB: When running as a wayland compositor we don't need an X composite
- * overlay window, and we don't need to play any input region tricks
- * to redirect events into clutter. */
- info->output = None;
+ /* Map overlay window before redirecting windows offscreen so we catch their
+ * contents until we show the stage.
+ */
+ XMapWindow (xdisplay, info->output);
-#endif /* HAVE_WAYLAND */
+ redirect_windows (compositor, screen);
+ }
clutter_actor_show (info->overlay_group);
}
@@ -749,19 +746,19 @@ void
meta_compositor_unmanage_screen (MetaCompositor *compositor,
MetaScreen *screen)
{
-#ifndef HAVE_WAYLAND
- MetaDisplay *display = meta_screen_get_display (screen);
- Display *xdisplay = meta_display_get_xdisplay (display);
- Window xroot = meta_screen_get_xroot (screen);
-
- /* This is the most important part of cleanup - we have to do this
- * before giving up the window manager selection or the next
- * window manager won't be able to redirect subwindows */
- XCompositeUnredirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
-#endif
+ if (!meta_is_display_server ())
+ {
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ Window xroot = meta_screen_get_xroot (screen);
+
+ /* This is the most important part of cleanup - we have to do this
+ * before giving up the window manager selection or the next
+ * window manager won't be able to redirect subwindows */
+ XCompositeUnredirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
+ }
}
-#ifndef HAVE_WAYLAND
/*
* Shapes the cow so that the given window is exposed,
* when metaWindow is NULL it clears the shape again
@@ -802,7 +799,6 @@ meta_shape_cow_for_window (MetaScreen *screen,
XFixesDestroyRegion (xdisplay, output_region);
}
}
-#endif
void
meta_compositor_add_window (MetaCompositor *compositor,
@@ -824,28 +820,27 @@ meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = NULL;
-#ifndef HAVE_WAYLAND
MetaScreen *screen;
MetaCompScreen *info;
-#endif
DEBUG_TRACE ("meta_compositor_remove_window\n");
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
-#ifndef HAVE_WAYLAND
- screen = meta_window_get_screen (window);
- info = meta_screen_get_compositor_data (screen);
-
- if (window_actor == info->unredirected_window)
+ if (!meta_is_display_server ())
{
- meta_window_actor_set_redirected (window_actor, TRUE);
- meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window
(info->unredirected_window)),
- NULL);
- info->unredirected_window = NULL;
+ screen = meta_window_get_screen (window);
+ info = meta_screen_get_compositor_data (screen);
+
+ if (window_actor == info->unredirected_window)
+ {
+ meta_window_actor_set_redirected (window_actor, TRUE);
+ meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window
(info->unredirected_window)),
+ NULL);
+ info->unredirected_window = NULL;
+ }
}
-#endif
meta_window_actor_destroy (window_actor);
}
@@ -1031,8 +1026,8 @@ meta_compositor_process_event (MetaCompositor *compositor,
break;
default:
-#ifndef HAVE_WAYLAND
- if (event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
+ if (!meta_is_display_server () &&
+ event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
{
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
* ourselves
@@ -1046,16 +1041,13 @@ meta_compositor_process_event (MetaCompositor *compositor,
DEBUG_TRACE ("meta_compositor_process_event (process_damage)\n");
process_damage (compositor, (XDamageNotifyEvent *) event, window);
}
-#endif
break;
}
-#ifndef HAVE_WAYLAND
/* Clutter needs to know about MapNotify events otherwise it will
think the stage is invisible */
- if (event->type == MapNotify)
+ if (!meta_is_display_server () && event->type == MapNotify)
clutter_x11_handle_event (event);
-#endif
/* The above handling is basically just "observing" the events, so we return
* FALSE to indicate that the event should not be filtered out; if we have
@@ -1396,30 +1388,33 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor,
guint width,
guint height)
{
-#ifndef HAVE_WAYLAND
- MetaDisplay *display = meta_screen_get_display (screen);
- MetaCompScreen *info = meta_screen_get_compositor_data (screen);
- Display *xdisplay;
- Window xwin;
+ if (meta_is_display_server ())
+ {
+ /* It's not clear at the moment how we will be dealing with screen
+ * resizing as a Wayland compositor so for now just abort if we
+ * hit this code. */
+ g_critical ("Unexpected call to meta_compositor_sync_screen_size() "
+ "when running as a wayland compositor");
+ }
+ else
+ {
+ MetaDisplay *display = meta_screen_get_display (screen);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ Display *xdisplay;
+ Window xwin;
- DEBUG_TRACE ("meta_compositor_sync_screen_size\n");
- g_return_if_fail (info);
+ DEBUG_TRACE ("meta_compositor_sync_screen_size\n");
+ g_return_if_fail (info);
- xdisplay = meta_display_get_xdisplay (display);
- xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+ xdisplay = meta_display_get_xdisplay (display);
+ xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
- XResizeWindow (xdisplay, xwin, width, height);
+ XResizeWindow (xdisplay, xwin, width, height);
- meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
- meta_screen_get_screen_number (screen),
- width, height);
-#else
- /* It's not clear at the moment how we will be dealing with screen
- * resizing as a Wayland compositor so for now just abort if we
- * hit this code. */
- g_critical ("Unexpected call to meta_compositor_sync_screen_size() "
- "when running as a wayland compositor");
-#endif
+ meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
+ meta_screen_get_screen_number (screen),
+ width, height);
+ }
}
static void
@@ -1468,10 +1463,8 @@ static void
pre_paint_windows (MetaCompScreen *info)
{
GList *l;
-#ifndef HAVE_WAYLAND
MetaWindowActor *top_window;
MetaWindowActor *expected_unredirected_window = NULL;
-#endif
if (info->onscreen == NULL)
{
@@ -1485,32 +1478,33 @@ pre_paint_windows (MetaCompScreen *info)
if (info->windows == NULL)
return;
-#ifndef HAVE_WAYLAND
- top_window = g_list_last (info->windows)->data;
+ if (!meta_is_display_server ())
+ {
+ top_window = g_list_last (info->windows)->data;
- if (meta_window_actor_should_unredirect (top_window) &&
- info->disable_unredirect_count == 0)
- expected_unredirected_window = top_window;
+ if (meta_window_actor_should_unredirect (top_window) &&
+ info->disable_unredirect_count == 0)
+ expected_unredirected_window = top_window;
- if (info->unredirected_window != expected_unredirected_window)
- {
- if (info->unredirected_window != NULL)
+ if (info->unredirected_window != expected_unredirected_window)
{
- meta_window_actor_set_redirected (info->unredirected_window, TRUE);
- meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window
(info->unredirected_window)),
- NULL);
- }
+ if (info->unredirected_window != NULL)
+ {
+ meta_window_actor_set_redirected (info->unredirected_window, TRUE);
+ meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window
(info->unredirected_window)),
+ NULL);
+ }
- if (expected_unredirected_window != NULL)
- {
- meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (top_window)),
- meta_window_actor_get_meta_window (top_window));
- meta_window_actor_set_redirected (top_window, FALSE);
- }
+ if (expected_unredirected_window != NULL)
+ {
+ meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window
(top_window)),
+ meta_window_actor_get_meta_window (top_window));
+ meta_window_actor_set_redirected (top_window, FALSE);
+ }
- info->unredirected_window = expected_unredirected_window;
+ info->unredirected_window = expected_unredirected_window;
+ }
}
-#endif
for (l = info->windows; l; l = l->next)
meta_window_actor_pre_paint (l->data);
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 73943df..38070c1 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -8,10 +8,6 @@
#include <X11/extensions/Xdamage.h>
#include <meta/compositor-mutter.h>
-#ifdef HAVE_WAYLAND
-#include <wayland-server.h>
-#endif
-
MetaWindowActor *meta_window_actor_new (MetaWindow *window);
void meta_window_actor_destroy (MetaWindowActor *self);
@@ -28,10 +24,8 @@ void meta_window_actor_unmaximize (MetaWindowActor *self,
MetaRectangle *old_rect,
MetaRectangle *new_rect);
-#ifndef HAVE_WAYLAND
void meta_window_actor_process_damage (MetaWindowActor *self,
XDamageNotifyEvent *event);
-#endif
void meta_window_actor_pre_paint (MetaWindowActor *self);
void meta_window_actor_post_paint (MetaWindowActor *self);
@@ -41,9 +35,7 @@ void meta_window_actor_frame_complete (MetaWindowActor *self,
void meta_window_actor_invalidate_shadow (MetaWindowActor *self);
-#ifndef HAVE_WAYLAND
void meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state);
-#endif
gboolean meta_window_actor_should_unredirect (MetaWindowActor *self);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index cf7c07c..5605e27 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -68,11 +68,9 @@ struct _MetaWindowActorPrivate
MetaShadow *focused_shadow;
MetaShadow *unfocused_shadow;
-#ifndef HAVE_WAYLAND
- Pixmap back_pixmap;
+ Pixmap back_pixmap; /* Not used in display server mode */
- Damage damage;
-#endif
+ Damage damage; /* Not used in display server mode */
guint8 opacity;
guint8 shadow_opacity;
@@ -119,12 +117,10 @@ struct _MetaWindowActorPrivate
guint disposed : 1;
guint redecorating : 1;
-#ifndef HAVE_WAYLAND
- guint needs_damage_all : 1;
- guint received_damage : 1;
+ guint needs_damage_all : 1; /* Not used in display server mode */
+ guint received_damage : 1; /* Not used in display server mode */
- guint needs_pixmap : 1;
-#endif
+ guint needs_pixmap : 1; /* Not used in display server mode */
/* If set, the client needs to be sent a _NET_WM_FRAME_DRAWN
* client message using the most recent frame in ->frames */
@@ -134,23 +130,21 @@ struct _MetaWindowActorPrivate
guint needs_reshape : 1;
guint recompute_focused_shadow : 1;
guint recompute_unfocused_shadow : 1;
-#ifndef HAVE_WAYLAND
- guint size_changed : 1;
- guint updates_frozen : 1;
-#endif
+
+ guint size_changed : 1; /* Not used in display server mode */
+ guint updates_frozen : 1; /* Not used in display server mode */
guint needs_destroy : 1;
guint no_shadow : 1;
guint no_more_x_calls : 1;
-#ifndef HAVE_WAYLAND
- guint unredirected : 1;
+
+ guint unredirected : 1; /* Not used in display server mode */
/* This is used to detect fullscreen windows that need to be unredirected */
- guint full_damage_frames_count;
- guint does_full_damage : 1;
-#endif
+ guint full_damage_frames_count; /* Not used in display server mode */
+ guint does_full_damage : 1; /* Not used in display server mode */
};
typedef struct _FrameData FrameData;
@@ -189,9 +183,7 @@ static gboolean meta_window_actor_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume);
-#ifndef HAVE_WAYLAND
static void meta_window_actor_detach (MetaWindowActor *self);
-#endif
static gboolean meta_window_actor_has_shadow (MetaWindowActor *self);
static void meta_window_actor_handle_updates (MetaWindowActor *self);
@@ -309,11 +301,9 @@ window_decorated_notify (MetaWindow *mw,
MetaWindowActor *self = META_WINDOW_ACTOR (data);
MetaWindowActorPrivate *priv = self->priv;
MetaFrame *frame = meta_window_get_frame (mw);
-#ifndef HAVE_WAYLAND
MetaScreen *screen = priv->screen;
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
-#endif
Window new_xwindow;
/*
@@ -327,21 +317,22 @@ window_decorated_notify (MetaWindow *mw,
else
new_xwindow = meta_window_get_xwindow (mw);
-#ifndef HAVE_WAYLAND
- meta_window_actor_detach (self);
-
- /*
- * First of all, clean up any resources we are currently using and will
- * be replacing.
- */
- if (priv->damage != None)
+ if (!meta_is_display_server ())
{
- meta_error_trap_push (display);
- XDamageDestroy (xdisplay, priv->damage);
- meta_error_trap_pop (display);
- priv->damage = None;
+ meta_window_actor_detach (self);
+
+ /*
+ * First of all, clean up any resources we are currently using and will
+ * be replacing.
+ */
+ if (priv->damage != None)
+ {
+ meta_error_trap_push (display);
+ XDamageDestroy (xdisplay, priv->damage);
+ meta_error_trap_pop (display);
+ priv->damage = None;
+ }
}
-#endif
g_free (priv->desc);
priv->desc = NULL;
@@ -395,10 +386,9 @@ meta_window_actor_constructed (GObject *object)
Display *xdisplay = meta_display_get_xdisplay (display);
XRenderPictFormat *format;
-#ifndef HAVE_WAYLAND
- priv->damage = XDamageCreate (xdisplay, xwindow,
- XDamageReportBoundingBox);
-#endif
+ if (!meta_is_display_server ())
+ priv->damage = XDamageCreate (xdisplay, xwindow,
+ XDamageReportBoundingBox);
format = XRenderFindVisualFormat (xdisplay, window->xvisual);
@@ -430,8 +420,9 @@ meta_window_actor_constructed (GObject *object)
g_signal_connect (window, "notify::appears-focused",
G_CALLBACK (window_appears_focused_notify), self);
#ifdef HAVE_WAYLAND
- g_signal_connect (priv->actor, "notify::cogl-texture",
- G_CALLBACK (cogl_texture_notify), self);
+ if (meta_is_display_server ())
+ g_signal_connect (priv->actor, "notify::cogl-texture",
+ G_CALLBACK (cogl_texture_notify), self);
#endif
}
else
@@ -456,10 +447,8 @@ meta_window_actor_dispose (GObject *object)
MetaWindowActor *self = META_WINDOW_ACTOR (object);
MetaWindowActorPrivate *priv = self->priv;
MetaScreen *screen;
-#ifndef HAVE_WAYLAND
MetaDisplay *display;
Display *xdisplay;
-#endif
MetaCompScreen *info;
if (priv->disposed)
@@ -469,12 +458,14 @@ meta_window_actor_dispose (GObject *object)
screen = priv->screen;
info = meta_screen_get_compositor_data (screen);
-#ifndef HAVE_WAYLAND
- display = meta_screen_get_display (screen);
- xdisplay = meta_display_get_xdisplay (display);
- meta_window_actor_detach (self);
-#endif
+ if (!meta_is_display_server ())
+ {
+ display = meta_screen_get_display (screen);
+ xdisplay = meta_display_get_xdisplay (display);
+
+ meta_window_actor_detach (self);
+ }
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
g_clear_pointer (&priv->input_shape_region, cairo_region_destroy);
@@ -486,8 +477,7 @@ meta_window_actor_dispose (GObject *object)
g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
-#ifndef HAVE_WAYLAND
- if (priv->damage != None)
+ if (!meta_is_display_server () && priv->damage != None)
{
meta_error_trap_push (display);
XDamageDestroy (xdisplay, priv->damage);
@@ -495,7 +485,6 @@ meta_window_actor_dispose (GObject *object)
priv->damage = None;
}
-#endif
info->windows = g_list_remove (info->windows, (gconstpointer) self);
@@ -980,12 +969,10 @@ meta_window_actor_showing_on_its_workspace (MetaWindowActor *self)
static void
meta_window_actor_freeze (MetaWindowActor *self)
{
-#ifndef HAVE_WAYLAND
- self->priv->freeze_count++;
-#endif
+ if (!meta_is_display_server ())
+ self->priv->freeze_count++;
}
-#ifndef HAVE_WAYLAND
static void
meta_window_actor_damage_all (MetaWindowActor *self)
{
@@ -1008,37 +995,37 @@ meta_window_actor_damage_all (MetaWindowActor *self)
priv->needs_damage_all = FALSE;
priv->repaint_scheduled = TRUE;
}
-#endif
static void
meta_window_actor_thaw (MetaWindowActor *self)
{
-#ifndef HAVE_WAYLAND
- self->priv->freeze_count--;
-
- if (G_UNLIKELY (self->priv->freeze_count < 0))
+ if (!meta_is_display_server ())
{
- g_warning ("Error in freeze/thaw accounting.");
- self->priv->freeze_count = 0;
- return;
- }
+ self->priv->freeze_count--;
- if (self->priv->freeze_count)
- return;
+ if (G_UNLIKELY (self->priv->freeze_count < 0))
+ {
+ g_warning ("Error in freeze/thaw accounting.");
+ self->priv->freeze_count = 0;
+ return;
+ }
- /* We sometimes ignore moves and resizes on frozen windows */
- meta_window_actor_sync_actor_geometry (self, FALSE);
+ if (self->priv->freeze_count)
+ return;
- /* We do this now since we might be going right back into the
- * frozen state */
- meta_window_actor_handle_updates (self);
+ /* We sometimes ignore moves and resizes on frozen windows */
+ meta_window_actor_sync_actor_geometry (self, FALSE);
- /* Since we ignore damage events while a window is frozen for certain effects
- * we may need to issue an update_area() covering the whole pixmap if we
- * don't know what real damage has happened. */
- if (self->priv->needs_damage_all)
- meta_window_actor_damage_all (self);
-#endif
+ /* We do this now since we might be going right back into the
+ * frozen state */
+ meta_window_actor_handle_updates (self);
+
+ /* Since we ignore damage events while a window is frozen for certain effects
+ * we may need to issue an update_area() covering the whole pixmap if we
+ * don't know what real damage has happened. */
+ if (self->priv->needs_damage_all)
+ meta_window_actor_damage_all (self);
+ }
}
void
@@ -1069,11 +1056,7 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
* send a _NET_WM_FRAME_DRAWN. We do a 1-pixel redraw to get
* consistent timing with non-empty frames.
*/
- if (priv->mapped
-#ifndef HAVE_WAYLAND
- && !priv->needs_pixmap
-#endif
- )
+ if (priv->mapped && (!meta_is_display_server () || !priv->needs_pixmap))
{
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
clutter_actor_queue_redraw_with_clip (priv->actor, &clip);
@@ -1098,7 +1081,6 @@ is_frozen (MetaWindowActor *self)
return self->priv->freeze_count ? TRUE : FALSE;
}
-#ifndef HAVE_WAYLAND
static void
meta_window_actor_queue_create_pixmap (MetaWindowActor *self)
{
@@ -1122,7 +1104,6 @@ meta_window_actor_queue_create_pixmap (MetaWindowActor *self)
*/
clutter_actor_queue_redraw (priv->actor);
}
-#endif
static gboolean
is_freeze_thaw_effect (gulong event)
@@ -1205,13 +1186,14 @@ meta_window_actor_after_effects (MetaWindowActor *self)
meta_window_actor_sync_visibility (self);
meta_window_actor_sync_actor_geometry (self, FALSE);
-#ifndef HAVE_WAYLAND
- if (!meta_window_is_mapped (priv->window))
- meta_window_actor_detach (self);
+ if (!meta_is_display_server ())
+ {
+ if (!meta_window_is_mapped (priv->window))
+ meta_window_actor_detach (self);
- if (priv->needs_pixmap)
- clutter_actor_queue_redraw (priv->actor);
-#endif
+ if (priv->needs_pixmap)
+ clutter_actor_queue_redraw (priv->actor);
+ }
}
void
@@ -1286,7 +1268,6 @@ meta_window_actor_effect_completed (MetaWindowActor *self,
meta_window_actor_after_effects (self);
}
-#ifndef HAVE_WAYLAND
/* Called to drop our reference to a window backing pixmap that we
* previously obtained with XCompositeNameWindowPixmap. We do this
* when the window is unmapped or when we want to update to a new
@@ -1316,7 +1297,6 @@ meta_window_actor_detach (MetaWindowActor *self)
meta_window_actor_queue_create_pixmap (self);
}
-#endif /* HAVE_WAYLAND */
gboolean
meta_window_actor_should_unredirect (MetaWindowActor *self)
@@ -1345,15 +1325,12 @@ meta_window_actor_should_unredirect (MetaWindowActor *self)
if (meta_window_is_override_redirect (metaWindow))
return TRUE;
-#ifndef HAVE_WAYLAND
- if (priv->does_full_damage)
+ if (!meta_is_display_server () && priv->does_full_damage)
return TRUE;
-#endif
return FALSE;
}
-#ifndef HAVE_WAYLAND
void
meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state)
{
@@ -1379,7 +1356,6 @@ meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state)
self->priv->unredirected = TRUE;
}
}
-#endif
void
meta_window_actor_destroy (MetaWindowActor *self)
@@ -1453,10 +1429,12 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
if (priv->last_width != window_rect.width ||
priv->last_height != window_rect.height)
{
-#ifndef HAVE_WAYLAND
- priv->size_changed = TRUE;
- meta_window_actor_queue_create_pixmap (self);
-#endif
+ if (!meta_is_display_server ())
+ {
+ priv->size_changed = TRUE;
+ meta_window_actor_queue_create_pixmap (self);
+ }
+
meta_window_actor_update_shape (self);
priv->last_width = window_rect.width;
@@ -1654,23 +1632,24 @@ meta_window_actor_new (MetaWindow *window)
priv = self->priv;
-#ifndef HAVE_WAYLAND
- priv->last_width = -1;
- priv->last_height = -1;
+ if (!meta_is_display_server ())
+ {
+ priv->last_width = -1;
+ priv->last_height = -1;
- priv->mapped = meta_window_toplevel_is_mapped (priv->window);
- if (priv->mapped)
- meta_window_actor_queue_create_pixmap (self);
+ priv->mapped = meta_window_toplevel_is_mapped (priv->window);
+ if (priv->mapped)
+ meta_window_actor_queue_create_pixmap (self);
- meta_window_actor_set_updates_frozen (self,
- meta_window_updates_are_frozen (priv->window));
+ meta_window_actor_set_updates_frozen (self,
+ meta_window_updates_are_frozen (priv->window));
- /* If a window doesn't start off with updates frozen, we should
- * we should send a _NET_WM_FRAME_DRAWN immediately after the first drawn.
- */
- if (priv->window->extended_sync_request_counter && !priv->updates_frozen)
- meta_window_actor_queue_frame_drawn (self, FALSE);
-#endif
+ /* If a window doesn't start off with updates frozen, we should
+ * we should send a _NET_WM_FRAME_DRAWN immediately after the first drawn.
+ */
+ if (priv->window->extended_sync_request_counter && !priv->updates_frozen)
+ meta_window_actor_queue_frame_drawn (self, FALSE);
+ }
#warning "FIXME: need to figure out how to handle _FRAME_DRAWN equivalent for wayland"
meta_window_actor_sync_actor_geometry (self, priv->window->placed);
@@ -1706,9 +1685,8 @@ meta_window_actor_mapped (MetaWindowActor *self)
priv->mapped = TRUE;
-#ifndef HAVE_WAYLAND
- meta_window_actor_queue_create_pixmap (self);
-#endif
+ if (!meta_is_display_server ())
+ meta_window_actor_queue_create_pixmap (self);
}
void
@@ -1723,10 +1701,11 @@ meta_window_actor_unmapped (MetaWindowActor *self)
if (meta_window_actor_effect_in_progress (self))
return;
-#ifndef HAVE_WAYLAND
- meta_window_actor_detach (self);
- priv->needs_pixmap = FALSE;
-#endif
+ if (!meta_is_display_server ())
+ {
+ meta_window_actor_detach (self);
+ priv->needs_pixmap = FALSE;
+ }
}
/**
@@ -1744,15 +1723,18 @@ meta_window_actor_get_obscured_region (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
-#ifndef HAVE_WAYLAND
- if (priv->back_pixmap && priv->opacity == 0xff)
- return priv->opaque_region;
-#else
- if (priv->opacity == 0xff)
- return priv->opaque_region;
-#endif
+ if (meta_is_display_server ())
+ {
+ if (priv->opacity == 0xff)
+ return priv->opaque_region;
+ }
else
- return NULL;
+ {
+ if (priv->back_pixmap && priv->opacity == 0xff)
+ return priv->opaque_region;
+ }
+
+ return NULL;
}
#if 0
@@ -1868,7 +1850,6 @@ meta_window_actor_reset_visible_regions (MetaWindowActor *self)
/* When running as a wayland compositor we don't make requests for
* replacement pixmaps when resizing windows, we will instead be
* asked to attach replacement buffers by the clients. */
-#ifndef HAVE_WAYLAND
static void
check_needs_pixmap (MetaWindowActor *self)
{
@@ -1960,7 +1941,6 @@ check_needs_pixmap (MetaWindowActor *self)
out:
meta_error_trap_pop (display);
}
-#endif
static void
check_needs_shadow (MetaWindowActor *self)
@@ -2027,7 +2007,6 @@ check_needs_shadow (MetaWindowActor *self)
meta_shadow_unref (old_shadow);
}
-#ifndef HAVE_WAYLAND
void
meta_window_actor_process_damage (MetaWindowActor *self,
XDamageNotifyEvent *event)
@@ -2088,7 +2067,6 @@ meta_window_actor_process_damage (MetaWindowActor *self,
event->area.height);
priv->repaint_scheduled = TRUE;
}
-#endif
void
meta_window_actor_sync_visibility (MetaWindowActor *self)
@@ -2462,12 +2440,10 @@ meta_window_actor_update_shape (MetaWindowActor *self)
static void
meta_window_actor_handle_updates (MetaWindowActor *self)
{
-#ifndef HAVE_WAYLAND
MetaWindowActorPrivate *priv = self->priv;
MetaScreen *screen = priv->screen;
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
-#endif
if (is_frozen (self))
{
@@ -2476,44 +2452,46 @@ meta_window_actor_handle_updates (MetaWindowActor *self)
return;
}
-#ifndef HAVE_WAYLAND
- if (priv->unredirected)
+ if (!meta_is_display_server ())
{
- /* Nothing to do here until/if the window gets redirected again */
- return;
- }
+ if (priv->unredirected)
+ {
+ /* Nothing to do here until/if the window gets redirected again */
+ return;
+ }
- if (priv->received_damage)
- {
- meta_error_trap_push (display);
- XDamageSubtract (xdisplay, priv->damage, None, None);
- meta_error_trap_pop (display);
+ if (priv->received_damage)
+ {
+ meta_error_trap_push (display);
+ XDamageSubtract (xdisplay, priv->damage, None, None);
+ meta_error_trap_pop (display);
+
+ /* We need to make sure that any X drawing that happens before the
+ * XDamageSubtract() above is visible to subsequent GL rendering;
+ * the only standardized way to do this is EXT_x11_sync_object,
+ * which isn't yet widely available. For now, we count on details
+ * of Xorg and the open source drivers, and hope for the best
+ * otherwise.
+ *
+ * Xorg and open source driver specifics:
+ *
+ * The X server makes sure to flush drawing to the kernel before
+ * sending out damage events, but since we use DamageReportBoundingBox
+ * there may be drawing between the last damage event and the
+ * XDamageSubtract() that needs to be flushed as well.
+ *
+ * Xorg always makes sure that drawing is flushed to the kernel
+ * before writing events or responses to the client, so any round trip
+ * request at this point is sufficient to flush the GLX buffers.
+ */
+ XSync (xdisplay, False);
- /* We need to make sure that any X drawing that happens before the
- * XDamageSubtract() above is visible to subsequent GL rendering;
- * the only standardized way to do this is EXT_x11_sync_object,
- * which isn't yet widely available. For now, we count on details
- * of Xorg and the open source drivers, and hope for the best
- * otherwise.
- *
- * Xorg and open source driver specifics:
- *
- * The X server makes sure to flush drawing to the kernel before
- * sending out damage events, but since we use DamageReportBoundingBox
- * there may be drawing between the last damage event and the
- * XDamageSubtract() that needs to be flushed as well.
- *
- * Xorg always makes sure that drawing is flushed to the kernel
- * before writing events or responses to the client, so any round trip
- * request at this point is sufficient to flush the GLX buffers.
- */
- XSync (xdisplay, False);
+ priv->received_damage = FALSE;
+ }
- priv->received_damage = FALSE;
+ check_needs_pixmap (self);
}
- check_needs_pixmap (self);
-#endif
check_needs_reshape (self);
check_needs_shadow (self);
}
@@ -2693,18 +2671,19 @@ meta_window_actor_set_updates_frozen (MetaWindowActor *self,
gboolean updates_frozen)
{
/* On wayland we shouldn't need to ever freeze updates... */
-#ifndef HAVE_WAYLAND
- MetaWindowActorPrivate *priv = self->priv;
+ if (!meta_is_display_server ())
+ {
+ MetaWindowActorPrivate *priv = self->priv;
- updates_frozen = updates_frozen != FALSE;
+ updates_frozen = updates_frozen != FALSE;
- if (priv->updates_frozen != updates_frozen)
- {
- priv->updates_frozen = updates_frozen;
- if (updates_frozen)
- meta_window_actor_freeze (self);
- else
- meta_window_actor_thaw (self);
+ if (priv->updates_frozen != updates_frozen)
+ {
+ priv->updates_frozen = updates_frozen;
+ if (updates_frozen)
+ meta_window_actor_freeze (self);
+ else
+ meta_window_actor_thaw (self);
+ }
}
-#endif
}
diff --git a/src/core/display.c b/src/core/display.c
index c6c88d6..6f11182 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -910,22 +910,23 @@ meta_display_open (void)
{
MetaScreen *screen = tmp->data;
-#ifndef HAVE_WAYLAND
- meta_screen_manage_all_windows (screen);
-#else
- /* Instead of explicitly enumerating all windows during
- * initialization, when we run as a wayland compositor we can rely on
- * xwayland notifying us of all top level windows so we create
- * MetaWindows when we get those notifications.
- *
- * We still want a guard window so we can avoid
- * unmapping/withdrawing minimized windows for live
- * thumbnails...
- */
- if (screen->guard_window == None)
- screen->guard_window =
- meta_screen_create_guard_window (screen->display->xdisplay, screen);
-#endif
+ if (meta_is_display_server ())
+ {
+ /* Instead of explicitly enumerating all windows during
+ * initialization, when we run as a wayland compositor we can rely on
+ * xwayland notifying us of all top level windows so we create
+ * MetaWindows when we get those notifications.
+ *
+ * We still want a guard window so we can avoid
+ * unmapping/withdrawing minimized windows for live
+ * thumbnails...
+ */
+ if (screen->guard_window == None)
+ screen->guard_window =
+ meta_screen_create_guard_window (screen->display->xdisplay, screen);
+ }
+ else
+ meta_screen_manage_all_windows (screen);
tmp = tmp->next;
}
@@ -2650,12 +2651,9 @@ event_callback (XEvent *event,
screen->xscreen->height = event->xconfigure.height;
#endif
-#warning "FIXME: we should probably call this for wayland too"
-#ifndef HAVE_WAYLAND
meta_screen_resize (screen,
event->xconfigure.width,
event->xconfigure.height);
-#endif
}
}
break;
diff --git a/src/core/main.c b/src/core/main.c
index c1bbd41..49cddd2 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -256,8 +256,6 @@ meta_get_option_context (void)
return ctx;
}
-#ifndef HAVE_WAYLAND
-
/* Mutter is responsible for pulling events off the X queue, so Clutter
* doesn't need (and shouldn't) run its normal event source which polls
* the X fd, but we do have to deal with dispatching events that accumulate
@@ -340,7 +338,6 @@ meta_select_display (gchar *display_name)
/* DO NOT FREE envVar, putenv() sucks */
putenv (envVar);
}
-#endif
static void
meta_finalize (void)
@@ -351,9 +348,8 @@ meta_finalize (void)
meta_display_close (display,
CurrentTime); /* I doubt correct timestamps matter here */
-#ifdef HAVE_WAYLAND
- meta_wayland_finalize ();
-#endif
+ if (meta_is_display_server ())
+ meta_wayland_finalize ();
}
static int signal_pipe_fds[2] = { -1, -1 };
@@ -409,7 +405,7 @@ on_signal (GIOChannel *source,
break;
#ifdef HAVE_WAYLAND
case 'C': /* SIGCHLD */
- meta_wayland_handle_sig_child ();
+ meta_wayland_handle_sig_child ();
break;
#endif
default:
@@ -459,11 +455,13 @@ meta_init (void)
if (sigaction (SIGTERM, &act, NULL) < 0)
g_printerr ("Failed to register SIGTERM handler: %s\n",
g_strerror (errno));
-#ifdef HAVE_WAYLAND
- if (sigaction (SIGCHLD, &act, NULL) < 0)
- g_printerr ("Failed to register SIGCHLD handler: %s\n",
- g_strerror (errno));
-#endif
+
+ if (meta_is_display_server ())
+ {
+ if (sigaction (SIGCHLD, &act, NULL) < 0)
+ g_printerr ("Failed to register SIGCHLD handler: %s\n",
+ g_strerror (errno));
+ }
if (g_getenv ("MUTTER_VERBOSE"))
meta_set_verbose (TRUE);
@@ -482,12 +480,15 @@ meta_init (void)
#endif
#ifdef HAVE_WAYLAND
- /* NB: When running as a hybrid wayland compositor we run our own headless X
- * server so the user can't control the X display to connect too. */
- meta_wayland_init ();
-#else
- meta_select_display (opt_display_name);
+ if (meta_is_display_server ())
+ {
+ /* NB: When running as a hybrid wayland compositor we run our own headless X
+ * server so the user can't control the X display to connect too. */
+ meta_wayland_init ();
+ }
+ else
#endif
+ meta_select_display (opt_display_name);
meta_set_syncing (opt_sync || (g_getenv ("MUTTER_SYNC") != NULL));
@@ -505,12 +506,13 @@ meta_init (void)
* an X connection before initializing clutter we instead initialize
* it earlier since we need to initialize the GL driver so the driver
* can register any needed wayland extensions. */
-#ifndef HAVE_WAYLAND
- /*
- * Clutter can only be initialized after the UI.
- */
- meta_clutter_init ();
-#endif
+ if (!meta_is_display_server ())
+ {
+ /*
+ * Clutter can only be initialized after the UI.
+ */
+ meta_clutter_init ();
+ }
}
/**
diff --git a/src/core/screen.c b/src/core/screen.c
index b8156e3..4d9ffd2 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -832,14 +832,21 @@ meta_screen_new (MetaDisplay *display,
screen->xscreen = ScreenOfDisplay (xdisplay, number);
screen->xroot = xroot;
screen->rect.x = screen->rect.y = 0;
+
#ifdef HAVE_WAYLAND
- compositor = meta_wayland_compositor_get_default ();
- screen->rect.width = clutter_actor_get_width (compositor->stage);
- screen->rect.height = clutter_actor_get_height (compositor->stage);
-#else
- screen->rect.width = WidthOfScreen (screen->xscreen);
- screen->rect.height = HeightOfScreen (screen->xscreen);
+ if (meta_is_display_server ())
+ {
+ compositor = meta_wayland_compositor_get_default ();
+ screen->rect.width = clutter_actor_get_width (compositor->stage);
+ screen->rect.height = clutter_actor_get_height (compositor->stage);
+ }
+ else
#endif
+ {
+ screen->rect.width = WidthOfScreen (screen->xscreen);
+ screen->rect.height = HeightOfScreen (screen->xscreen);
+ }
+
screen->current_cursor = -1; /* invalid/unset */
screen->default_xvisual = DefaultVisualOfScreen (screen->xscreen);
screen->default_depth = DefaultDepthOfScreen (screen->xscreen);
@@ -1085,11 +1092,6 @@ list_windows (MetaScreen *screen)
return g_list_reverse (result);
}
-/* Instead of explicitly enumerating all windows during
- * initialization, when we run as a wayland compositor we can rely on
- * xwayland notifying us of all top level windows so we create
- * MetaWindows when we get those notifications. */
-#ifndef HAVE_WAYLAND
void
meta_screen_manage_all_windows (MetaScreen *screen)
{
@@ -1120,7 +1122,6 @@ meta_screen_manage_all_windows (MetaScreen *screen)
meta_display_ungrab (screen->display);
}
-#endif /* HAVE_WAYLAND */
/**
* meta_screen_for_x_screen:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]