[mutter/wip/no-zaphod: 3/3] compositor: Kill off MetaCompScreen



commit 2c0863d28c0066ffa9eae77593ffcb19df218136
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Mar 18 17:31:22 2014 -0400

    compositor: Kill off MetaCompScreen

 src/compositor/compositor-private.h  |   13 +-
 src/compositor/compositor.c          |  358 ++++++++++++++-------------------
 src/compositor/meta-plugin-manager.c |   18 +-
 src/compositor/meta-plugin-manager.h |    2 +-
 src/compositor/meta-plugin.c         |   16 +-
 src/compositor/meta-window-actor.c   |   95 ++++------
 src/core/display.c                   |    2 +-
 src/core/keybindings.c               |    4 +-
 src/core/screen-private.h            |    3 -
 src/core/screen.c                    |   31 +---
 src/core/stack-tracker.c             |    1 -
 src/core/workspace.c                 |    2 +-
 src/meta/compositor.h                |   14 +-
 src/meta/meta-plugin.h               |    2 +-
 src/meta/screen.h                    |    4 -
 15 files changed, 222 insertions(+), 343 deletions(-)
---
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index bae233b..ef0a534 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -11,8 +11,6 @@
 #include "meta-window-actor-private.h"
 #include <clutter/clutter.h>
 
-typedef struct _MetaCompScreen MetaCompScreen;
-
 struct _MetaCompositor
 {
   MetaDisplay    *display;
@@ -24,11 +22,6 @@ struct _MetaCompositor
 
   guint           server_time_is_monotonic_time : 1;
   guint           no_mipmaps  : 1;
-};
-
-struct _MetaCompScreen
-{
-  MetaScreen            *screen;
 
   ClutterActor          *stage, *window_group, *top_window_group;
   ClutterActor          *background_actor;
@@ -50,13 +43,13 @@ struct _MetaCompScreen
 /* Wait 2ms after vblank before starting to draw next frame */
 #define META_SYNC_DELAY 2
 
-void meta_switch_workspace_completed (MetaScreen    *screen);
+void meta_switch_workspace_completed (MetaCompositor *compositor);
 
-gboolean meta_begin_modal_for_plugin (MetaScreen       *screen,
+gboolean meta_begin_modal_for_plugin (MetaCompositor   *compositor,
                                       MetaPlugin       *plugin,
                                       MetaModalOptions  options,
                                       guint32           timestamp);
-void     meta_end_modal_for_plugin   (MetaScreen       *screen,
+void     meta_end_modal_for_plugin   (MetaCompositor   *compositor,
                                       MetaPlugin       *plugin,
                                       guint32           timestamp);
 
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 0302744..b66a2d7 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -101,36 +101,34 @@ composite_at_least_version (MetaDisplay *display, int maj, int min)
   return (major > maj || (major == maj && minor >= min));
 }
 
-static void sync_actor_stacking (MetaCompScreen *info);
+static void sync_actor_stacking (MetaCompositor *compositor);
 
 static void
-meta_finish_workspace_switch (MetaCompScreen *info)
+meta_finish_workspace_switch (MetaCompositor *compositor)
 {
   GList *l;
 
   /* Finish hiding and showing actors for the new workspace */
-  for (l = info->windows; l; l = l->next)
+  for (l = compositor->windows; l; l = l->next)
     meta_window_actor_sync_visibility (l->data);
 
   /* Fix up stacking order. */
-  sync_actor_stacking (info);
+  sync_actor_stacking (compositor);
 }
 
 void
-meta_switch_workspace_completed (MetaScreen *screen)
+meta_switch_workspace_completed (MetaCompositor *compositor)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-
   /* FIXME -- must redo stacking order */
-  info->switch_workspace_in_progress--;
-  if (info->switch_workspace_in_progress < 0)
+  compositor->switch_workspace_in_progress--;
+  if (compositor->switch_workspace_in_progress < 0)
     {
       g_warning ("Error in workspace_switch accounting!");
-      info->switch_workspace_in_progress = 0;
+      compositor->switch_workspace_in_progress = 0;
     }
 
-  if (!info->switch_workspace_in_progress)
-    meta_finish_workspace_switch (info);
+  if (!compositor->switch_workspace_in_progress)
+    meta_finish_workspace_switch (compositor);
 }
 
 void
@@ -149,17 +147,17 @@ process_damage (MetaCompositor     *compositor,
 }
 
 static Window
-get_output_window (MetaScreen *screen)
+get_output_window (MetaCompositor *compositor)
 {
-  MetaDisplay *display = meta_screen_get_display (screen);
-  Display     *xdisplay = meta_display_get_xdisplay (display);
-  Window       output, xroot;
+  MetaDisplay *display = compositor->display;
+  Display *xdisplay = display->xdisplay;
+  Window output, xroot;
   XWindowAttributes attr;
-  long         event_mask;
+  long event_mask;
   unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
   XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
 
-  xroot = meta_screen_get_xroot (screen);
+  xroot = display->screen->xroot;
   output = XCompositeGetOverlayWindow (xdisplay, xroot);
 
   meta_core_add_old_event_mask (xdisplay, output, &mask);
@@ -184,6 +182,13 @@ get_output_window (MetaScreen *screen)
   return output;
 }
 
+/* compat helper */
+static MetaCompositor *
+get_compositor_for_screen (MetaScreen *screen)
+{
+  return screen->display->compositor;
+}
+
 /**
  * meta_get_stage_for_screen:
  * @screen: a #MetaScreen
@@ -193,12 +198,8 @@ get_output_window (MetaScreen *screen)
 ClutterActor *
 meta_get_stage_for_screen (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-
-  if (!info)
-    return NULL;
-
-  return info->stage;
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  return compositor->stage;
 }
 
 /**
@@ -210,12 +211,8 @@ meta_get_stage_for_screen (MetaScreen *screen)
 ClutterActor *
 meta_get_window_group_for_screen (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-
-  if (!info)
-    return NULL;
-
-  return info->window_group;
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  return compositor->window_group;
 }
 
 /**
@@ -227,12 +224,8 @@ meta_get_window_group_for_screen (MetaScreen *screen)
 ClutterActor *
 meta_get_top_window_group_for_screen (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-
-  if (!info)
-    return NULL;
-
-  return info->top_window_group;
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  return compositor->top_window_group;
 }
 
 /**
@@ -244,12 +237,8 @@ meta_get_top_window_group_for_screen (MetaScreen *screen)
 GList *
 meta_get_window_actors (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-
-  if (!info)
-    return NULL;
-
-  return info->windows;
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  return compositor->windows;
 }
 
 void
@@ -263,10 +252,10 @@ meta_set_stage_input_region (MetaScreen   *screen,
    */
   if (!meta_is_wayland_compositor ())
     {
-      MetaCompScreen *info    = meta_screen_get_compositor_data (screen);
-      MetaDisplay    *display = meta_screen_get_display (screen);
-      Display        *xdpy    = meta_display_get_xdisplay (display);
-      Window          xstage  = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+      MetaDisplay *display = screen->display;
+      MetaCompositor *compositor = display->compositor;
+      Display *xdpy = meta_display_get_xdisplay (display);
+      Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
 
       XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
 
@@ -275,7 +264,7 @@ meta_set_stage_input_region (MetaScreen   *screen,
        * it's not the user doing something, it's the environment changing under the user.
        */
       meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
-      XFixesSetWindowShapeRegion (xdpy, info->output, ShapeInput, 0, 0, region);
+      XFixesSetWindowShapeRegion (xdpy, compositor->output, ShapeInput, 0, 0, region);
     }
 }
 
@@ -340,15 +329,14 @@ meta_stage_is_focused (MetaScreen *screen)
 }
 
 static gboolean
-begin_modal_x11 (MetaScreen       *screen,
+begin_modal_x11 (MetaCompositor   *compositor,
                  MetaPlugin       *plugin,
                  MetaModalOptions  options,
                  guint32           timestamp)
 {
-  MetaDisplay    *display     = meta_screen_get_display (screen);
+  MetaDisplay    *display     = compositor->display;
   Display        *xdpy        = meta_display_get_xdisplay (display);
-  MetaCompScreen *info        = meta_screen_get_compositor_data (screen);
-  Window          grab_window = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+  Window          grab_window = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
   int             result;
   gboolean        pointer_grabbed = FALSE;
   gboolean        keyboard_grabbed = FALSE;
@@ -413,7 +401,7 @@ begin_modal_x11 (MetaScreen       *screen,
 }
 
 gboolean
-meta_begin_modal_for_plugin (MetaScreen       *screen,
+meta_begin_modal_for_plugin (MetaCompositor   *compositor,
                              MetaPlugin       *plugin,
                              MetaModalOptions  options,
                              guint32           timestamp)
@@ -422,7 +410,7 @@ meta_begin_modal_for_plugin (MetaScreen       *screen,
    * are significant differences in how we handle grabs that make it difficult to
    * merge the two.
    */
-  MetaDisplay *display = meta_screen_get_display (screen);
+  MetaDisplay *display = compositor->display;
   gboolean ok;
 
   if (is_modal (display) || display->grab_op != META_GRAB_OP_NONE)
@@ -431,7 +419,7 @@ meta_begin_modal_for_plugin (MetaScreen       *screen,
   if (meta_is_wayland_compositor ())
     ok = TRUE;
   else
-    ok = begin_modal_x11 (screen, plugin, options, timestamp);
+    ok = begin_modal_x11 (compositor, plugin, options, timestamp);
   if (!ok)
     return FALSE;
 
@@ -444,11 +432,11 @@ meta_begin_modal_for_plugin (MetaScreen       *screen,
 }
 
 void
-meta_end_modal_for_plugin (MetaScreen     *screen,
+meta_end_modal_for_plugin (MetaCompositor *compositor,
                            MetaPlugin     *plugin,
                            guint32         timestamp)
 {
-  MetaDisplay *display = meta_screen_get_display (screen);
+  MetaDisplay *display = compositor->display;
   Display *xdpy = meta_display_get_xdisplay (display);
 
   g_return_if_fail (is_modal (display));
@@ -469,10 +457,10 @@ static void
 after_stage_paint (ClutterStage *stage,
                    gpointer      data)
 {
-  MetaCompScreen *info = (MetaCompScreen*) data;
+  MetaCompositor *compositor = data;
   GList *l;
 
-  for (l = info->windows; l; l = l->next)
+  for (l = compositor->windows; l; l = l->next)
     meta_window_actor_post_paint (l->data);
 
   if (meta_is_wayland_compositor ())
@@ -480,8 +468,7 @@ after_stage_paint (ClutterStage *stage,
 }
 
 static void
-redirect_windows (MetaCompositor *compositor,
-                  MetaScreen     *screen)
+redirect_windows (MetaScreen *screen)
 {
   MetaDisplay *display       = meta_screen_get_display (screen);
   Display     *xdisplay      = meta_display_get_xdisplay (display);
@@ -524,48 +511,35 @@ redirect_windows (MetaCompositor *compositor,
 }
 
 void
-meta_compositor_manage_screen (MetaCompositor *compositor,
-                               MetaScreen     *screen)
+meta_compositor_manage (MetaCompositor *compositor)
 {
-  MetaCompScreen *info;
-  MetaDisplay    *display       = meta_screen_get_display (screen);
-  Display        *xdisplay      = meta_display_get_xdisplay (display);
-  Window          xwin = None;
-  gint            width, height;
+  MetaDisplay *display = compositor->display;
+  Display *xdisplay = display->xdisplay;
+  MetaScreen *screen = display->screen;
+  Window xwin;
+  gint width, height;
   MetaWaylandCompositor *wayland_compositor;
 
-  /* Check if the screen is already managed */
-  if (meta_screen_get_compositor_data (screen))
-    return;
-
-  info = g_new0 (MetaCompScreen, 1);
-  info->screen = screen;
-
-  meta_screen_set_compositor_data (screen, info);
-
-  info->output = None;
-  info->windows = NULL;
-
-  meta_screen_set_cm_selection (screen);
+  meta_screen_set_cm_selection (display->screen);
 
   /* We will have already created a stage if running as a wayland
    * compositor... */
   if (meta_is_wayland_compositor ())
     {
       wayland_compositor = meta_wayland_compositor_get_default ();
-      info->stage = wayland_compositor->stage;
+      compositor->stage = wayland_compositor->stage;
 
       meta_screen_get_size (screen, &width, &height);
-      clutter_actor_set_size (info->stage, width, height);
+      clutter_actor_set_size (compositor->stage, width, height);
     }
   else
     {
-      info->stage = clutter_stage_new ();
+      compositor->stage = clutter_stage_new ();
 
       meta_screen_get_size (screen, &width, &height);
-      clutter_actor_realize (info->stage);
+      clutter_actor_realize (compositor->stage);
 
-      xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+      xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
 
       XResizeWindow (xdisplay, xwin, width, height);
 
@@ -599,30 +573,30 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
         }
     }
 
-  clutter_stage_set_paint_callback (CLUTTER_STAGE (info->stage),
+  clutter_stage_set_paint_callback (CLUTTER_STAGE (compositor->stage),
                                     after_stage_paint,
-                                    info,
+                                    compositor,
                                     NULL);
 
-  clutter_stage_set_sync_delay (CLUTTER_STAGE (info->stage), META_SYNC_DELAY);
+  clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY);
 
-  info->window_group = meta_window_group_new (screen);
-  info->top_window_group = meta_window_group_new (screen);
+  compositor->window_group = meta_window_group_new (screen);
+  compositor->top_window_group = meta_window_group_new (screen);
 
-  clutter_actor_add_child (info->stage, info->window_group);
-  clutter_actor_add_child (info->stage, info->top_window_group);
+  clutter_actor_add_child (compositor->stage, compositor->window_group);
+  clutter_actor_add_child (compositor->stage, compositor->top_window_group);
 
   if (meta_is_wayland_compositor ())
     {
       /* 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;
+      compositor->output = None;
     }
   else
     {
-      info->output = get_output_window (screen);
-      XReparentWindow (xdisplay, xwin, info->output, 0, 0);
+      compositor->output = get_output_window (compositor);
+      XReparentWindow (xdisplay, xwin, compositor->output, 0, 0);
 
       meta_empty_stage_input_region (screen);
 
@@ -634,28 +608,27 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
        *  because the X server will destroy the overlay window
        *  when the last client using it exits.
        */
-      XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
+      XFixesSetWindowShapeRegion (xdisplay, compositor->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);
+      XMapWindow (xdisplay, compositor->output);
     }
 
-  redirect_windows (compositor, screen);
+  redirect_windows (display->screen);
 
-  info->plugin_mgr = meta_plugin_manager_new (screen);
+  compositor->plugin_mgr = meta_plugin_manager_new (compositor);
 }
 
 void
-meta_compositor_unmanage_screen (MetaCompositor *compositor,
-                                 MetaScreen     *screen)
+meta_compositor_unmanage (MetaCompositor *compositor)
 {
   if (!meta_is_wayland_compositor ())
     {
-      MetaDisplay    *display       = meta_screen_get_display (screen);
-      Display        *xdisplay      = meta_display_get_xdisplay (display);
-      Window          xroot         = meta_screen_get_xroot (screen);
+      MetaDisplay *display = compositor->display;
+      Display *xdisplay = meta_display_get_xdisplay (display);
+      Window xroot = display->screen->xroot;
 
       /* This is the most important part of cleanup - we have to do this
        * before giving up the window manager selection or the next
@@ -666,7 +639,7 @@ meta_compositor_unmanage_screen (MetaCompositor *compositor,
 
 /**
  * meta_shape_cow_for_window:
- * @screen: A #MetaScreen
+ * @compositor: A #MetaCompositor
  * @window: (allow-none): A #MetaWindow to shape the COW for
  *
  * Sets an bounding shape on the COW so that the given window
@@ -676,14 +649,14 @@ meta_compositor_unmanage_screen (MetaCompositor *compositor,
  * of the COW, letting the raw window be seen through below.
  */
 static void
-meta_shape_cow_for_window (MetaScreen *screen,
+meta_shape_cow_for_window (MetaCompositor *compositor,
                            MetaWindow *window)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  Display *xdisplay = meta_display_get_xdisplay (meta_screen_get_display (screen));
+  MetaDisplay *display = compositor->display;
+  Display *xdisplay = meta_display_get_xdisplay (display);
 
   if (window == NULL)
-      XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
+    XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
   else
     {
       XserverRegion output_region;
@@ -698,7 +671,7 @@ meta_shape_cow_for_window (MetaScreen *screen,
       window_bounds.width = rect.width;
       window_bounds.height = rect.height;
 
-      meta_screen_get_size (screen, &width, &height);
+      meta_screen_get_size (display->screen, &width, &height);
       screen_rect.x = 0;
       screen_rect.y = 0;
       screen_rect.width = width;
@@ -707,47 +680,45 @@ meta_shape_cow_for_window (MetaScreen *screen,
       output_region = XFixesCreateRegion (xdisplay, &window_bounds, 1);
 
       XFixesInvertRegion (xdisplay, output_region, &screen_rect, output_region);
-      XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, output_region);
+      XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, output_region);
       XFixesDestroyRegion (xdisplay, output_region);
     }
 }
 
 static void
-set_unredirected_window (MetaCompScreen *info,
+set_unredirected_window (MetaCompositor *compositor,
                          MetaWindow     *window)
 {
-  if (info->unredirected_window == window)
+  if (compositor->unredirected_window == window)
     return;
 
-  if (info->unredirected_window != NULL)
+  if (compositor->unredirected_window != NULL)
     {
-      MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private 
(info->unredirected_window));
+      MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private 
(compositor->unredirected_window));
       meta_window_actor_set_unredirected (window_actor, FALSE);
     }
 
-  info->unredirected_window = window;
+  compositor->unredirected_window = window;
 
-  if (info->unredirected_window != NULL)
+  if (compositor->unredirected_window != NULL)
     {
-      MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private 
(info->unredirected_window));
+      MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private 
(compositor->unredirected_window));
       meta_window_actor_set_unredirected (window_actor, TRUE);
     }
 
-  meta_shape_cow_for_window (info->screen, info->unredirected_window);
+  meta_shape_cow_for_window (compositor, compositor->unredirected_window);
 }
 
 void
 meta_compositor_add_window (MetaCompositor    *compositor,
                             MetaWindow        *window)
 {
-  MetaScreen *screen = meta_window_get_screen (window);
-  MetaDisplay *display = meta_screen_get_display (screen);
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+  MetaDisplay *display = compositor->display;
 
   meta_error_trap_push (display);
 
   meta_window_actor_new (window);
-  sync_actor_stacking (info);
+  sync_actor_stacking (compositor);
 
   meta_error_trap_pop (display);
 }
@@ -757,11 +728,9 @@ meta_compositor_remove_window (MetaCompositor *compositor,
                                MetaWindow     *window)
 {
   MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
-  MetaScreen *screen = meta_window_get_screen (window);
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
 
-  if (info->unredirected_window == window)
-    set_unredirected_window (info, NULL);
+  if (compositor->unredirected_window == window)
+    set_unredirected_window (compositor, NULL);
 
   meta_window_actor_destroy (window_actor);
 }
@@ -901,11 +870,11 @@ event_is_passive_button_grab (MetaDisplay   *display,
  * these events by pretending we got an event on the stage window.
  */
 static void
-maybe_spoof_event_as_stage_event (MetaCompScreen *info,
+maybe_spoof_event_as_stage_event (MetaCompositor *compositor,
                                   MetaWindow     *window,
                                   XEvent         *event)
 {
-  MetaDisplay *display = meta_screen_get_display (info->screen);
+  MetaDisplay *display = compositor->display;
 
   if (event->type == GenericEvent &&
       event->xcookie.extension == display->xinput_opcode)
@@ -929,10 +898,10 @@ maybe_spoof_event_as_stage_event (MetaCompScreen *info,
         case XI_KeyRelease:
             /* If this is a GTK+ widget, like a window menu, let GTK+ handle
              * it as-is without mangling. */
-            if (meta_ui_window_is_widget (info->screen->ui, device_event->event))
+            if (meta_ui_window_is_widget (display->screen->ui, device_event->event))
               break;
 
-            device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+            device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
             device_event->event_x = device_event->root_x;
             device_event->event_y = device_event->root_y;
           break;
@@ -955,11 +924,10 @@ meta_compositor_process_event (MetaCompositor *compositor,
                                MetaWindow     *window)
 {
   MetaDisplay *display = compositor->display;
-  MetaCompScreen *info = meta_screen_get_compositor_data (display->screen);
 
-  if (is_modal (display) && is_grabbed_event (compositor->display, event))
+  if (is_modal (display) && is_grabbed_event (display, event))
     {
-      meta_plugin_manager_xevent_filter (info->plugin_mgr, event);
+      meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event);
 
       /* We always consume events even if the plugin says it didn't handle them;
        * exclusive is exclusive */
@@ -967,9 +935,9 @@ meta_compositor_process_event (MetaCompositor *compositor,
     }
 
   if (!meta_is_wayland_compositor ())
-    maybe_spoof_event_as_stage_event (info, window, event);
+    maybe_spoof_event_as_stage_event (compositor, window, event);
 
-  if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
+  if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event))
     return TRUE;
 
   if (!meta_is_wayland_compositor () &&
@@ -1001,11 +969,9 @@ meta_compositor_process_event (MetaCompositor *compositor,
 
 gboolean
 meta_compositor_filter_keybinding (MetaCompositor *compositor,
-                                   MetaScreen     *screen,
                                    MetaKeyBinding *binding)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  return meta_plugin_manager_filter_keybinding (info->plugin_mgr, binding);
+  return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr, binding);
 }
 
 void
@@ -1048,40 +1014,35 @@ meta_compositor_unmaximize_window (MetaCompositor    *compositor,
 
 void
 meta_compositor_switch_workspace (MetaCompositor     *compositor,
-                                  MetaScreen         *screen,
                                   MetaWorkspace      *from,
                                   MetaWorkspace      *to,
                                   MetaMotionDirection direction)
 {
-  MetaCompScreen *info;
-  gint            to_indx, from_indx;
+  gint to_indx, from_indx;
 
-  info      = meta_screen_get_compositor_data (screen);
   to_indx   = meta_workspace_index (to);
   from_indx = meta_workspace_index (from);
 
-  if (!info) /* During startup before manage_screen() */
-    return;
-
-  info->switch_workspace_in_progress++;
+  compositor->switch_workspace_in_progress++;
 
-  if (!meta_plugin_manager_switch_workspace (info->plugin_mgr,
-                                             from_indx, to_indx,
+  if (!meta_plugin_manager_switch_workspace (compositor->plugin_mgr,
+                                             from_indx,
+                                             to_indx,
                                              direction))
     {
-      info->switch_workspace_in_progress--;
+      compositor->switch_workspace_in_progress--;
 
       /* We have to explicitely call this to fix up stacking order of the
        * actors; this is because the abs stacking position of actors does not
        * necessarily change during the window hiding/unhiding, only their
        * relative position toward the destkop window.
        */
-      meta_finish_workspace_switch (info);
+      meta_finish_workspace_switch (compositor);
     }
 }
 
 static void
-sync_actor_stacking (MetaCompScreen *info)
+sync_actor_stacking (MetaCompositor *compositor)
 {
   GList *children;
   GList *expected_window_node;
@@ -1097,7 +1058,7 @@ sync_actor_stacking (MetaCompScreen *info)
    * little effort to make sure we actually need to restack before
    * we go ahead and do it */
 
-  children = clutter_actor_get_children (info->window_group);
+  children = clutter_actor_get_children (compositor->window_group);
   has_windows = FALSE;
   reordered = FALSE;
 
@@ -1109,7 +1070,7 @@ sync_actor_stacking (MetaCompScreen *info)
   /* First we collect a list of all backgrounds, and check if they're at the
    * bottom. Then we check if the window actors are in the correct sequence */
   backgrounds = NULL;
-  expected_window_node = info->windows;
+  expected_window_node = compositor->windows;
   for (old = children; old != NULL; old = old->next)
     {
       ClutterActor *actor = old->data;
@@ -1147,7 +1108,7 @@ sync_actor_stacking (MetaCompScreen *info)
    * We reorder the actors even if they're not parented to the window group,
    * to allow stacking to work with intermediate actors (eg during effects)
    */
-  for (tmp = g_list_last (info->windows); tmp != NULL; tmp = tmp->prev)
+  for (tmp = g_list_last (compositor->windows); tmp != NULL; tmp = tmp->prev)
     {
       ClutterActor *actor = tmp->data, *parent;
 
@@ -1170,11 +1131,9 @@ sync_actor_stacking (MetaCompScreen *info)
 
 void
 meta_compositor_sync_stack (MetaCompositor  *compositor,
-                           MetaScreen      *screen,
                            GList           *stack)
 {
   GList *old_stack;
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
 
   /* This is painful because hidden windows that we are in the process
    * of animating out of existence. They'll be at the bottom of the
@@ -1184,8 +1143,8 @@ meta_compositor_sync_stack (MetaCompositor  *compositor,
 
   /* Sources: first window is the highest */
   stack = g_list_copy (stack); /* The new stack of MetaWindow */
-  old_stack = g_list_reverse (info->windows); /* The old stack of MetaWindowActor */
-  info->windows = NULL;
+  old_stack = g_list_reverse (compositor->windows); /* The old stack of MetaWindowActor */
+  compositor->windows = NULL;
 
   while (TRUE)
     {
@@ -1249,13 +1208,13 @@ meta_compositor_sync_stack (MetaCompositor  *compositor,
        * be at the front of at least one, hopefully it will be
        * near the front of the other.)
        */
-      info->windows = g_list_prepend (info->windows, actor);
+      compositor->windows = g_list_prepend (compositor->windows, actor);
 
       stack = g_list_remove (stack, window);
       old_stack = g_list_remove (old_stack, actor);
     }
 
-  sync_actor_stacking (info);
+  sync_actor_stacking (compositor);
 }
 
 void
@@ -1269,12 +1228,10 @@ meta_compositor_sync_window_geometry (MetaCompositor *compositor,
 
 void
 meta_compositor_sync_screen_size (MetaCompositor  *compositor,
-                                 MetaScreen      *screen,
                                  guint            width,
                                  guint            height)
 {
-  MetaDisplay    *display = meta_screen_get_display (screen);
-  MetaCompScreen *info    = meta_screen_get_compositor_data (screen);
+  MetaDisplay *display = compositor->display;
 
   if (meta_is_wayland_compositor ())
     {
@@ -1288,23 +1245,21 @@ meta_compositor_sync_screen_size (MetaCompositor  *compositor,
          show the right portions on the right screens.
       */
 
-      clutter_actor_set_size (info->stage, width, height);
+      clutter_actor_set_size (compositor->stage, width, height);
     }
   else
     {
       Display        *xdisplay;
       Window          xwin;
 
-      g_return_if_fail (info);
-
       xdisplay = meta_display_get_xdisplay (display);
-      xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+      xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
 
       XResizeWindow (xdisplay, xwin, width, height);
     }
 
   meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
-                meta_screen_get_screen_number (screen),
+                meta_screen_get_screen_number (display->screen),
                 width, height);
 }
 
@@ -1314,7 +1269,7 @@ frame_callback (CoglOnscreen  *onscreen,
                 CoglFrameInfo *frame_info,
                 void          *user_data)
 {
-  MetaCompScreen *info = user_data;
+  MetaCompositor *compositor = user_data;
   GList *l;
 
   if (event == COGL_FRAME_EVENT_COMPLETE)
@@ -1345,38 +1300,38 @@ frame_callback (CoglOnscreen  *onscreen,
           presentation_time = 0;
         }
 
-      for (l = info->windows; l; l = l->next)
+      for (l = compositor->windows; l; l = l->next)
         meta_window_actor_frame_complete (l->data, frame_info, presentation_time);
     }
 }
 
 static void
-pre_paint_windows (MetaCompScreen *info)
+pre_paint_windows (MetaCompositor *compositor)
 {
   GList *l;
   MetaWindowActor *top_window;
 
-  if (info->onscreen == NULL)
+  if (compositor->onscreen == NULL)
     {
-      info->onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer ());
-      info->frame_closure = cogl_onscreen_add_frame_callback (info->onscreen,
-                                                              frame_callback,
-                                                              info,
-                                                              NULL);
+      compositor->onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer ());
+      compositor->frame_closure = cogl_onscreen_add_frame_callback (compositor->onscreen,
+                                                                    frame_callback,
+                                                                    compositor,
+                                                                    NULL);
     }
 
-  if (info->windows == NULL)
+  if (compositor->windows == NULL)
     return;
 
-  top_window = g_list_last (info->windows)->data;
+  top_window = g_list_last (compositor->windows)->data;
 
   if (meta_window_actor_should_unredirect (top_window) &&
-      info->disable_unredirect_count == 0)
-    set_unredirected_window (info, meta_window_actor_get_meta_window (top_window));
+      compositor->disable_unredirect_count == 0)
+    set_unredirected_window (compositor, meta_window_actor_get_meta_window (top_window));
   else
-    set_unredirected_window (info, NULL);
+    set_unredirected_window (compositor, NULL);
 
-  for (l = info->windows; l; l = l->next)
+  for (l = compositor->windows; l; l = l->next)
     meta_window_actor_pre_paint (l->data);
 }
 
@@ -1384,9 +1339,7 @@ static gboolean
 meta_repaint_func (gpointer data)
 {
   MetaCompositor *compositor = data;
-  MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
-  pre_paint_windows (info);
-
+  pre_paint_windows (compositor);
   return TRUE;
 }
 
@@ -1394,10 +1347,9 @@ static void
 on_shadow_factory_changed (MetaShadowFactory *factory,
                            MetaCompositor    *compositor)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
   GList *l;
 
-  for (l = info->windows; l; l = l->next)
+  for (l = compositor->windows; l; l = l->next)
     meta_window_actor_invalidate_shadow (l->data);
 }
 
@@ -1441,9 +1393,8 @@ meta_compositor_new (MetaDisplay *display)
 Window
 meta_get_overlay_window (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-
-  return info->output;
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  return compositor->output;
 }
 
 /**
@@ -1457,9 +1408,8 @@ meta_get_overlay_window (MetaScreen *screen)
 void
 meta_disable_unredirect_for_screen (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  if (info != NULL)
-    info->disable_unredirect_count = info->disable_unredirect_count + 1;
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  compositor->disable_unredirect_count++;
 }
 
 /**
@@ -1472,11 +1422,11 @@ meta_disable_unredirect_for_screen (MetaScreen *screen)
 void
 meta_enable_unredirect_for_screen (MetaScreen *screen)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  if (info != NULL && info->disable_unredirect_count == 0)
+  MetaCompositor *compositor = get_compositor_for_screen (screen);
+  if (compositor->disable_unredirect_count == 0)
     g_warning ("Called enable_unredirect_for_screen while unredirection is enabled.");
-  if (info != NULL && info->disable_unredirect_count > 0)
-   info->disable_unredirect_count = info->disable_unredirect_count - 1;
+  if (compositor->disable_unredirect_count > 0)
+    compositor->disable_unredirect_count--;
 }
 
 #define FLASH_TIME_MS 50
@@ -1573,20 +1523,16 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
 
 void
 meta_compositor_show_tile_preview (MetaCompositor *compositor,
-                                   MetaScreen     *screen,
                                    MetaWindow     *window,
                                    MetaRectangle  *tile_rect,
                                    int             tile_monitor_number)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  meta_plugin_manager_show_tile_preview (info->plugin_mgr,
+  meta_plugin_manager_show_tile_preview (compositor->plugin_mgr,
                                          window, tile_rect, tile_monitor_number);
 }
 
 void
-meta_compositor_hide_tile_preview (MetaCompositor *compositor,
-                                   MetaScreen     *screen)
+meta_compositor_hide_tile_preview (MetaCompositor *compositor)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  meta_plugin_manager_hide_tile_preview (info->plugin_mgr);
+  meta_plugin_manager_hide_tile_preview (compositor->plugin_mgr);
 }
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index 29bac00..8987e21 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -37,7 +37,7 @@ static GType plugin_type = G_TYPE_NONE;
 
 struct MetaPluginManager
 {
-  MetaScreen *screen;
+  MetaCompositor *compositor;
   MetaPlugin *plugin;
 };
 
@@ -91,7 +91,7 @@ on_confirm_display_change (MetaMonitorManager *monitors,
 }
 
 MetaPluginManager *
-meta_plugin_manager_new (MetaScreen *screen)
+meta_plugin_manager_new (MetaCompositor *compositor)
 {
   MetaPluginManager *plugin_mgr;
   MetaPluginClass *klass;
@@ -99,10 +99,10 @@ meta_plugin_manager_new (MetaScreen *screen)
   MetaMonitorManager *monitors;
 
   plugin_mgr = g_new0 (MetaPluginManager, 1);
-  plugin_mgr->screen = screen;
+  plugin_mgr->compositor = compositor;
   plugin_mgr->plugin = plugin = g_object_new (plugin_type, NULL);
 
-  _meta_plugin_set_screen (plugin, screen);
+  _meta_plugin_set_compositor (plugin, compositor);
 
   klass = META_PLUGIN_GET_CLASS (plugin);
 
@@ -153,7 +153,7 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
 {
   MetaPlugin *plugin = plugin_mgr->plugin;
   MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
-  MetaDisplay *display  = meta_screen_get_display (plugin_mgr->screen);
+  MetaDisplay *display = plugin_mgr->compositor->display;
   gboolean retval = FALSE;
 
   if (display->display_opening)
@@ -213,7 +213,7 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
 {
   MetaPlugin *plugin = plugin_mgr->plugin;
   MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
-  MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
+  MetaDisplay *display = plugin_mgr->compositor->display;
   gboolean retval = FALSE;
 
   if (display->display_opening)
@@ -266,7 +266,7 @@ meta_plugin_manager_switch_workspace (MetaPluginManager   *plugin_mgr,
 {
   MetaPlugin *plugin = plugin_mgr->plugin;
   MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
-  MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
+  MetaDisplay *display = plugin_mgr->compositor->display;
   gboolean retval = FALSE;
 
   if (display->display_opening)
@@ -324,7 +324,7 @@ meta_plugin_manager_show_tile_preview (MetaPluginManager *plugin_mgr,
 {
   MetaPlugin *plugin = plugin_mgr->plugin;
   MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
-  MetaDisplay *display  = meta_screen_get_display (plugin_mgr->screen);
+  MetaDisplay *display = plugin_mgr->compositor->display;
 
   if (display->display_opening)
     return FALSE;
@@ -343,7 +343,7 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
 {
   MetaPlugin *plugin = plugin_mgr->plugin;
   MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
-  MetaDisplay *display  = meta_screen_get_display (plugin_mgr->screen);
+  MetaDisplay *display = plugin_mgr->compositor->display;
 
   if (display->display_opening)
     return FALSE;
diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h
index efc4deb..d814ee6 100644
--- a/src/compositor/meta-plugin-manager.h
+++ b/src/compositor/meta-plugin-manager.h
@@ -44,7 +44,7 @@
  */
 typedef struct MetaPluginManager MetaPluginManager;
 
-MetaPluginManager * meta_plugin_manager_new (MetaScreen *screen);
+MetaPluginManager * meta_plugin_manager_new (MetaCompositor *compositor);
 
 void     meta_plugin_manager_load         (const gchar       *plugin_name);
 
diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c
index 61d99d0..f9f6b3d 100644
--- a/src/compositor/meta-plugin.c
+++ b/src/compositor/meta-plugin.c
@@ -49,7 +49,7 @@ G_DEFINE_ABSTRACT_TYPE (MetaPlugin, meta_plugin, G_TYPE_OBJECT);
 
 struct _MetaPluginPrivate
 {
-  MetaScreen *screen;
+  MetaCompositor *compositor;
 };
 
 static void
@@ -101,9 +101,8 @@ void
 meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
 {
   MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
-  MetaScreen *screen = priv->screen;
 
-  meta_switch_workspace_completed (screen);
+  meta_switch_workspace_completed (priv->compositor);
 }
 
 static void
@@ -177,7 +176,7 @@ meta_plugin_begin_modal (MetaPlugin       *plugin,
 {
   MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
 
-  return meta_begin_modal_for_plugin (priv->screen, plugin,
+  return meta_begin_modal_for_plugin (priv->compositor, plugin,
                                       options, timestamp);
 }
 
@@ -198,7 +197,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
 {
   MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
 
-  meta_end_modal_for_plugin (priv->screen, plugin, timestamp);
+  meta_end_modal_for_plugin (priv->compositor, plugin, timestamp);
 }
 
 /**
@@ -214,16 +213,15 @@ meta_plugin_get_screen (MetaPlugin *plugin)
 {
   MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
 
-  return priv->screen;
+  return priv->compositor->display->screen;
 }
 
 void
-_meta_plugin_set_screen (MetaPlugin *plugin,
-                         MetaScreen *screen)
+_meta_plugin_set_compositor (MetaPlugin *plugin, MetaCompositor *compositor)
 {
   MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
 
-  priv->screen = screen;
+  priv->compositor = compositor;
 }
 
 void
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index a436835..a43da1a 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -37,8 +37,8 @@
 
 struct _MetaWindowActorPrivate
 {
-  MetaWindow       *window;
-  MetaScreen       *screen;
+  MetaWindow *window;
+  MetaCompositor *compositor;
 
   MetaSurfaceActor *surface;
 
@@ -371,11 +371,11 @@ meta_window_actor_update_surface (MetaWindowActor *self)
 static void
 meta_window_actor_constructed (GObject *object)
 {
-  MetaWindowActor        *self     = META_WINDOW_ACTOR (object);
-  MetaWindowActorPrivate *priv     = self->priv;
-  MetaWindow             *window   = priv->window;
+  MetaWindowActor *self = META_WINDOW_ACTOR (object);
+  MetaWindowActorPrivate *priv = self->priv;
+  MetaWindow *window = priv->window;
 
-  priv->screen = window->screen;
+  priv->compositor = window->display->compositor;
 
   meta_window_actor_update_surface (self);
 
@@ -389,19 +389,15 @@ meta_window_actor_constructed (GObject *object)
 static void
 meta_window_actor_dispose (GObject *object)
 {
-  MetaWindowActor        *self = META_WINDOW_ACTOR (object);
+  MetaWindowActor *self = META_WINDOW_ACTOR (object);
   MetaWindowActorPrivate *priv = self->priv;
-  MetaScreen             *screen;
-  MetaCompScreen         *info;
+  MetaCompositor *compositor = priv->compositor;
 
   if (priv->disposed)
     return;
 
   priv->disposed = TRUE;
 
-  screen   = priv->screen;
-  info     = meta_screen_get_compositor_data (screen);
-
   if (priv->send_frame_messages_timer != 0)
     {
       g_source_remove (priv->send_frame_messages_timer);
@@ -416,7 +412,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);
 
-  info->windows = g_list_remove (info->windows, (gconstpointer) self);
+  compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
 
   g_clear_object (&priv->window);
 
@@ -851,8 +847,7 @@ static void
 queue_send_frame_messages_timeout (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
-  MetaScreen  *screen  = priv->screen;
-  MetaDisplay *display = meta_screen_get_display (screen);
+  MetaDisplay *display = meta_window_get_display (priv->window);
   gint64 current_time = meta_compositor_monotonic_time_to_server_time (display, g_get_monotonic_time ());
   MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
   MetaWindow *window = priv->window;
@@ -964,7 +959,7 @@ start_simple_effect (MetaWindowActor *self,
                      gulong        event)
 {
   MetaWindowActorPrivate *priv = self->priv;
-  MetaCompScreen *info = meta_screen_get_compositor_data (priv->screen);
+  MetaCompositor *compositor = priv->compositor;
   gint *counter = NULL;
   gboolean use_freeze_thaw = FALSE;
 
@@ -995,9 +990,7 @@ start_simple_effect (MetaWindowActor *self,
 
   (*counter)++;
 
-  if (!meta_plugin_manager_event_simple (info->plugin_mgr,
-                                         self,
-                                         event))
+  if (!meta_plugin_manager_event_simple (compositor->plugin_mgr, self, event))
     {
       (*counter)--;
       if (use_freeze_thaw)
@@ -1118,15 +1111,11 @@ meta_window_actor_set_unredirected (MetaWindowActor *self,
 void
 meta_window_actor_destroy (MetaWindowActor *self)
 {
-  MetaWindow         *window;
-  MetaCompScreen      *info;
-  MetaWindowActorPrivate *priv;
-  MetaWindowType window_type;
-
-  priv = self->priv;
+  MetaWindowActorPrivate *priv = self->priv;
+  MetaWindow *window = priv->window;
+  MetaCompositor *compositor = priv->compositor;
+  MetaWindowType window_type = meta_window_get_window_type (window);
 
-  window = priv->window;
-  window_type = meta_window_get_window_type (window);
   meta_window_set_compositor_private (window, NULL);
 
   if (priv->send_frame_messages_timer != 0)
@@ -1139,8 +1128,7 @@ meta_window_actor_destroy (MetaWindowActor *self)
    * We remove the window from internal lookup hashes and thus any other
    * unmap events etc fail
    */
-  info = meta_screen_get_compositor_data (priv->screen);
-  info->windows = g_list_remove (info->windows, (gconstpointer) self);
+  compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
 
   if (window_type == META_WINDOW_DROPDOWN_MENU ||
       window_type == META_WINDOW_POPUP_MENU ||
@@ -1201,18 +1189,14 @@ void
 meta_window_actor_show (MetaWindowActor   *self,
                         MetaCompEffect     effect)
 {
-  MetaWindowActorPrivate *priv;
-  MetaCompScreen         *info;
-  gulong                  event;
-
-  priv = self->priv;
-  info = meta_screen_get_compositor_data (priv->screen);
+  MetaWindowActorPrivate *priv = self->priv;
+  MetaCompositor *compositor = priv->compositor;
+  gulong event = 0;
 
   g_return_if_fail (!priv->visible);
 
   self->priv->visible = TRUE;
 
-  event = 0;
   switch (effect)
     {
     case META_COMP_EFFECT_CREATE:
@@ -1229,7 +1213,7 @@ meta_window_actor_show (MetaWindowActor   *self,
       g_assert_not_reached();
     }
 
-  if (info->switch_workspace_in_progress ||
+  if (compositor->switch_workspace_in_progress ||
       event == 0 ||
       !start_simple_effect (self, event))
     {
@@ -1241,12 +1225,9 @@ void
 meta_window_actor_hide (MetaWindowActor *self,
                         MetaCompEffect   effect)
 {
-  MetaWindowActorPrivate *priv;
-  MetaCompScreen         *info;
-  gulong                  event;
-
-  priv = self->priv;
-  info = meta_screen_get_compositor_data (priv->screen);
+  MetaWindowActorPrivate *priv = self->priv;
+  MetaCompositor *compositor = priv->compositor;
+  gulong event = 0;
 
   g_return_if_fail (priv->visible);
 
@@ -1256,10 +1237,9 @@ meta_window_actor_hide (MetaWindowActor *self,
    * hold off on hiding the window, and do it after the workspace
    * switch completes
    */
-  if (info->switch_workspace_in_progress)
+  if (compositor->switch_workspace_in_progress)
     return;
 
-  event = 0;
   switch (effect)
     {
     case META_COMP_EFFECT_DESTROY:
@@ -1285,7 +1265,8 @@ meta_window_actor_maximize (MetaWindowActor    *self,
                             MetaRectangle      *old_rect,
                             MetaRectangle      *new_rect)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
+  MetaWindowActorPrivate *priv = self->priv;
+  MetaCompositor *compositor = priv->compositor;
 
   /* The window has already been resized (in order to compute new_rect),
    * which by side effect caused the actor to be resized. Restore it to the
@@ -1296,7 +1277,7 @@ meta_window_actor_maximize (MetaWindowActor    *self,
   self->priv->maximize_in_progress++;
   meta_window_actor_freeze (self);
 
-  if (!meta_plugin_manager_event_maximize (info->plugin_mgr,
+  if (!meta_plugin_manager_event_maximize (compositor->plugin_mgr,
                                            self,
                                            META_PLUGIN_MAXIMIZE,
                                            new_rect->x, new_rect->y,
@@ -1313,7 +1294,8 @@ meta_window_actor_unmaximize (MetaWindowActor   *self,
                               MetaRectangle     *old_rect,
                               MetaRectangle     *new_rect)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
+  MetaWindowActorPrivate *priv = self->priv;
+  MetaCompositor *compositor = priv->compositor;
 
   /* The window has already been resized (in order to compute new_rect),
    * which by side effect caused the actor to be resized. Restore it to the
@@ -1324,7 +1306,7 @@ meta_window_actor_unmaximize (MetaWindowActor   *self,
   self->priv->unmaximize_in_progress++;
   meta_window_actor_freeze (self);
 
-  if (!meta_plugin_manager_event_maximize (info->plugin_mgr,
+  if (!meta_plugin_manager_event_maximize (compositor->plugin_mgr,
                                            self,
                                            META_PLUGIN_UNMAXIMIZE,
                                            new_rect->x, new_rect->y,
@@ -1338,8 +1320,8 @@ meta_window_actor_unmaximize (MetaWindowActor   *self,
 MetaWindowActor *
 meta_window_actor_new (MetaWindow *window)
 {
-  MetaScreen            *screen = meta_window_get_screen (window);
-  MetaCompScreen         *info = meta_screen_get_compositor_data (screen);
+  MetaDisplay *display = meta_window_get_display (window);
+  MetaCompositor *compositor = display->compositor;
   MetaWindowActor        *self;
   MetaWindowActorPrivate *priv;
   ClutterActor           *window_group;
@@ -1364,9 +1346,9 @@ meta_window_actor_new (MetaWindow *window)
   meta_window_set_compositor_private (window, G_OBJECT (self));
 
   if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
-    window_group = info->top_window_group;
+    window_group = compositor->top_window_group;
   else
-    window_group = info->window_group;
+    window_group = compositor->window_group;
 
   clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
 
@@ -1375,7 +1357,7 @@ meta_window_actor_new (MetaWindow *window)
   /* Initial position in the stack is arbitrary; stacking will be synced
    * before we first paint.
    */
-  info->windows = g_list_append (info->windows, self);
+  compositor->windows = g_list_append (compositor->windows, self);
 
   return self;
 }
@@ -1912,8 +1894,7 @@ static void
 do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
 {
   MetaWindowActorPrivate *priv = self->priv;
-  MetaScreen  *screen  = priv->screen;
-  MetaDisplay *display = meta_screen_get_display (screen);
+  MetaDisplay *display = meta_window_get_display (priv->window);
   Display *xdisplay = meta_display_get_xdisplay (display);
 
   XClientMessageEvent ev = { 0, };
@@ -1965,7 +1946,7 @@ do_send_frame_timings (MetaWindowActor  *self,
                        gint64           presentation_time)
 {
   MetaWindowActorPrivate *priv = self->priv;
-  MetaDisplay *display = meta_screen_get_display (priv->screen);
+  MetaDisplay *display = meta_window_get_display (priv->window);
   Display *xdisplay = meta_display_get_xdisplay (display);
 
   XClientMessageEvent ev = { 0, };
diff --git a/src/core/display.c b/src/core/display.c
index 551c3b2..f3d413e 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -407,7 +407,7 @@ enable_compositor (MetaDisplay *display)
   if (!display->compositor)
     return;
 
-  meta_compositor_manage_screen (display->compositor, display->screen);
+  meta_compositor_manage (display->compositor);
 }
 
 static void
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 74b3b22..31aaf18 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1654,7 +1654,7 @@ process_event (MetaDisplay          *display,
                                     event->modifier_state);
   if (!binding ||
       (!window && binding->flags & META_KEY_BINDING_PER_WINDOW) ||
-      meta_compositor_filter_keybinding (display->compositor, screen, binding))
+      meta_compositor_filter_keybinding (display->compositor, binding))
     goto not_found;
 
   if (binding->handler == NULL)
@@ -1739,7 +1739,7 @@ process_overlay_key (MetaDisplay *display,
                                             display->overlay_key_combo.keycode,
                                             display->grab_mask);
           if (binding &&
-              meta_compositor_filter_keybinding (display->compositor, screen, binding))
+              meta_compositor_filter_keybinding (display->compositor, binding))
             return TRUE;
           meta_display_overlay_key_activate (display);
         }
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index 427bda2..b4ec59d 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -118,9 +118,6 @@ struct _MetaScreen
   guint all_keys_grabbed : 1;
   
   int closing;
-
-  /* Managed by compositor.c */
-  gpointer compositor_data;
   
   /* Instead of unmapping withdrawn windows we can leave them mapped
    * and restack them below a guard window. When using a compositor
diff --git a/src/core/screen.c b/src/core/screen.c
index 897c5ac..9771af5 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -708,7 +708,6 @@ meta_screen_new (MetaDisplay *display,
   screen->columns_of_workspaces = -1;
   screen->vertical_workspaces = FALSE;
   screen->starting_corner = META_SCREEN_TOPLEFT;
-  screen->compositor_data = NULL;
   screen->guard_window = None;
 
   reload_monitor_infos (screen);
@@ -809,8 +808,7 @@ meta_screen_free (MetaScreen *screen,
   
   meta_display_grab (display);
 
-  meta_compositor_unmanage_screen (screen->display->compositor,
-                                   screen);
+  meta_compositor_unmanage (screen->display->compositor);
   
   meta_display_unmanage_windows_for_screen (display, screen, timestamp);
   
@@ -1440,11 +1438,10 @@ meta_screen_update_tile_preview_timeout (gpointer data)
       monitor = meta_window_get_current_tile_monitor_number (window);
       meta_window_get_current_tile_area (window, &tile_rect);
       meta_compositor_show_tile_preview (screen->display->compositor,
-                                         screen, window, &tile_rect, monitor);
+                                         window, &tile_rect, monitor);
     }
   else
-    meta_compositor_hide_tile_preview (screen->display->compositor,
-                                       screen);
+    meta_compositor_hide_tile_preview (screen->display->compositor);
 
   return FALSE;
 }
@@ -1480,8 +1477,7 @@ meta_screen_hide_tile_preview (MetaScreen *screen)
   if (screen->tile_preview_timeout_id > 0)
     g_source_remove (screen->tile_preview_timeout_id);
 
-  meta_compositor_hide_tile_preview (screen->display->compositor,
-                                     screen);
+  meta_compositor_hide_tile_preview (screen->display->compositor);
 }
 
 MetaWindow*
@@ -2499,7 +2495,6 @@ on_monitors_changed (MetaMonitorManager *manager,
     }
 
   meta_compositor_sync_screen_size (screen->display->compositor,
-                                    screen,
                                     screen->rect.width, screen->rect.height);
 
   /* Queue a resize on all the windows */
@@ -3040,24 +3035,6 @@ meta_screen_get_size (MetaScreen *screen,
     *height = screen->rect.height;
 }
 
-/**
- * meta_screen_get_compositor_data: (skip)
- * @screen: A #MetaScreen
- *
- */
-gpointer
-meta_screen_get_compositor_data (MetaScreen *screen)
-{
-  return screen->compositor_data;
-}
-
-void
-meta_screen_set_compositor_data (MetaScreen *screen,
-                                 gpointer    compositor)
-{
-  screen->compositor_data = compositor;
-}
-
 void
 meta_screen_set_cm_selection (MetaScreen *screen)
 {
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index e87c13f..77266a0 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -1246,7 +1246,6 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
     }
 
   meta_compositor_sync_stack (tracker->screen->display->compositor,
-                              tracker->screen,
                               meta_windows);
   g_list_free (meta_windows);
 
diff --git a/src/core/workspace.c b/src/core/workspace.c
index f1e2527..ca87c0b 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -665,7 +665,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
    meta_screen_free_workspace_layout (&layout1);
    meta_screen_free_workspace_layout (&layout2);
 
-   meta_compositor_switch_workspace (comp, screen, old, workspace, direction);
+   meta_compositor_switch_workspace (comp, old, workspace, direction);
 
   /* This needs to be done after telling the compositor we are switching
    * workspaces since focusing a window will cause it to be immediately
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index 76ad10b..57be80a 100644
--- a/src/meta/compositor.h
+++ b/src/meta/compositor.h
@@ -57,10 +57,8 @@ typedef enum
 MetaCompositor *meta_compositor_new     (MetaDisplay    *display);
 void            meta_compositor_destroy (MetaCompositor *compositor);
 
-void meta_compositor_manage_screen   (MetaCompositor *compositor,
-                                      MetaScreen     *screen);
-void meta_compositor_unmanage_screen (MetaCompositor *compositor,
-                                      MetaScreen     *screen);
+void meta_compositor_manage   (MetaCompositor *compositor);
+void meta_compositor_unmanage (MetaCompositor *compositor);
 
 void meta_compositor_window_shape_changed (MetaCompositor *compositor,
                                            MetaWindow     *window);
@@ -74,7 +72,6 @@ gboolean meta_compositor_process_event (MetaCompositor *compositor,
                                         MetaWindow     *window);
 
 gboolean meta_compositor_filter_keybinding (MetaCompositor *compositor,
-                                            MetaScreen     *screen,
                                             MetaKeyBinding *binding);
 
 void meta_compositor_add_window        (MetaCompositor      *compositor,
@@ -88,7 +85,6 @@ void meta_compositor_hide_window       (MetaCompositor      *compositor,
                                         MetaWindow          *window,
                                         MetaCompEffect       effect);
 void meta_compositor_switch_workspace  (MetaCompositor      *compositor,
-                                        MetaScreen          *screen,
                                         MetaWorkspace       *from,
                                         MetaWorkspace       *to,
                                         MetaMotionDirection  direction);
@@ -113,10 +109,8 @@ void meta_compositor_queue_frame_drawn    (MetaCompositor *compositor,
                                            gboolean        no_delay_frame);
 
 void meta_compositor_sync_stack                (MetaCompositor *compositor,
-                                                MetaScreen     *screen,
                                                 GList          *stack);
 void meta_compositor_sync_screen_size          (MetaCompositor *compositor,
-                                                MetaScreen     *screen,
                                                 guint           width,
                                                 guint           height);
 
@@ -124,11 +118,9 @@ void meta_compositor_flash_screen              (MetaCompositor *compositor,
                                                 MetaScreen     *screen);
 
 void meta_compositor_show_tile_preview (MetaCompositor *compositor,
-                                        MetaScreen     *screen,
                                         MetaWindow     *window,
                                         MetaRectangle  *tile_rect,
                                         int             tile_monitor_number);
-void meta_compositor_hide_tile_preview (MetaCompositor *compositor,
-                                        MetaScreen     *screen);
+void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
 
 #endif /* META_COMPOSITOR_H */
diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h
index df42f3e..983db7a 100644
--- a/src/meta/meta-plugin.h
+++ b/src/meta/meta-plugin.h
@@ -405,7 +405,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
 
 MetaScreen *meta_plugin_get_screen        (MetaPlugin *plugin);
 
-void _meta_plugin_set_screen (MetaPlugin *plugin, MetaScreen *screen);
+void _meta_plugin_set_compositor (MetaPlugin *plugin, MetaCompositor *compositor);
 
 /* XXX: Putting this in here so it's in the public header. */
 void     meta_plugin_manager_set_plugin_type (GType gtype);
diff --git a/src/meta/screen.h b/src/meta/screen.h
index 8c65246..4c3c52e 100644
--- a/src/meta/screen.h
+++ b/src/meta/screen.h
@@ -44,10 +44,6 @@ void meta_screen_get_size (MetaScreen *screen,
                            int        *width,
                            int        *height);
 
-gpointer meta_screen_get_compositor_data (MetaScreen *screen);
-void meta_screen_set_compositor_data (MetaScreen *screen,
-                                      gpointer    info);
-
 void meta_screen_set_cm_selection (MetaScreen *screen);
 void meta_screen_unset_cm_selection (MetaScreen *screen);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]