[mutter/wip/tablet-protocol-v3: 1/18] Port to wayland-protocols



commit 5dedaeeb20007b95eda7b736fb9d5b4a066f1ace
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Nov 6 12:02:39 2015 +0100

    Port to wayland-protocols
    
    We use 2 protocols there, xdg-shell and pointer-gestures. Replace
    our own copies of these by the installed ones.

 configure.ac                                     |    5 +-
 src/Makefile.am                                  |   18 +-
 src/wayland/meta-wayland-pointer-gesture-pinch.c |   30 +-
 src/wayland/meta-wayland-pointer-gesture-swipe.c |   26 +-
 src/wayland/meta-wayland-pointer-gestures.c      |   17 +-
 src/wayland/meta-wayland-surface.c               |    8 +-
 src/wayland/meta-wayland-versions.h              |    2 +-
 src/wayland/protocol/pointer-gestures.xml        |  176 --------
 src/wayland/protocol/xdg-shell.xml               |  485 ----------------------
 9 files changed, 56 insertions(+), 711 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b8ff64d..8585be4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,7 +203,7 @@ AS_IF([test "$have_native_backend" = "yes"], [
 ])
 AM_CONDITIONAL([HAVE_NATIVE_BACKEND],[test "$have_native_backend" = "yes"])
 
-MUTTER_WAYLAND_MODULES="clutter-wayland-1.0 clutter-wayland-compositor-1.0 wayland-server >= 1.6.90"
+MUTTER_WAYLAND_MODULES="clutter-wayland-1.0 clutter-wayland-compositor-1.0 wayland-server >= 1.6.90 
wayland-protocols"
 
 AC_ARG_ENABLE(wayland,
   AS_HELP_STRING([--disable-wayland], [disable mutter on wayland support]),,
@@ -219,6 +219,9 @@ AS_IF([test "$have_wayland" = "yes"], [
     [AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension 
protocols])])
   AC_SUBST([WAYLAND_SCANNER])
   AC_DEFINE([HAVE_WAYLAND],[1],[Define if you want to enable Wayland support])
+
+  WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
+  AC_SUBST([WAYLAND_PROTOCOLS_DIR])
 ])
 AM_CONDITIONAL([HAVE_WAYLAND],[test "$have_wayland" = "yes"])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 3e48bd0..0462cc4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,9 +55,12 @@ mutter_built_sources += \
 endif
 
 wayland_protocols =                            \
-       wayland/protocol/pointer-gestures.xml   \
+       $(WAYLAND_PROTOCOLS_DIR)/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml \
+       $(WAYLAND_PROTOCOLS_DIR)/unstable/xdg-shell/xdg-shell-unstable-v5.xml \
+       $(NULL)
+
+internal_wayland_protocols =                   \
        wayland/protocol/gtk-shell.xml          \
-       wayland/protocol/xdg-shell.xml          \
        $(NULL)
 
 libmutter_la_SOURCES =                         \
@@ -420,7 +423,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libmutter.pc
 
 EXTRA_DIST +=                                  \
-       $(wayland_protocols)                    \
+       $(internal_wayland_protocols)           \
        libmutter.pc.in                         \
        meta-enum-types.h.in                    \
        meta-enum-types.c.in                    \
@@ -481,6 +484,15 @@ $(dbus_login1_built_sources) : Makefile.am org.freedesktop.login1.xml
                --generate-c-code meta-dbus-login1                                      \
                $(srcdir)/org.freedesktop.login1.xml
 
+pointer-gestures-protocol.c: 
$(WAYLAND_PROTOCOLS_DIR)/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+pointer-gestures-server-protocol.h: 
$(WAYLAND_PROTOCOLS_DIR)/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@
+xdg-shell-protocol.c: $(WAYLAND_PROTOCOLS_DIR)/unstable/xdg-shell/xdg-shell-unstable-v5.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+xdg-shell-server-protocol.h: $(WAYLAND_PROTOCOLS_DIR)/unstable/xdg-shell/xdg-shell-unstable-v5.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@
+
 %-protocol.c : $(srcdir)/wayland/protocol/%.xml
        $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
 %-server-protocol.h : $(srcdir)/wayland/protocol/%.xml
diff --git a/src/wayland/meta-wayland-pointer-gesture-pinch.c 
b/src/wayland/meta-wayland-pointer-gesture-pinch.c
index 37022c9..1ee8b44 100644
--- a/src/wayland/meta-wayland-pointer-gesture-pinch.c
+++ b/src/wayland/meta-wayland-pointer-gesture-pinch.c
@@ -45,10 +45,10 @@ handle_pinch_begin (MetaWaylandPointer *pointer,
 
   wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
     {
-      _wl_pointer_gesture_pinch_send_begin (resource, serial,
-                                            clutter_event_get_time (event),
-                                            pointer->focus_surface->resource,
-                                            2);
+      zwl_pointer_gesture_pinch1_send_begin (resource, serial,
+                                             clutter_event_get_time (event),
+                                             pointer->focus_surface->resource,
+                                             2);
     }
 }
 
@@ -67,12 +67,12 @@ handle_pinch_update (MetaWaylandPointer *pointer,
 
   wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
     {
-      _wl_pointer_gesture_pinch_send_update (resource,
-                                             clutter_event_get_time (event),
-                                             wl_fixed_from_double (dx),
-                                             wl_fixed_from_double (dy),
-                                             wl_fixed_from_double (scale),
-                                             wl_fixed_from_double (rotation));
+      zwl_pointer_gesture_pinch1_send_update (resource,
+                                              clutter_event_get_time (event),
+                                              wl_fixed_from_double (dx),
+                                              wl_fixed_from_double (dy),
+                                              wl_fixed_from_double (scale),
+                                              wl_fixed_from_double (rotation));
     }
 }
 
@@ -93,9 +93,9 @@ handle_pinch_end (MetaWaylandPointer *pointer,
 
   wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
     {
-      _wl_pointer_gesture_pinch_send_end (resource, serial,
-                                          clutter_event_get_time (event),
-                                          cancelled);
+      zwl_pointer_gesture_pinch1_send_end (resource, serial,
+                                           clutter_event_get_time (event),
+                                           cancelled);
     }
 }
 
@@ -135,7 +135,7 @@ pointer_gesture_pinch_destroy (struct wl_client   *client,
   wl_resource_destroy (resource);
 }
 
-static const struct _wl_pointer_gesture_pinch_interface pointer_gesture_pinch_interface = {
+static const struct zwl_pointer_gesture_pinch1_interface pointer_gesture_pinch_interface = {
   pointer_gesture_pinch_destroy
 };
 
@@ -151,7 +151,7 @@ meta_wayland_pointer_gesture_pinch_create_new_resource (MetaWaylandPointer *poin
   pointer_client = meta_wayland_pointer_get_pointer_client (pointer, client);
   g_return_if_fail (pointer_client != NULL);
 
-  res = wl_resource_create (client, &_wl_pointer_gesture_pinch_interface,
+  res = wl_resource_create (client, &zwl_pointer_gesture_pinch1_interface,
                             wl_resource_get_version (gestures_resource), id);
   wl_resource_set_implementation (res, &pointer_gesture_pinch_interface, pointer,
                                   meta_wayland_pointer_unbind_pointer_client_resource);
diff --git a/src/wayland/meta-wayland-pointer-gesture-swipe.c 
b/src/wayland/meta-wayland-pointer-gesture-swipe.c
index 990ad89..aea8ce7 100644
--- a/src/wayland/meta-wayland-pointer-gesture-swipe.c
+++ b/src/wayland/meta-wayland-pointer-gesture-swipe.c
@@ -46,10 +46,10 @@ handle_swipe_begin (MetaWaylandPointer *pointer,
 
   wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
     {
-      _wl_pointer_gesture_swipe_send_begin (resource, serial,
-                                            clutter_event_get_time (event),
-                                            pointer->focus_surface->resource,
-                                            fingers);
+      zwl_pointer_gesture_swipe1_send_begin (resource, serial,
+                                             clutter_event_get_time (event),
+                                             pointer->focus_surface->resource,
+                                             fingers);
     }
 }
 
@@ -66,10 +66,10 @@ handle_swipe_update (MetaWaylandPointer *pointer,
 
   wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
     {
-      _wl_pointer_gesture_swipe_send_update (resource,
-                                             clutter_event_get_time (event),
-                                             wl_fixed_from_double (dx),
-                                             wl_fixed_from_double (dy));
+      zwl_pointer_gesture_swipe1_send_update (resource,
+                                              clutter_event_get_time (event),
+                                              wl_fixed_from_double (dx),
+                                              wl_fixed_from_double (dy));
     }
 }
 
@@ -90,9 +90,9 @@ handle_swipe_end (MetaWaylandPointer *pointer,
 
   wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
     {
-      _wl_pointer_gesture_swipe_send_end (resource, serial,
-                                          clutter_event_get_time (event),
-                                          cancelled);
+      zwl_pointer_gesture_swipe1_send_end (resource, serial,
+                                           clutter_event_get_time (event),
+                                           cancelled);
     }
 }
 
@@ -131,7 +131,7 @@ pointer_gesture_swipe_release (struct wl_client   *client,
   wl_resource_destroy (resource);
 }
 
-static const struct _wl_pointer_gesture_swipe_interface pointer_gesture_swipe_interface = {
+static const struct zwl_pointer_gesture_swipe1_interface pointer_gesture_swipe_interface = {
   pointer_gesture_swipe_release
 };
 
@@ -147,7 +147,7 @@ meta_wayland_pointer_gesture_swipe_create_new_resource (MetaWaylandPointer *poin
   pointer_client = meta_wayland_pointer_get_pointer_client (pointer, client);
   g_return_if_fail (pointer_client != NULL);
 
-  res = wl_resource_create (client, &_wl_pointer_gesture_swipe_interface,
+  res = wl_resource_create (client, &zwl_pointer_gesture_swipe1_interface,
                             wl_resource_get_version (pointer_resource), id);
   wl_resource_set_implementation (res, &pointer_gesture_swipe_interface, pointer,
                                   meta_wayland_pointer_unbind_pointer_client_resource);
diff --git a/src/wayland/meta-wayland-pointer-gestures.c b/src/wayland/meta-wayland-pointer-gestures.c
index 17fae0f..e90262f 100644
--- a/src/wayland/meta-wayland-pointer-gestures.c
+++ b/src/wayland/meta-wayland-pointer-gestures.c
@@ -53,7 +53,7 @@ gestures_get_pinch (struct wl_client   *client,
   meta_wayland_pointer_gesture_pinch_create_new_resource (pointer, client, resource, id);
 }
 
-static const struct _wl_pointer_gestures_interface pointer_gestures_interface = {
+static const struct zwl_pointer_gestures1_interface pointer_gestures_interface = {
   gestures_get_swipe,
   gestures_get_pinch
 };
@@ -66,16 +66,7 @@ bind_pointer_gestures (struct wl_client *client,
 {
   struct wl_resource *resource;
 
-  resource = wl_resource_create (client, &_wl_pointer_gestures_interface, version, id);
-
-  if (version != META__WL_POINTER_GESTURES_VERSION)
-    {
-      wl_resource_post_error (resource,
-                              _WL_POINTER_GESTURES_ERROR_VERSION_MISMATCH,
-                              "The client bound a non-supported version");
-      return;
-    }
-
+  resource = wl_resource_create (client, &zwl_pointer_gestures1_interface, version, id);
   wl_resource_set_implementation (resource, &pointer_gestures_interface,
                                   NULL, NULL);
 }
@@ -84,7 +75,7 @@ void
 meta_wayland_pointer_gestures_init (MetaWaylandCompositor *compositor)
 {
   wl_global_create (compositor->wayland_display,
-                    &_wl_pointer_gestures_interface,
-                    META__WL_POINTER_GESTURES_VERSION,
+                    &zwl_pointer_gestures1_interface,
+                    META_ZWL_POINTER_GESTURES_VERSION,
                     NULL, bind_pointer_gestures);
 }
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index f8f6ffc..4726e90 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1434,7 +1434,7 @@ handle_popup_parent_destroyed (struct wl_listener *listener, void *data)
     wl_container_of (listener, surface, popup.parent_destroy_listener);
 
   wl_resource_post_error (surface->xdg_popup,
-                          XDG_POPUP_ERROR_NOT_THE_TOPMOST_POPUP,
+                          XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP,
                           "destroyed popup not top most popup");
   surface->popup.parent = NULL;
 
@@ -1453,7 +1453,7 @@ handle_popup_destroyed (struct wl_listener *listener, void *data)
   if (surface != top_popup)
     {
       wl_resource_post_error (surface->xdg_popup,
-                              XDG_POPUP_ERROR_NOT_THE_TOPMOST_POPUP,
+                              XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP,
                               "destroyed popup not top most popup");
     }
 
@@ -1504,7 +1504,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
       (parent_surf->xdg_popup == NULL && parent_surf->xdg_surface == NULL))
     {
       wl_resource_post_error (resource,
-                              XDG_POPUP_ERROR_INVALID_PARENT,
+                              XDG_SHELL_ERROR_INVALID_POPUP_PARENT,
                               "invalid parent surface");
       return;
     }
@@ -1514,7 +1514,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
       (top_popup != NULL && parent_surf != top_popup))
     {
       wl_resource_post_error (resource,
-                              XDG_POPUP_ERROR_NOT_THE_TOPMOST_POPUP,
+                              XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP,
                               "parent not top most surface");
       return;
     }
diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h
index 9ca8def..1f86375 100644
--- a/src/wayland/meta-wayland-versions.h
+++ b/src/wayland/meta-wayland-versions.h
@@ -44,6 +44,6 @@
 #define META_XSERVER_VERSION                1
 #define META_GTK_SHELL_VERSION              2
 #define META_WL_SUBCOMPOSITOR_VERSION       1
-#define META__WL_POINTER_GESTURES_VERSION   1
+#define META_ZWL_POINTER_GESTURES_VERSION   1
 
 #endif


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