[clutter/fosdem-2012] wayland: Save the output mode so that it can be used to fullscreen windows



commit 0c63c0f40f93876ceea9f9812bbf444cfedf1bae
Author: Rob Bradford <rob linux intel com>
Date:   Fri Jan 20 18:22:50 2012 +0000

    wayland: Save the output mode so that it can be used to fullscreen windows

 clutter/wayland/clutter-backend-wayland.c |   52 +++++++++++++++++++++++++++--
 clutter/wayland/clutter-backend-wayland.h |    5 +++
 2 files changed, 54 insertions(+), 3 deletions(-)
---
diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c
index 540976f..3d04734 100644
--- a/clutter/wayland/clutter-backend-wayland.c
+++ b/clutter/wayland/clutter-backend-wayland.c
@@ -69,6 +69,42 @@ clutter_backend_wayland_dispose (GObject *gobject)
 }
 
 
+static void
+output_handle_mode (void             *data,
+                    struct wl_output *wl_output,
+                    uint32_t          flags,
+                    int               width,
+                    int               height,
+                    int               refresh)
+{
+  ClutterBackendWayland *backend_wayland = data;
+
+  if (flags & WL_OUTPUT_MODE_CURRENT)
+    {
+      backend_wayland->output_width = width;
+      backend_wayland->output_height = height;
+    }
+}
+
+static void
+output_handle_geometry (void             *data,
+                        struct wl_output *wl_output,
+                        int               x,
+                        int               y,
+                        int               physical_width,
+                        int               physical_height,
+                        int               subpixel,
+                        const char       *make,
+                        const char       *model)
+{
+}
+
+
+static const struct wl_output_listener wayland_output_listener = {
+  output_handle_geometry,
+  output_handle_mode,
+};
+
 
 static void
 display_handle_global (struct wl_display *display,
@@ -91,11 +127,21 @@ display_handle_global (struct wl_display *display,
     {
       backend_wayland->wayland_shell =
         wl_display_bind (display, id, &wl_shell_interface);
-
     }
   else if (strcmp (interface, "wl_shm") == 0)
-    backend_wayland->wayland_shm =
-      wl_display_bind (display, id, &wl_shm_interface);
+    {
+      backend_wayland->wayland_shm =
+        wl_display_bind (display, id, &wl_shm_interface);
+    }
+  else if (strcmp (interface, "wl_output") == 0)
+    {
+      /* FIXME: Support multiple outputs */
+      backend_wayland->wayland_output =
+        wl_display_bind (display, id, &wl_output_interface);
+      wl_output_add_listener (backend_wayland->wayland_output,
+                              &wayland_output_listener,
+                              backend_wayland);
+    }
 }
 
 static gboolean
diff --git a/clutter/wayland/clutter-backend-wayland.h b/clutter/wayland/clutter-backend-wayland.h
index 53dd2e0..19dea0e 100644
--- a/clutter/wayland/clutter-backend-wayland.h
+++ b/clutter/wayland/clutter-backend-wayland.h
@@ -56,6 +56,11 @@ struct _ClutterBackendWayland
   struct wl_compositor *wayland_compositor;
   struct wl_shell *wayland_shell;
   struct wl_shm *wayland_shm;
+  struct wl_output *wayland_output;
+
+  gint cursor_x, cursor_y;
+  gint output_width, output_height;
+
   GSource *wayland_source;
 
   /* event timer */



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