[gnome-build-meta/jjardon/wayland_only: 1/7] elements/sdk/libcanberra.bst: allow to build in wayland



commit d3342d4b9379ae8b32e6b7c2e5ee9801b2df52e5
Author: Javier Jardón <jjardon gnome org>
Date:   Sun Nov 24 01:43:27 2019 +0900

    elements/sdk/libcanberra.bst: allow to build in wayland

 elements/sdk/libcanberra.bst                |   4 +
 files/libcanberra/0001-Add-X11-guards.patch | 152 ++++++++++++++++++++++++++++
 files/libcanberra/Allow-wayland-only.patch  |  70 +++++++++++++
 3 files changed, 226 insertions(+)
---
diff --git a/elements/sdk/libcanberra.bst b/elements/sdk/libcanberra.bst
index e77ac7ea..88722bc3 100644
--- a/elements/sdk/libcanberra.bst
+++ b/elements/sdk/libcanberra.bst
@@ -2,6 +2,10 @@ kind: autotools
 sources:
 - kind: tar
   url: http://0pointer.de/lennart/projects/libcanberra/libcanberra-0.30.tar.xz
+- kind: patch
+  path: files/libcanberra/Allow-wayland-only.patch
+- kind: patch
+  path: files/libcanberra/0001-Add-X11-guards.patch
 build-depends:
 - freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst
 depends:
diff --git a/files/libcanberra/0001-Add-X11-guards.patch b/files/libcanberra/0001-Add-X11-guards.patch
new file mode 100644
index 00000000..2de14930
--- /dev/null
+++ b/files/libcanberra/0001-Add-X11-guards.patch
@@ -0,0 +1,152 @@
+From 9a7cc5aaccd7faa0f35ac0160408ac48b84cec41 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Javier=20Jard=C3=B3n?= <jjardon gnome org>
+Date: Sun, 24 Nov 2019 03:43:25 +0900
+Subject: [PATCH] Add X11 guards
+
+---
+ src/canberra-gtk-module.c | 20 +++++++++++---------
+ src/canberra-gtk.c        |  8 +++++---
+ 2 files changed, 16 insertions(+), 12 deletions(-)
+
+diff --git a/src/canberra-gtk-module.c b/src/canberra-gtk-module.c
+index c1532ab..b1ce812 100644
+--- a/src/canberra-gtk-module.c
++++ b/src/canberra-gtk-module.c
+@@ -25,8 +25,10 @@
+ #endif
+ 
+ #include <gtk/gtk.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
+ #include <X11/Xatom.h>
++#endif
+ 
+ #include "canberra-gtk.h"
+ 
+@@ -300,17 +302,16 @@ static SoundEventData* filter_sound_event(SoundEventData *d) {
+ }
+ 
+ static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) {
++        gint ret = -1;
++#ifdef GDK_IS_X11_DISPLAY
+         Atom type_return;
+         gint format_return;
+         gulong nitems_return;
+         gulong bytes_after_return;
+         guchar *data = NULL;
+-        gint ret = -1;
+ 
+-#ifdef GDK_IS_X11_DISPLAY
+         if (!GDK_IS_X11_DISPLAY(d))
+                 return 0;
+-#endif
+ 
+         if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w),
+                                gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"),
+@@ -328,22 +329,22 @@ static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) {
+ 
+         if (type_return != None && data != NULL)
+                 XFree(data);
++#endif
+ 
+         return ret;
+ }
+ 
+ static gint display_get_desktop(GdkDisplay *d) {
++        gint ret = -1;
++#ifdef GDK_IS_X11_DISPLAY
+         Atom type_return;
+         gint format_return;
+         gulong nitems_return;
+         gulong bytes_after_return;
+         guchar *data = NULL;
+-        gint ret = -1;
+ 
+-#ifdef GDK_IS_X11_DISPLAY
+         if (!GDK_IS_X11_DISPLAY(d))
+                 return 0;
+-#endif
+ 
+         if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), DefaultRootWindow(GDK_DISPLAY_XDISPLAY(d)),
+                                gdk_x11_get_xatom_by_name_for_display(d, "_NET_CURRENT_DESKTOP"),
+@@ -362,23 +363,23 @@ static gint display_get_desktop(GdkDisplay *d) {
+ 
+         if (type_return != None && data != NULL)
+                 XFree(data);
++#endif
+ 
+         return ret;
+ }
+ 
+ static gboolean window_is_xembed(GdkDisplay *d, GdkWindow *w) {
++        gboolean ret = FALSE;
++#ifdef GDK_IS_X11_DISPLAY
+         Atom type_return;
+         gint format_return;
+         gulong nitems_return;
+         gulong bytes_after_return;
+         guchar *data = NULL;
+-        gboolean ret = FALSE;
+         Atom xembed;
+ 
+-#ifdef GDK_IS_X11_DISPLAY
+         if (!GDK_IS_X11_DISPLAY(d))
+                 return FALSE;
+-#endif
+ 
+         /* Gnome Panel applets are XEMBED windows. We need to make sure we
+          * ignore them */
+@@ -407,6 +408,7 @@ static gboolean window_is_xembed(GdkDisplay *d, GdkWindow *w) {
+ 
+         if (type_return != None && data != NULL)
+                 XFree(data);
++#endif
+ 
+         return ret;
+ }
+diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c
+index 08cb668..9e948d4 100644
+--- a/src/canberra-gtk.c
++++ b/src/canberra-gtk.c
+@@ -26,8 +26,10 @@
+ 
+ #include <gtk/gtk.h>
+ #include <gdk/gdk.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
+ #include <X11/Xatom.h>
++#endif
+ 
+ #include "canberra.h"
+ #include "canberra-gtk.h"
+@@ -178,17 +180,16 @@ static GtkWindow* get_toplevel(GtkWidget *w) {
+ }
+ 
+ static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) {
++        gint ret = -1;
++#ifdef GDK_IS_X11_DISPLAY
+         Atom type_return;
+         gint format_return;
+         gulong nitems_return;
+         gulong bytes_after_return;
+         guchar *data = NULL;
+-        gint ret = -1;
+ 
+-#ifdef GDK_IS_X11_DISPLAY
+         if (!GDK_IS_X11_DISPLAY(d))
+                 return 0;
+-#endif
+ 
+         if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w),
+                                gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"),
+@@ -206,6 +207,7 @@ static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) {
+ 
+         if (type_return != None && data != NULL)
+                 XFree(data);
++#endif
+ 
+         return ret;
+ }
+-- 
+2.23.0
+
diff --git a/files/libcanberra/Allow-wayland-only.patch b/files/libcanberra/Allow-wayland-only.patch
new file mode 100644
index 00000000..ccc36445
--- /dev/null
+++ b/files/libcanberra/Allow-wayland-only.patch
@@ -0,0 +1,70 @@
+From c0620e432650e81062c1967cc669829dbd29b310 Mon Sep 17 00:00:00 2001
+From: Michael Meeks <michael meeks suse com>
+Date: Fri, 9 Nov 2012 16:16:40 +0000
+Subject: gtk: Don't assume all GdkDisplays are GdkX11Displays:
+ broadway/wayland
+
+---
+ src/canberra-gtk-module.c | 15 +++++++++++++++
+ src/canberra-gtk.c        |  5 +++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/src/canberra-gtk-module.c b/src/canberra-gtk-module.c
+index 67791f0..c1532ab 100644
+--- a/src/canberra-gtk-module.c
++++ b/src/canberra-gtk-module.c
+@@ -307,6 +307,11 @@ static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) {
+         guchar *data = NULL;
+         gint ret = -1;
+ 
++#ifdef GDK_IS_X11_DISPLAY
++        if (!GDK_IS_X11_DISPLAY(d))
++                return 0;
++#endif
++
+         if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w),
+                                gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"),
+                                0, G_MAXLONG, False, XA_CARDINAL, &type_return,
+@@ -335,6 +340,11 @@ static gint display_get_desktop(GdkDisplay *d) {
+         guchar *data = NULL;
+         gint ret = -1;
+ 
++#ifdef GDK_IS_X11_DISPLAY
++        if (!GDK_IS_X11_DISPLAY(d))
++                return 0;
++#endif
++
+         if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), DefaultRootWindow(GDK_DISPLAY_XDISPLAY(d)),
+                                gdk_x11_get_xatom_by_name_for_display(d, "_NET_CURRENT_DESKTOP"),
+                                0, G_MAXLONG, False, XA_CARDINAL, &type_return,
+@@ -365,6 +375,11 @@ static gboolean window_is_xembed(GdkDisplay *d, GdkWindow *w) {
+         gboolean ret = FALSE;
+         Atom xembed;
+ 
++#ifdef GDK_IS_X11_DISPLAY
++        if (!GDK_IS_X11_DISPLAY(d))
++                return FALSE;
++#endif
++
+         /* Gnome Panel applets are XEMBED windows. We need to make sure we
+          * ignore them */
+ 
+diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c
+index 34446f5..08cb668 100644
+--- a/src/canberra-gtk.c
++++ b/src/canberra-gtk.c
+@@ -185,6 +185,11 @@ static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) {
+         guchar *data = NULL;
+         gint ret = -1;
+ 
++#ifdef GDK_IS_X11_DISPLAY
++        if (!GDK_IS_X11_DISPLAY(d))
++                return 0;
++#endif
++
+         if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w),
+                                gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"),
+                                0, G_MAXLONG, False, XA_CARDINAL, &type_return,
+-- 
+cgit v1.2.1
+


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