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 | --- |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 8 | Upstream-Status: Pending |
| 9 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 10 | src/canberra-gtk-module.c | 15 +++++++++++++++ |
| 11 | src/canberra-gtk.c | 5 +++++ |
| 12 | 2 files changed, 20 insertions(+) |
| 13 | |
| 14 | --- a/src/canberra-gtk-module.c |
| 15 | +++ b/src/canberra-gtk-module.c |
| 16 | @@ -307,6 +307,11 @@ static gint window_get_desktop(GdkDispla |
| 17 | guchar *data = NULL; |
| 18 | gint ret = -1; |
| 19 | |
| 20 | +#ifdef GDK_IS_X11_DISPLAY |
| 21 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 22 | + return 0; |
| 23 | +#endif |
| 24 | + |
| 25 | if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w), |
| 26 | gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"), |
| 27 | 0, G_MAXLONG, False, XA_CARDINAL, &type_return, |
| 28 | @@ -335,6 +340,11 @@ static gint display_get_desktop(GdkDispl |
| 29 | guchar *data = NULL; |
| 30 | gint ret = -1; |
| 31 | |
| 32 | +#ifdef GDK_IS_X11_DISPLAY |
| 33 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 34 | + return 0; |
| 35 | +#endif |
| 36 | + |
| 37 | if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), DefaultRootWindow(GDK_DISPLAY_XDISPLAY(d)), |
| 38 | gdk_x11_get_xatom_by_name_for_display(d, "_NET_CURRENT_DESKTOP"), |
| 39 | 0, G_MAXLONG, False, XA_CARDINAL, &type_return, |
| 40 | @@ -365,6 +375,11 @@ static gboolean window_is_xembed(GdkDisp |
| 41 | gboolean ret = FALSE; |
| 42 | Atom xembed; |
| 43 | |
| 44 | +#ifdef GDK_IS_X11_DISPLAY |
| 45 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 46 | + return FALSE; |
| 47 | +#endif |
| 48 | + |
| 49 | /* Gnome Panel applets are XEMBED windows. We need to make sure we |
| 50 | * ignore them */ |
| 51 | |
| 52 | --- a/src/canberra-gtk.c |
| 53 | +++ b/src/canberra-gtk.c |
| 54 | @@ -185,6 +185,11 @@ static gint window_get_desktop(GdkDispla |
| 55 | guchar *data = NULL; |
| 56 | gint ret = -1; |
| 57 | |
| 58 | +#ifdef GDK_IS_X11_DISPLAY |
| 59 | + if (!GDK_IS_X11_DISPLAY(d)) |
| 60 | + return 0; |
| 61 | +#endif |
| 62 | + |
| 63 | if (XGetWindowProperty(GDK_DISPLAY_XDISPLAY(d), GDK_WINDOW_XID(w), |
| 64 | gdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"), |
| 65 | 0, G_MAXLONG, False, XA_CARDINAL, &type_return, |