Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From c0620e432650e81062c1967cc669829dbd29b310 Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael Meeks <michael.meeks@suse.com> |
| 3 | Date: Fri, 9 Nov 2012 16:16:40 +0000 |
| 4 | Subject: [PATCH] gtk: Don't assume all GdkDisplays are GdkX11Displays: |
| 5 | broadway/wayland |
| 6 | |
| 7 | --- |
| 8 | src/canberra-gtk-module.c | 15 +++++++++++++++ |
| 9 | src/canberra-gtk.c | 5 +++++ |
| 10 | 2 files changed, 20 insertions(+) |
| 11 | |
| 12 | --- a/src/canberra-gtk-module.c |
| 13 | +++ b/src/canberra-gtk-module.c |
| 14 | @@ -307,6 +307,11 @@ static gint window_get_desktop(GdkDispla |
| 15 | guchar *data = NULL; |
| 16 | gint ret = -1; |
| 17 | |
| 18 | +#ifdef GDK_IS_X11_DISPLAY |
| 19 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 20 | + return 0; |
| 21 | +#endif |
| 22 | + |
| 23 | if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w), |
| 24 | gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"), |
| 25 | 0, G_MAXLONG, False, XA_CARDINAL, &type_return, |
| 26 | @@ -335,6 +340,11 @@ static gint display_get_desktop(GdkDispl |
| 27 | guchar *data = NULL; |
| 28 | gint ret = -1; |
| 29 | |
| 30 | +#ifdef GDK_IS_X11_DISPLAY |
| 31 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 32 | + return 0; |
| 33 | +#endif |
| 34 | + |
| 35 | if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), DefaultRootWindow(GDK_DISPLAY_XDISPLAY(d)), |
| 36 | gdk_x11_get_xatom_by_name_for_display(d, "_NET_CURRENT_DESKTOP"), |
| 37 | 0, G_MAXLONG, False, XA_CARDINAL, &type_return, |
| 38 | @@ -365,6 +375,11 @@ static gboolean window_is_xembed(GdkDisp |
| 39 | gboolean ret = FALSE; |
| 40 | Atom xembed; |
| 41 | |
| 42 | +#ifdef GDK_IS_X11_DISPLAY |
| 43 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 44 | + return FALSE; |
| 45 | +#endif |
| 46 | + |
| 47 | /* Gnome Panel applets are XEMBED windows. We need to make sure we |
| 48 | * ignore them */ |
| 49 | |
| 50 | --- a/src/canberra-gtk.c |
| 51 | +++ b/src/canberra-gtk.c |
| 52 | @@ -185,6 +185,11 @@ static gint window_get_desktop(GdkDispla |
| 53 | guchar *data = NULL; |
| 54 | gint ret = -1; |
| 55 | |
| 56 | +#ifdef GDK_IS_X11_DISPLAY |
| 57 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 58 | + return 0; |
| 59 | +#endif |
| 60 | + |
| 61 | if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w), |
| 62 | gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"), |
| 63 | 0, G_MAXLONG, False, XA_CARDINAL, &type_return, |