[gtk+/wip/attente/gtk-3-mir-fixes: 1/3] mir: migrate away from deprecated mir api



commit 7510080f9ae6b8cdf95114789327d7bd60eb8973
Author: William Hua <william hua canonical com>
Date:   Thu Feb 23 13:42:45 2017 -0500

    mir: migrate away from deprecated mir api

 gdk/mir/gdkmir-debug.c      |   24 ++--
 gdk/mir/gdkmir-private.h    |    8 +-
 gdk/mir/gdkmirdisplay.c     |   36 +++---
 gdk/mir/gdkmireventsource.c |   65 +++++----
 gdk/mir/gdkmirscreen.c      |  181 +++++++++++++-----------
 gdk/mir/gdkmirwindowimpl.c  |  328 ++++++++++++++++++++++---------------------
 6 files changed, 338 insertions(+), 304 deletions(-)
---
diff --git a/gdk/mir/gdkmir-debug.c b/gdk/mir/gdkmir-debug.c
index b0ff929..6a93ed5 100644
--- a/gdk/mir/gdkmir-debug.c
+++ b/gdk/mir/gdkmir-debug.c
@@ -207,30 +207,30 @@ _gdk_mir_print_input_event (const MirInputEvent *event)
 }
 
 static void
-_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
+_gdk_mir_print_window_event (const MirWindowEvent *event)
 {
-  g_printerr ("SURFACE\n");
+  g_printerr ("WINDOW\n");
   g_printerr (" Attribute ");
-  switch (mir_surface_event_get_attribute (event))
+  switch (mir_window_event_get_attribute (event))
     {
-    case mir_surface_attrib_type:
+    case mir_window_attrib_type:
       g_printerr ("type");
       break;
-    case mir_surface_attrib_state:
+    case mir_window_attrib_state:
       g_printerr ("state");
       break;
-    case mir_surface_attrib_swapinterval:
+    case mir_window_attrib_swapinterval:
       g_printerr ("swapinterval");
       break;
-    case mir_surface_attrib_focus:
+    case mir_window_attrib_focus:
       g_printerr ("focus");
       break;
     default:
-      g_printerr ("%u", mir_surface_event_get_attribute (event));
+      g_printerr ("%u", mir_window_event_get_attribute (event));
       break;
     }
   g_printerr ("\n");
-  g_printerr (" Value %i\n", mir_surface_event_get_attribute_value (event));
+  g_printerr (" Value %i\n", mir_window_event_get_attribute_value (event));
 }
 
 static void
@@ -278,13 +278,13 @@ _gdk_mir_print_event (const MirEvent *event)
     case mir_event_type_motion:
       _gdk_mir_print_motion_event (mir_event_get_input_event (event));
       break;
-    case mir_event_type_surface:
-      _gdk_mir_print_surface_event (mir_event_get_surface_event (event));
+    case mir_event_type_window:
+      _gdk_mir_print_window_event (mir_event_get_window_event (event));
       break;
     case mir_event_type_resize:
       _gdk_mir_print_resize_event (mir_event_get_resize_event (event));
       break;
-    case mir_event_type_close_surface:
+    case mir_event_type_close_window:
       _gdk_mir_print_close_event ();
       break;
     default:
diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h
index 4595dc5..e726703 100644
--- a/gdk/mir/gdkmir-private.h
+++ b/gdk/mir/gdkmir-private.h
@@ -83,13 +83,15 @@ GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name)
 
 const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
 
+MirWindow *_gdk_mir_window_get_mir_window (GdkWindow *window);
+
 GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, 
gint attributes_mask);
 
-void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state);
+void _gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl, MirWindowState state);
 
-void _gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type);
+void _gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl, MirWindowType type);
 
-void _gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale);
+void _gdk_mir_window_set_scale (GdkWindow *window, gdouble scale);
 
 void _gdk_mir_window_set_final_rect (GdkWindow *window, MirRectangle rect);
 
diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c
index 62f36ee..0a5e8f0 100644
--- a/gdk/mir/gdkmirdisplay.c
+++ b/gdk/mir/gdkmirdisplay.c
@@ -827,8 +827,8 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
                                    guint32     time)
 {
   GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
-  MirSurface *surface;
-  MirPersistentId *persistent_id;
+  MirWindow *mir_window;
+  MirWindowId *mir_window_id;
   ConvertInfo *info;
 
   if (selection != GDK_SELECTION_CLIPBOARD)
@@ -837,17 +837,17 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
     gdk_mir_display_real_convert_selection (display, requestor, selection, target, time);
   else if (mir_display->focused_window)
     {
-      surface = gdk_mir_window_get_mir_surface (mir_display->focused_window);
+      mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
 
-      if (!surface)
+      if (!mir_window)
         return;
 
-      persistent_id = mir_surface_request_persistent_id_sync (surface);
+      mir_window_id = mir_window_request_window_id_sync (mir_window);
 
-      if (!persistent_id)
+      if (!mir_window_id)
         return;
 
-      if (mir_persistent_id_is_valid (persistent_id))
+      if (mir_window_id_is_valid (mir_window_id))
         {
           info = g_new (ConvertInfo, 1);
           info->display = g_object_ref (display);
@@ -858,13 +858,13 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
 
           content_hub_service_call_get_latest_paste_data (
             mir_display->content_service,
-            mir_persistent_id_as_string (persistent_id),
+            mir_window_id_as_string (mir_window_id),
             NULL,
             paste_data_ready_cb,
             info);
         }
 
-      mir_persistent_id_release (persistent_id);
+      mir_window_id_release (mir_window_id);
     }
 }
 
@@ -1010,34 +1010,34 @@ _gdk_mir_display_create_paste (GdkDisplay          *display,
                                gsize                paste_size)
 {
   GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
-  MirSurface *surface;
-  MirPersistentId *persistent_id;
+  MirWindow *mir_window;
+  MirWindowId *mir_window_id;
 
   if (!mir_display->focused_window)
     return;
 
-  surface = gdk_mir_window_get_mir_surface (mir_display->focused_window);
+  mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
 
-  if (!surface)
+  if (!mir_window)
     return;
 
-  persistent_id = mir_surface_request_persistent_id_sync (surface);
+  mir_window_id = mir_window_request_window_id_sync (mir_window);
 
-  if (!persistent_id)
+  if (!mir_window_id)
     return;
 
-  if (mir_persistent_id_is_valid (persistent_id))
+  if (mir_window_id_is_valid (mir_window_id))
     content_hub_service_call_create_paste_sync (
       mir_display->content_service,
       g_application_get_application_id (g_application_get_default ()),
-      mir_persistent_id_as_string (persistent_id),
+      mir_window_id_as_string (mir_window_id),
       g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, paste_data, paste_size, sizeof (guchar)),
       paste_formats,
       NULL,
       NULL,
       NULL);
 
-  mir_persistent_id_release (persistent_id);
+  mir_window_id_release (mir_window_id);
 }
 
 gboolean
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index 30b78a4..c7cda56 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -22,7 +22,7 @@
 #include "gdkmir.h"
 #include "gdkmir-private.h"
 
-#include <mir_toolkit/events/surface_placement.h>
+#include <mir_toolkit/events/window_placement.h>
 
 #define NANO_TO_MILLI(x) ((x) / 1000000)
 
@@ -444,45 +444,46 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
 }
 
 static void
-handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
+handle_window_event (GdkWindow            *window,
+                     const MirWindowEvent *event)
 {
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
-  MirSurfaceState state;
+  MirWindowState state;
 
-  switch (mir_surface_event_get_attribute (event))
+  switch (mir_window_event_get_attribute (event))
     {
-    case mir_surface_attrib_type:
-      _gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
+    case mir_window_attrib_type:
+      _gdk_mir_window_impl_set_window_type (impl, mir_window_event_get_attribute_value (event));
       break;
-    case mir_surface_attrib_state:
-      state = mir_surface_event_get_attribute_value (event);
-      _gdk_mir_window_impl_set_surface_state (impl, state);
+    case mir_window_attrib_state:
+      state = mir_window_event_get_attribute_value (event);
+      _gdk_mir_window_impl_set_window_state (impl, state);
 
       switch (state)
         {
-        case mir_surface_state_restored:
-        case mir_surface_state_hidden:
+        case mir_window_state_restored:
+        case mir_window_state_hidden:
           gdk_synthesize_window_state (window,
                                        GDK_WINDOW_STATE_ICONIFIED |
                                        GDK_WINDOW_STATE_MAXIMIZED |
                                        GDK_WINDOW_STATE_FULLSCREEN,
                                        0);
           break;
-        case mir_surface_state_minimized:
+        case mir_window_state_minimized:
           gdk_synthesize_window_state (window,
                                        GDK_WINDOW_STATE_MAXIMIZED |
                                        GDK_WINDOW_STATE_FULLSCREEN,
                                        GDK_WINDOW_STATE_ICONIFIED);
           break;
-        case mir_surface_state_maximized:
-        case mir_surface_state_vertmaximized:
-        case mir_surface_state_horizmaximized:
+        case mir_window_state_maximized:
+        case mir_window_state_vertmaximized:
+        case mir_window_state_horizmaximized:
           gdk_synthesize_window_state (window,
                                        GDK_WINDOW_STATE_ICONIFIED |
                                        GDK_WINDOW_STATE_FULLSCREEN,
                                        GDK_WINDOW_STATE_MAXIMIZED);
           break;
-        case mir_surface_state_fullscreen:
+        case mir_window_state_fullscreen:
           gdk_synthesize_window_state (window,
                                        GDK_WINDOW_STATE_ICONIFIED |
                                        GDK_WINDOW_STATE_MAXIMIZED,
@@ -493,10 +494,10 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
         }
 
       break;
-    case mir_surface_attrib_swapinterval:
+    case mir_window_attrib_swapinterval:
       break;
-    case mir_surface_attrib_focus:
-      generate_focus_event (window, mir_surface_event_get_attribute_value (event) != 0);
+    case mir_window_attrib_focus:
+      generate_focus_event (window, mir_window_event_get_attribute_value (event) != 0);
       break;
     default:
       break;
@@ -537,17 +538,17 @@ handle_close_event (GdkWindow *window)
 }
 
 static void
-handle_surface_output_event (GdkWindow                  *window,
-                             const MirSurfaceOutputEvent *event)
+handle_window_output_event (GdkWindow                  *window,
+                            const MirWindowOutputEvent *event)
 {
-  _gdk_mir_window_set_surface_output (window, mir_surface_output_event_get_scale (event));
+  _gdk_mir_window_set_scale (window, mir_window_output_event_get_scale (event));
 }
 
 static void
-handle_surface_placement_event (GdkWindow                      *window,
-                                const MirSurfacePlacementEvent *event)
+handle_window_placement_event (GdkWindow                     *window,
+                               const MirWindowPlacementEvent *event)
 {
-  _gdk_mir_window_set_final_rect (window, mir_surface_placement_get_relative_position (event));
+  _gdk_mir_window_set_final_rect (window, mir_window_placement_get_relative_position (event));
 }
 
 typedef struct
@@ -591,8 +592,8 @@ gdk_mir_event_source_queue_event (GdkDisplay     *display,
     case mir_event_type_motion:
       handle_motion_event (window, mir_event_get_input_event (event));
       break;
-    case mir_event_type_surface:
-      handle_surface_event (window, mir_event_get_surface_event (event));
+    case mir_event_type_window:
+      handle_window_event (window, mir_event_get_window_event (event));
       break;
     case mir_event_type_resize:
       handle_resize_event (window, mir_event_get_resize_event (event));
@@ -603,14 +604,14 @@ gdk_mir_event_source_queue_event (GdkDisplay     *display,
     case mir_event_type_orientation:
       // FIXME?
       break;
-    case mir_event_type_close_surface:
+    case mir_event_type_close_window:
       handle_close_event (window);
       break;
-    case mir_event_type_surface_output:
-      handle_surface_output_event (window, mir_event_get_surface_output_event (event));
+    case mir_event_type_window_output:
+      handle_window_output_event (window, mir_event_get_window_output_event (event));
       break;
-    case mir_event_type_surface_placement:
-      handle_surface_placement_event (window, mir_event_get_surface_placement_event (event));
+    case mir_event_type_window_placement:
+      handle_window_placement_event (window, mir_event_get_window_placement_event (event));
       break;
     default:
       g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));
diff --git a/gdk/mir/gdkmirscreen.c b/gdk/mir/gdkmirscreen.c
index 979f2ba..21bb49f 100644
--- a/gdk/mir/gdkmirscreen.c
+++ b/gdk/mir/gdkmirscreen.c
@@ -46,7 +46,7 @@ struct GdkMirScreen
   GdkDisplay *display;
 
   /* Current monitor configuration */
-  MirDisplayConfiguration *display_config;
+  MirDisplayConfig *display_config;
 
   GdkVisual *visual;
 
@@ -67,9 +67,15 @@ get_connection (GdkMirScreen *screen)
 }
 
 static void
-get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
+get_screen_size (MirDisplayConfig *config,
+                 gint             *width,
+                 gint             *height)
 {
-  uint32_t i;
+  const MirOutput *output;
+  const MirOutputMode *mode;
+  gint right;
+  gint bottom;
+  gint i;
 
   *width = 0;
   *height = 0;
@@ -77,27 +83,33 @@ get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
   if (!config)
     return;
 
-  for (i = 0; i < config->num_outputs; i++)
+  for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
     {
-      MirDisplayOutput *o = &config->outputs[i];
-      gint w, h;
+      output = mir_display_config_get_output (config, i);
 
-      if (!o->used)
+      if (!mir_output_is_enabled (output))
         continue;
 
-      w = o->position_x + o->modes[o->current_mode].horizontal_resolution;
-      if (w > *width)
-        *width = w;
-      h = o->position_y + o->modes[o->current_mode].vertical_resolution;
-      if (h > *height)
-        *height = h;
+      mode = mir_output_get_current_mode (output);
+
+      right = mir_output_get_position_x (output) + mir_output_mode_get_width (mode);
+      bottom = mir_output_get_position_y (output) + mir_output_mode_get_height (mode);
+
+      if (right > *width)
+        *width = right;
+
+      if (bottom > *height)
+        *height = bottom;
     }
 }
 
 static void
-get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
+get_screen_size_mm (MirDisplayConfig *config,
+                    gint             *width,
+                    gint             *height)
 {
-  uint32_t i;
+  const MirOutput *output;
+  gint i;
 
   *width = 0;
   *height = 0;
@@ -105,15 +117,15 @@ get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
   if (!config)
     return;
 
-  for (i = 0; i < config->num_outputs; i++)
+  for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
     {
-      MirDisplayOutput *o = &config->outputs[i];
+      output = mir_display_config_get_output (config, i);
 
-      if (!o->used)
+      if (!mir_output_is_enabled (output))
         continue;
 
-      *width += o->physical_width_mm;
-      *height += o->physical_height_mm;
+      *width += mir_output_get_physical_width_mm (output);
+      *height += mir_output_get_physical_height_mm (output);
     }
 }
 
@@ -121,8 +133,8 @@ static void
 update_display_config (GdkMirScreen *screen)
 {
   gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
-  mir_display_config_destroy (screen->display_config);
-  screen->display_config = mir_connection_create_display_config (get_connection (screen));
+  mir_display_config_release (screen->display_config);
+  screen->display_config = mir_connection_create_display_configuration (get_connection (screen));
 }
 
 static void
@@ -165,7 +177,7 @@ gdk_mir_screen_finalize (GObject *object)
   GdkMirScreen *screen = GDK_MIR_SCREEN (object);
 
   mir_connection_set_display_config_change_callback (get_connection (screen), NULL, NULL);
-  mir_display_config_destroy (screen->display_config);
+  mir_display_config_release (screen->display_config);
   g_clear_object (&screen->visual);
   g_clear_object (&screen->root_window);
 
@@ -179,21 +191,27 @@ gdk_mir_screen_get_display (GdkScreen *screen)
   return GDK_DISPLAY (GDK_MIR_SCREEN (screen)->display);
 }
 
-static MirDisplayOutput *
-get_output (GdkScreen *screen, gint monitor_num)
+static const MirOutput *
+get_output (GdkScreen *screen,
+            gint       monitor_num)
 {
-  MirDisplayConfiguration *config;
-  uint32_t i, j;
+  MirDisplayConfig *config;
+  const MirOutput *output;
+  gint i;
+  gint j;
 
   config = GDK_MIR_SCREEN (screen)->display_config;
 
-  for (i = 0, j = 0; i < config->num_outputs; i++)
+  for (i = 0, j = 0; i < mir_display_config_get_num_outputs (config); i++)
     {
-      if (!config->outputs[i].used)
+      output = mir_display_config_get_output (config, i);
+
+      if (!mir_output_is_enabled (output))
         continue;
 
       if (j == monitor_num)
-        return &config->outputs[i];
+        return output;
+
       j++;
     }
 
@@ -277,15 +295,15 @@ static gint
 gdk_mir_screen_get_n_monitors (GdkScreen *screen)
 {
   //g_printerr ("gdk_mir_screen_get_n_monitors\n");
-  MirDisplayConfiguration *config;
-  uint32_t i;
+  MirDisplayConfig *config;
   gint count = 0;
+  gint i;
 
   config = GDK_MIR_SCREEN (screen)->display_config;
 
-  for (i = 0; i < config->num_outputs; i++)
-    if (config->outputs[i].used)
-      ++count;
+  for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
+    if (mir_output_is_enabled (mir_display_config_get_output (config, i)))
+      count++;
 
   return count;
 }
@@ -302,8 +320,9 @@ gdk_mir_screen_get_monitor_width_mm (GdkScreen *screen,
                                      gint       monitor_num)
 {
   //g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
-  MirDisplayOutput *output = get_output (screen, monitor_num);
-  return output ? output->physical_width_mm : 0;
+  const MirOutput *output = get_output (screen, monitor_num);
+
+  return output ? mir_output_get_physical_width_mm (output) : 0;
 }
 
 static gint
@@ -311,8 +330,9 @@ gdk_mir_screen_get_monitor_height_mm (GdkScreen *screen,
                                       gint       monitor_num)
 {
   //g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
-  MirDisplayOutput *output = get_output (screen, monitor_num);
-  return output ? output->physical_height_mm : 0;
+  const MirOutput *output = get_output (screen, monitor_num);
+
+  return output ? mir_output_get_physical_height_mm (output) : 0;
 }
 
 static gchar *
@@ -320,44 +340,44 @@ gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen,
                                       gint       monitor_num)
 {
   //g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
-  MirDisplayOutput *output = get_output (screen, monitor_num);
+  const MirOutput *output = get_output (screen, monitor_num);
 
   if (output)
     {
-      switch (output->type)
+      switch (mir_output_get_type (output))
         {
-          case mir_display_output_type_unknown:
-            return g_strdup_printf ("None-%u", output->output_id);
-          case mir_display_output_type_vga:
-            return g_strdup_printf ("VGA-%u", output->output_id);
-          case mir_display_output_type_dvii:
-          case mir_display_output_type_dvid:
-          case mir_display_output_type_dvia:
-            return g_strdup_printf ("DVI-%u", output->output_id);
-          case mir_display_output_type_composite:
-            return g_strdup_printf ("Composite-%u", output->output_id);
-          case mir_display_output_type_lvds:
-            return g_strdup_printf ("LVDS-%u", output->output_id);
-          case mir_display_output_type_component:
-            return g_strdup_printf ("CTV-%u", output->output_id);
-          case mir_display_output_type_ninepindin:
-            return g_strdup_printf ("DIN-%u", output->output_id);
-          case mir_display_output_type_displayport:
-            return g_strdup_printf ("DP-%u", output->output_id);
-          case mir_display_output_type_hdmia:
-          case mir_display_output_type_hdmib:
-            return g_strdup_printf ("HDMI-%u", output->output_id);
-          case mir_display_output_type_svideo:
-          case mir_display_output_type_tv:
-            return g_strdup_printf ("TV-%u", output->output_id);
-          case mir_display_output_type_edp:
-            return g_strdup_printf ("eDP-%u", output->output_id);
-          case mir_display_output_type_virtual:
-            return g_strdup_printf ("Virtual-%u", output->output_id);
-          case mir_display_output_type_dsi:
-            return g_strdup_printf ("DSI-%u", output->output_id);
-          case mir_display_output_type_dpi:
-            return g_strdup_printf ("DPI-%u", output->output_id);
+          case mir_output_type_unknown:
+            return g_strdup_printf ("None-%u", mir_output_get_id (output));
+          case mir_output_type_vga:
+            return g_strdup_printf ("VGA-%u", mir_output_get_id (output));
+          case mir_output_type_dvii:
+          case mir_output_type_dvid:
+          case mir_output_type_dvia:
+            return g_strdup_printf ("DVI-%u", mir_output_get_id (output));
+          case mir_output_type_composite:
+            return g_strdup_printf ("Composite-%u", mir_output_get_id (output));
+          case mir_output_type_lvds:
+            return g_strdup_printf ("LVDS-%u", mir_output_get_id (output));
+          case mir_output_type_component:
+            return g_strdup_printf ("CTV-%u", mir_output_get_id (output));
+          case mir_output_type_ninepindin:
+            return g_strdup_printf ("DIN-%u", mir_output_get_id (output));
+          case mir_output_type_displayport:
+            return g_strdup_printf ("DP-%u", mir_output_get_id (output));
+          case mir_output_type_hdmia:
+          case mir_output_type_hdmib:
+            return g_strdup_printf ("HDMI-%u", mir_output_get_id (output));
+          case mir_output_type_svideo:
+          case mir_output_type_tv:
+            return g_strdup_printf ("TV-%u", mir_output_get_id (output));
+          case mir_output_type_edp:
+            return g_strdup_printf ("eDP-%u", mir_output_get_id (output));
+          case mir_output_type_virtual:
+            return g_strdup_printf ("Virtual-%u", mir_output_get_id (output));
+          case mir_output_type_dsi:
+            return g_strdup_printf ("DSI-%u", mir_output_get_id (output));
+          case mir_output_type_dpi:
+            return g_strdup_printf ("DPI-%u", mir_output_get_id (output));
         }
     }
 
@@ -370,18 +390,19 @@ gdk_mir_screen_get_monitor_geometry (GdkScreen    *screen,
                                      GdkRectangle *dest)
 {
   //g_printerr ("gdk_mir_screen_get_monitor_geometry (%d)\n", monitor_num);
-  MirDisplayOutput *output;
-  MirDisplayMode *mode;
+  const MirOutput *output;
+  const MirOutputMode *mode;
 
   output = get_output (screen, monitor_num);
 
   if (output)
     {
-      mode = &output->modes[output->current_mode];
-      dest->x = output->position_x;
-      dest->y = output->position_y;
-      dest->width = mode->horizontal_resolution;
-      dest->height = mode->vertical_resolution;
+      mode = mir_output_get_current_mode (output);
+
+      dest->x = mir_output_get_position_x (output);
+      dest->y = mir_output_get_position_y (output);
+      dest->width = mir_output_mode_get_width (mode);
+      dest->height = mir_output_mode_get_height (mode);
     }
   else
     {
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 1b016ec..aad9e01 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -90,9 +90,9 @@ struct _GdkMirWindowImpl
   gint                rect_anchor_dx;
   gint                rect_anchor_dy;
 
-  /* Desired surface attributes */
+  /* Desired window attributes */
   GdkWindowTypeHint type_hint;
-  MirSurfaceState surface_state;
+  MirWindowState window_state;
   gboolean modal;
 
   /* Pattern for background */
@@ -105,8 +105,8 @@ struct _GdkMirWindowImpl
 
   GdkDisplay *display;
 
-  /* Surface being rendered to (only exists when window visible) */
-  MirSurface *surface;
+  /* Window being rendered to (only exists when visible) */
+  MirWindow *mir_window;
   MirBufferStream *buffer_stream;
   MirBufferUsage buffer_usage;
 
@@ -118,7 +118,7 @@ struct _GdkMirWindowImpl
   GdkGeometry geometry_hints;
   GdkWindowHints geometry_mask;
 
-  /* Egl surface for the current mir surface */
+  /* Egl surface for the current mir window */
   EGLSurface egl_surface;
 
   /* Dummy MIR and EGL surfaces */
@@ -142,8 +142,7 @@ struct _GdkMirWindowImplClass
 G_DEFINE_TYPE (GdkMirWindowImpl, gdk_mir_window_impl, GDK_TYPE_WINDOW_IMPL)
 
 static cairo_surface_t *gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window);
-static void ensure_surface (GdkWindow *window);
-static void apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl);
+static void ensure_mir_window (GdkWindow *window);
 
 static gboolean
 type_hint_differs (GdkWindowTypeHint lhs, GdkWindowTypeHint rhs)
@@ -228,14 +227,15 @@ _gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr
 }
 
 void
-_gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state)
+_gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl,
+                                       MirWindowState    state)
 {
-  impl->surface_state = state;
+  impl->window_state = state;
 }
 
 void
-_gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl,
-                                       MirSurfaceType    type)
+_gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl,
+                                      MirWindowType     type)
 {
 }
 
@@ -274,37 +274,40 @@ gdk_mir_window_impl_init (GdkMirWindowImpl *impl)
 {
   impl->properties = g_hash_table_new_full (NULL, NULL, NULL, gdk_mir_property_free);
   impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
-  impl->surface_state = mir_surface_state_unknown;
+  impl->window_state = mir_window_state_unknown;
   impl->output_scale = 1;
 }
 
 static void
-set_surface_state (GdkMirWindowImpl *impl,
-                   MirSurfaceState state)
+set_window_state (GdkMirWindowImpl *impl,
+                  MirWindowState    state)
 {
   MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
-  if (impl->surface_state == state)
+  MirWindowSpec *spec;
+
+  if (state == impl->window_state)
     return;
 
-  impl->surface_state = state;
-  if (impl->surface && !impl->pending_spec_update)
+  impl->window_state = state;
+
+  if (impl->mir_window && !impl->pending_spec_update)
     {
-      MirSurfaceSpec *spec = mir_connection_create_spec_for_changes (connection);
-      mir_surface_spec_set_state (spec, state);
-      mir_surface_apply_spec (impl->surface, spec);
-      mir_surface_spec_release (spec);
+      spec = mir_create_window_spec (connection);
+      mir_window_spec_set_state (spec, state);
+      mir_window_apply_spec (impl->mir_window, spec);
+      mir_window_spec_release (spec);
     }
 }
 
 static void
-event_cb (MirSurface     *surface,
+event_cb (MirWindow      *mir_window,
           const MirEvent *event,
           void           *context)
 {
   _gdk_mir_event_source_queue (context, event);
 }
 
-static MirSurfaceSpec *
+static MirWindowSpec *
 create_window_type_spec (GdkDisplay *display,
                          GdkWindow *parent,
                          gint x,
@@ -316,17 +319,18 @@ create_window_type_spec (GdkDisplay *display,
                          MirBufferUsage buffer_usage)
 {
   MirConnection *connection = gdk_mir_display_get_mir_connection (display);
-  MirSurface *parent_surface = NULL;
+  MirWindow *parent_mir_window = NULL;
   MirPixelFormat format;
   MirRectangle rect;
+  MirWindowSpec *spec;
 
   if (parent && parent->impl)
     {
-      ensure_surface (parent);
-      parent_surface = GDK_MIR_WINDOW_IMPL (parent->impl)->surface;
+      ensure_mir_window (parent);
+      parent_mir_window = GDK_MIR_WINDOW_IMPL (parent->impl)->mir_window;
     }
 
-  if (!parent_surface)
+  if (!parent_mir_window)
     {
       switch (type)
         {
@@ -350,21 +354,20 @@ create_window_type_spec (GdkDisplay *display,
     {
       case GDK_WINDOW_TYPE_HINT_DIALOG:
         if (modal)
-          return mir_connection_create_spec_for_modal_dialog (connection,
-                                                              width,
-                                                              height,
-                                                              format,
-                                                              parent_surface);
-        else
-          return mir_connection_create_spec_for_dialog (connection,
-                                                        width,
-                                                        height,
-                                                        format);
-      case GDK_WINDOW_TYPE_HINT_DOCK:
-        return mir_connection_create_spec_for_dialog (connection,
+          spec = mir_create_modal_dialog_window_spec (connection,
                                                       width,
                                                       height,
-                                                      format);
+                                                      parent_mir_window);
+        else
+          spec = mir_create_dialog_window_spec (connection,
+                                                width,
+                                                height);
+        break;
+      case GDK_WINDOW_TYPE_HINT_DOCK:
+        spec = mir_create_dialog_window_spec (connection,
+                                              width,
+                                              height);
+        break;
       case GDK_WINDOW_TYPE_HINT_MENU:
       case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
       case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
@@ -373,59 +376,65 @@ create_window_type_spec (GdkDisplay *display,
       case GDK_WINDOW_TYPE_HINT_DND:
       case GDK_WINDOW_TYPE_HINT_TOOLTIP:
       case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
-        return mir_connection_create_spec_for_menu (connection,
-                                                    width,
-                                                    height,
-                                                    format,
-                                                    parent_surface,
-                                                    &rect,
-                                                    0);
+        spec = mir_create_menu_window_spec (connection,
+                                            width,
+                                            height,
+                                            parent_mir_window,
+                                            &rect,
+                                            0);
+        break;
       case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
       case GDK_WINDOW_TYPE_HINT_UTILITY:
-        return mir_connection_create_spec_for_modal_dialog (connection,
-                                                            width,
-                                                            height,
-                                                            format,
-                                                            parent_surface);
+        spec = mir_create_modal_dialog_window_spec (connection,
+                                                    width,
+                                                    height,
+                                                    parent_mir_window);
+        break;
       case GDK_WINDOW_TYPE_HINT_NORMAL:
       case GDK_WINDOW_TYPE_HINT_DESKTOP:
       default:
-        return mir_connection_create_spec_for_normal_surface (connection,
-                                                              width,
-                                                              height,
-                                                              format);
+        spec = mir_create_normal_window_spec (connection,
+                                              width,
+                                              height);
+        break;
     }
+
+  mir_window_spec_set_pixel_format (spec, format);
+
+  return spec;
 }
 
 static void
-apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl)
+apply_geometry_hints (MirWindowSpec    *spec,
+                      GdkMirWindowImpl *impl)
 {
   if (impl->geometry_mask & GDK_HINT_RESIZE_INC)
     {
-      mir_surface_spec_set_width_increment (spec, impl->geometry_hints.width_inc);
-      mir_surface_spec_set_height_increment (spec, impl->geometry_hints.height_inc);
+      mir_window_spec_set_width_increment (spec, impl->geometry_hints.width_inc);
+      mir_window_spec_set_height_increment (spec, impl->geometry_hints.height_inc);
     }
   if (impl->geometry_mask & GDK_HINT_MIN_SIZE)
     {
-      mir_surface_spec_set_min_width (spec, impl->geometry_hints.min_width);
-      mir_surface_spec_set_min_height (spec, impl->geometry_hints.min_height);
+      mir_window_spec_set_min_width (spec, impl->geometry_hints.min_width);
+      mir_window_spec_set_min_height (spec, impl->geometry_hints.min_height);
     }
   if (impl->geometry_mask & GDK_HINT_MAX_SIZE)
     {
-      mir_surface_spec_set_max_width (spec, impl->geometry_hints.max_width);
-      mir_surface_spec_set_max_height (spec, impl->geometry_hints.max_height);
+      mir_window_spec_set_max_width (spec, impl->geometry_hints.max_width);
+      mir_window_spec_set_max_height (spec, impl->geometry_hints.max_height);
     }
   if (impl->geometry_mask & GDK_HINT_ASPECT)
     {
-      mir_surface_spec_set_min_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.min_aspect));
-      mir_surface_spec_set_max_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.max_aspect));
+      mir_window_spec_set_min_aspect_ratio (spec, (guint) 1000 * impl->geometry_hints.min_aspect, 1000);
+      mir_window_spec_set_max_aspect_ratio (spec, (guint) 1000 * impl->geometry_hints.max_aspect, 1000);
     }
 }
 
-static MirSurfaceSpec*
-create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
+static MirWindowSpec *
+create_spec (GdkWindow        *window,
+             GdkMirWindowImpl *impl)
 {
-  MirSurfaceSpec *spec = NULL;
+  MirWindowSpec *spec = NULL;
   GdkWindow *parent;
 
   spec = create_window_type_spec (impl->display,
@@ -438,8 +447,8 @@ create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
                                   impl->type_hint,
                                   impl->buffer_usage);
 
-  mir_surface_spec_set_name (spec, impl->title);
-  mir_surface_spec_set_buffer_usage (spec, impl->buffer_usage);
+  mir_window_spec_set_name (spec, impl->title);
+  mir_window_spec_set_buffer_usage (spec, impl->buffer_usage);
 
   apply_geometry_hints (spec, impl);
 
@@ -460,33 +469,34 @@ create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
           parent = gdk_window_get_parent (parent);
         }
 
-      mir_surface_spec_set_placement (spec,
-                                      &impl->mir_rect,
-                                      impl->rect_anchor,
-                                      impl->window_anchor,
-                                      impl->anchor_hints,
-                                      impl->rect_anchor_dx,
-                                      impl->rect_anchor_dy);
+      mir_window_spec_set_placement (spec,
+                                     &impl->mir_rect,
+                                     impl->rect_anchor,
+                                     impl->window_anchor,
+                                     impl->anchor_hints,
+                                     impl->rect_anchor_dx,
+                                     impl->rect_anchor_dy);
     }
 
   return spec;
 }
 
 static void
-update_surface_spec (GdkWindow *window)
+update_window_spec (GdkWindow *window)
 {
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
-  MirSurfaceSpec *spec;
+  MirWindowSpec *spec;
 
-  if (!impl->surface)
+  if (!impl->mir_window)
     return;
 
   spec = create_spec (window, impl);
 
-  mir_surface_apply_spec (impl->surface, spec);
-  mir_surface_spec_release (spec);
+  mir_window_apply_spec (impl->mir_window, spec);
+  mir_window_spec_release (spec);
+
   impl->pending_spec_update = FALSE;
-  impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
+  impl->buffer_stream = mir_window_get_buffer_stream (impl->mir_window);
 }
 
 static GdkDevice *
@@ -535,17 +545,17 @@ generate_configure_event (GdkWindow *window,
 }
 
 static void
-ensure_surface_full (GdkWindow *window,
-                     MirBufferUsage buffer_usage)
+ensure_mir_window_full (GdkWindow      *window,
+                        MirBufferUsage  buffer_usage)
 {
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
   GdkMirWindowReference *window_ref;
-  MirSurfaceSpec *spec;
+  MirWindowSpec *spec;
 
-  if (impl->surface)
+  if (impl->mir_window)
     {
       if (impl->pending_spec_update)
-        update_surface_spec(window);
+        update_window_spec (window);
       return;
     }
 
@@ -557,12 +567,12 @@ ensure_surface_full (GdkWindow *window,
 
   spec = create_spec (window, impl);
 
-  impl->surface = mir_surface_create_sync (spec);
+  impl->mir_window = mir_create_window_sync (spec);
 
-  mir_surface_spec_release(spec);
+  mir_window_spec_release (spec);
 
   impl->pending_spec_update = FALSE;
-  impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
+  impl->buffer_stream = mir_window_get_buffer_stream (impl->mir_window);
 
   /* FIXME: can't make an initial resize event */
   // MirEvent *resize_event;
@@ -580,20 +590,21 @@ ensure_surface_full (GdkWindow *window,
 
   generate_configure_event (window, window->width, window->height);
 
-  mir_surface_set_event_handler (impl->surface, event_cb, window_ref); // FIXME: Ignore some events until 
shown
+  /* FIXME: Ignore some events until shown */
+  mir_window_set_event_handler (impl->mir_window, event_cb, window_ref);
 }
 
 static void
-ensure_surface (GdkWindow *window)
+ensure_mir_window (GdkWindow *window)
 {
-  ensure_surface_full (window,
-                       window->gl_paint_context ?
-                         mir_buffer_usage_hardware :
-                         mir_buffer_usage_software);
+  ensure_mir_window_full (window,
+                          window->gl_paint_context ?
+                          mir_buffer_usage_hardware :
+                          mir_buffer_usage_software);
 }
 
 static void
-ensure_no_surface (GdkWindow *window)
+ensure_no_mir_window (GdkWindow *window)
 {
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
 
@@ -621,7 +632,7 @@ ensure_no_surface (GdkWindow *window)
         }
     }
 
-  g_clear_pointer(&impl->surface, mir_surface_release_sync);
+  g_clear_pointer (&impl->mir_window, mir_window_release_sync);
 }
 
 static void
@@ -630,12 +641,12 @@ send_buffer (GdkWindow *window)
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
 
   /* Send the completed buffer to Mir */
-  mir_buffer_stream_swap_buffers_sync (mir_surface_get_buffer_stream (impl->surface));
+  mir_buffer_stream_swap_buffers_sync (mir_window_get_buffer_stream (impl->mir_window));
 
   /* The Cairo context is no longer valid */
   g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
   if (impl->pending_spec_update)
-    update_surface_spec (window);
+    update_window_spec (window);
 
   impl->pending_spec_update = FALSE;
 }
@@ -656,7 +667,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
       return impl->cairo_surface;
     }
 
-  ensure_surface (window);
+  ensure_mir_window (window);
 
   if (window->gl_paint_context)
     {
@@ -665,7 +676,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
     }
   else if (impl->visible)
     {
-      mir_buffer_stream_get_graphics_region (mir_surface_get_buffer_stream (impl->surface), &region);
+      mir_buffer_stream_get_graphics_region (mir_window_get_buffer_stream (impl->mir_window), &region);
 
       switch (region.pixel_format)
         {
@@ -743,13 +754,10 @@ gdk_mir_window_impl_finalize (GObject *object)
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
 
   g_free (impl->title);
-  if (impl->background)
-    cairo_pattern_destroy (impl->background);
-  if (impl->surface)
-    mir_surface_release_sync (impl->surface);
-  if (impl->cairo_surface)
-    cairo_surface_destroy (impl->cairo_surface);
 
+  g_clear_pointer (&impl->background, cairo_pattern_destroy);
+  g_clear_pointer (&impl->mir_window, mir_window_release_sync);
+  g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
   g_clear_pointer (&impl->properties, g_hash_table_unref);
 
   G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object);
@@ -765,10 +773,10 @@ gdk_mir_window_impl_show (GdkWindow *window,
   //g_printerr ("gdk_mir_window_impl_show window=%p\n", window);
 
   impl->visible = TRUE;
-  set_surface_state (impl, mir_surface_state_restored);
+  set_window_state (impl, mir_window_state_restored);
 
-  /* Make sure there's a surface to see */
-  ensure_surface (window);
+  /* Make sure there's a window to see */
+  ensure_mir_window (window);
 
   if (!window->gl_paint_context)
   {
@@ -788,7 +796,7 @@ gdk_mir_window_impl_hide (GdkWindow *window)
   impl->cursor_inside = FALSE;
   impl->visible = FALSE;
 
-  set_surface_state (impl, mir_surface_state_hidden);
+  set_window_state (impl, mir_window_state_hidden);
 }
 
 static void
@@ -800,7 +808,7 @@ gdk_mir_window_impl_withdraw (GdkWindow *window)
   impl->cursor_inside = FALSE;
   impl->visible = FALSE;
 
-  set_surface_state (impl, mir_surface_state_hidden);
+  set_window_state (impl, mir_window_state_hidden);
 }
 
 static void
@@ -853,7 +861,7 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
   */
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
 
-  /* If resize requested then rebuild surface */
+  /* If resize requested then rebuild window */
   if (width >= 0 && (window->width != width || window->height != height))
   {
     /* We accept any resize */
@@ -870,8 +878,8 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
           impl->has_rect = FALSE;
           impl->transient_x = x;
           impl->transient_y = y;
-          if (!impl->pending_spec_update && impl->surface)
-            update_surface_spec (window);
+          if (!impl->pending_spec_update && impl->mir_window)
+            update_window_spec (window);
         }
     }
 }
@@ -1008,8 +1016,8 @@ gdk_mir_window_impl_move_to_rect (GdkWindow          *window,
   impl->rect_anchor_dx = rect_anchor_dx + get_window_shadow_dx (window, window_anchor);
   impl->rect_anchor_dy = rect_anchor_dy + get_window_shadow_dy (window, window_anchor);
 
-  if (impl->surface && !impl->pending_spec_update)
-    update_surface_spec (window);
+  if (impl->mir_window && !impl->pending_spec_update)
+    update_window_spec (window);
 }
 
 static gint
@@ -1261,25 +1269,20 @@ gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
                                        GdkDevice *device,
                                        GdkCursor *cursor)
 {
+  GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
+  MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
+  MirWindowSpec *spec;
   const gchar *cursor_name;
-  MirCursorConfiguration *configuration;
 
   if (cursor)
     cursor_name = _gdk_mir_cursor_get_name (cursor);
   else
     cursor_name = mir_default_cursor_name;
 
-  configuration = mir_cursor_configuration_from_name (cursor_name);
-
-  if (configuration)
-    {
-      GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
-      if (impl->surface)
-        mir_surface_configure_cursor (impl->surface, configuration);
-
-      mir_cursor_configuration_destroy (configuration);
-    }
+  spec = mir_create_window_spec (connection);
+  mir_window_spec_set_cursor_name (spec, cursor_name);
+  mir_window_apply_spec (impl->mir_window, spec);
+  mir_window_spec_release (spec);
 }
 
 static void
@@ -1390,7 +1393,7 @@ gdk_mir_window_impl_destroy (GdkWindow *window,
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
 
   impl->visible = FALSE;
-  ensure_no_surface (window);
+  ensure_no_mir_window (window);
 }
 
 static void
@@ -1415,8 +1418,9 @@ gdk_mir_window_impl_set_type_hint (GdkWindow         *window,
   if (type_hint_differs (hint, impl->type_hint))
     {
       impl->type_hint = hint;
-      if (impl->surface && !impl->pending_spec_update)
-        update_surface_spec (window);
+
+      if (impl->mir_window && !impl->pending_spec_update)
+        update_window_spec (window);
     }
 }
 
@@ -1438,8 +1442,8 @@ gdk_mir_window_impl_set_modal_hint (GdkWindow *window,
     {
       impl->modal = modal;
 
-      if (impl->surface && !impl->pending_spec_update)
-        update_surface_spec (window);
+      if (impl->mir_window && !impl->pending_spec_update)
+        update_window_spec (window);
     }
 }
 
@@ -1471,17 +1475,18 @@ gdk_mir_window_impl_set_geometry_hints (GdkWindow         *window,
 {
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
   MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
+  MirWindowSpec *spec;
   //g_printerr ("gdk_mir_window_impl_set_geometry_hints window=%p impl=%p\n", window, impl);
 
   impl->geometry_hints = *geometry;
   impl->geometry_mask = geom_mask;
 
-  if (impl->surface && !impl->pending_spec_update)
+  if (impl->mir_window && !impl->pending_spec_update)
     {
-       MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection);
+       spec = mir_create_window_spec (connection);
        apply_geometry_hints (spec, impl);
-       mir_surface_apply_spec (impl->surface, spec);
-       mir_surface_spec_release (spec);
+       mir_window_apply_spec (impl->mir_window, spec);
+       mir_window_spec_release (spec);
     }
 }
 
@@ -1491,16 +1496,18 @@ gdk_mir_window_impl_set_title (GdkWindow   *window,
 {
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
   MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
+  MirWindowSpec *spec;
   //g_printerr ("gdk_mir_window_impl_set_title window=%p\n", window);
 
   g_free (impl->title);
   impl->title = g_strdup (title);
-  if (impl->surface && !impl->pending_spec_update)
+
+  if (impl->mir_window && !impl->pending_spec_update)
     {
-       MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection);
-       mir_surface_spec_set_name (spec, impl->title);
-       mir_surface_apply_spec (impl->surface, spec);
-       mir_surface_spec_release (spec);
+       spec = mir_create_window_spec (connection);
+       mir_window_spec_set_name (spec, impl->title);
+       mir_window_apply_spec (impl->mir_window, spec);
+       mir_window_spec_release (spec);
     }
 }
 
@@ -1531,8 +1538,8 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
   /* Link this window to the parent */
   impl->transient_for = parent;
 
-  if (impl->surface && !impl->pending_spec_update)
-    update_surface_spec (window);
+  if (impl->mir_window && !impl->pending_spec_update)
+    update_window_spec (window);
 }
 
 static void
@@ -1612,21 +1619,21 @@ static void
 gdk_mir_window_impl_maximize (GdkWindow *window)
 {
   //g_printerr ("gdk_mir_window_impl_maximize window=%p\n", window);
-  set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_maximized);
+  set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_maximized);
 }
 
 static void
 gdk_mir_window_impl_unmaximize (GdkWindow *window)
 {
   //g_printerr ("gdk_mir_window_impl_unmaximize window=%p\n", window);
-  set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_restored);
+  set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_restored);
 }
 
 static void
 gdk_mir_window_impl_fullscreen (GdkWindow *window)
 {
   //g_printerr ("gdk_mir_window_impl_fullscreen window=%p\n", window);
-  set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_fullscreen);
+  set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_fullscreen);
 }
 
 static void
@@ -1639,7 +1646,7 @@ static void
 gdk_mir_window_impl_unfullscreen (GdkWindow *window)
 {
   //g_printerr ("gdk_mir_window_impl_unfullscreen window=%p\n", window);
-  set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_restored);
+  set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_restored);
 }
 
 static void
@@ -2328,8 +2335,8 @@ _gdk_mir_window_get_egl_surface (GdkWindow *window,
       EGLDisplay egl_display;
       EGLNativeWindowType egl_window;
 
-      ensure_no_surface (window);
-      ensure_surface_full (window, mir_buffer_usage_hardware);
+      ensure_no_mir_window (window);
+      ensure_mir_window_full (window, mir_buffer_usage_hardware);
 
       egl_display = _gdk_mir_display_get_egl_display (gdk_window_get_display (window));
       egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (impl->buffer_stream);
@@ -2369,23 +2376,26 @@ _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window,
 MirSurface *
 gdk_mir_window_get_mir_surface (GdkWindow *window)
 {
-  GdkMirWindowImpl *impl;
+  return _gdk_mir_window_get_mir_window (window);
+}
 
+MirWindow *
+_gdk_mir_window_get_mir_window (GdkWindow *window)
+{
   g_return_val_if_fail (GDK_IS_MIR_WINDOW (window), NULL);
 
-  impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
-  return impl->surface;
+  return GDK_MIR_WINDOW_IMPL (window->impl)->mir_window;
 }
 
 void
-_gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale)
+_gdk_mir_window_set_scale (GdkWindow *window,
+                           gdouble    scale)
 {
-  // g_printerr ("_gdk_mir_window_impl_set_surface_output impl=%p\n", impl);
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
   GdkRectangle area = {0, 0, window->width, window->height};
   cairo_region_t *region;
   gint new_scale = (gint) round (scale);
+  // g_printerr ("_gdk_mir_window_set_scale impl=%p\n", impl);
 
   if (impl->output_scale != new_scale)
     {


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