diff -r -u libcanberra-0.30/configure.ac libcanberra-0.30.wayland/configure.ac --- libcanberra-0.30/configure.ac 2012-09-24 20:21:07.000000000 -0400 +++ libcanberra-0.30.wayland/configure.ac 2014-04-21 16:10:31.597074952 -0400 @@ -437,7 +437,7 @@ AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false]) if test "x${gtk}" != xno ; then - PKG_CHECK_MODULES(GTK, [ gtk+-2.0 >= 2.20.0 gthread-2.0 glib-2.0 >= 2.32 gdk-2.0 x11 ], + PKG_CHECK_MODULES(GTK, [ gtk+-2.0 >= 2.20.0 gthread-2.0 glib-2.0 >= 2.32 gdk-2.0 gdk-x11-2.0 x11 ], [ HAVE_GTK=1 AC_DEFINE([HAVE_GTK], 1, [Have GTK?]) @@ -473,7 +473,7 @@ [gtk3=auto]) if test "x${gtk3}" != xno ; then - PKG_CHECK_MODULES(GTK3, [ gtk+-3.0 gthread-2.0 glib-2.0 >= 2.32 gdk-3.0 x11 ], + PKG_CHECK_MODULES(GTK3, [ gtk+-3.0 gthread-2.0 glib-2.0 >= 2.32 gdk-3.0 gdk-x11-3.0 x11 ], [ HAVE_GTK3=1 AC_DEFINE([HAVE_GTK3], 1, [Have GTK3?]) diff -r -u libcanberra-0.30/src/canberra-gtk.c libcanberra-0.30.wayland/src/canberra-gtk.c --- libcanberra-0.30/src/canberra-gtk.c 2010-09-28 09:55:03.000000000 -0400 +++ libcanberra-0.30.wayland/src/canberra-gtk.c 2014-04-21 15:58:37.769950933 -0400 @@ -26,7 +26,9 @@ #include #include +#ifdef GDK_WINDOWING_X11 #include +#endif #include #include "canberra.h" @@ -252,88 +254,92 @@ if ((ret = ca_proplist_sets(p, CA_PROP_WINDOW_ICON_NAME, t)) < 0) return ret; - if (gtk_widget_get_realized(GTK_WIDGET(w))) { - GdkWindow *dw = NULL; - GdkScreen *screen = NULL; - GdkDisplay *display = NULL; - gint x = -1, y = -1, width = -1, height = -1, screen_width = -1, screen_height = -1; +#ifdef GDK_WINDOWING_X11 + if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET(w)))) { + if (gtk_widget_get_realized(GTK_WIDGET(w))) { + GdkWindow *dw = NULL; + GdkScreen *screen = NULL; + GdkDisplay *display = NULL; + gint x = -1, y = -1, width = -1, height = -1, screen_width = -1, screen_height = -1; - if ((dw = gtk_widget_get_window(GTK_WIDGET(w)))) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long) GDK_WINDOW_XID(dw))) < 0) - return ret; - - if ((display = gtk_widget_get_display(GTK_WIDGET(w)))) { - if ((t = gdk_display_get_name(display))) - if ((ret = ca_proplist_sets(p, CA_PROP_WINDOW_X11_DISPLAY, t)) < 0) + if ((dw = gtk_widget_get_window(GTK_WIDGET(w)))) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long) GDK_WINDOW_XID(dw))) < 0) return ret; - if (dw) { - gint desktop = window_get_desktop(display, dw); - - if (desktop >= 0) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_DESKTOP, "%i", desktop)) < 0) + if ((display = gtk_widget_get_display(GTK_WIDGET(w)))) { + if ((t = gdk_display_get_name(display))) + if ((ret = ca_proplist_sets(p, CA_PROP_WINDOW_X11_DISPLAY, t)) < 0) return ret; - } - } - if ((screen = gtk_widget_get_screen(GTK_WIDGET(w)))) { + if (dw) { + gint desktop = window_get_desktop(display, dw); - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X11_SCREEN, "%i", gdk_screen_get_number(screen))) < 0) - return ret; + if (desktop >= 0) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_DESKTOP, "%i", desktop)) < 0) + return ret; + } + } + + if ((screen = gtk_widget_get_screen(GTK_WIDGET(w)))) { - if (dw) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X11_MONITOR, "%i", gdk_screen_get_monitor_at_window(screen, dw))) < 0) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X11_SCREEN, "%i", gdk_screen_get_number(screen))) < 0) return ret; - } - /* FIXME, this might cause a round trip */ + if (dw) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X11_MONITOR, "%i", gdk_screen_get_monitor_at_window(screen, dw))) < 0) + return ret; + } - if (dw) { - gdk_window_get_origin(dw, &x, &y); + /* FIXME, this might cause a round trip */ - if (x >= 0) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X, "%i", x)) < 0) - return ret; - if (y >= 0) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_Y, "%i", y)) < 0) - return ret; - } + if (dw) { + gdk_window_get_origin(dw, &x, &y); - gtk_window_get_size(w, &width, &height); + if (x >= 0) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_X, "%i", x)) < 0) + return ret; + if (y >= 0) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_Y, "%i", y)) < 0) + return ret; + } - if (width > 0) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_WIDTH, "%i", width)) < 0) - return ret; - if (height > 0) - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_HEIGHT, "%i", height)) < 0) - return ret; + gtk_window_get_size(w, &width, &height); - if (x >= 0 && width > 0) { - screen_width = gdk_screen_get_width(gtk_widget_get_screen(GTK_WIDGET(w))); + if (width > 0) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_WIDTH, "%i", width)) < 0) + return ret; + if (height > 0) + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_HEIGHT, "%i", height)) < 0) + return ret; - x += width/2; - x = CA_CLAMP(x, 0, screen_width-1); + if (x >= 0 && width > 0) { + screen_width = gdk_screen_get_width(gtk_widget_get_screen(GTK_WIDGET(w))); - /* We use these strange format strings here to avoid that libc - * applies locale information on the formatting of floating - * numbers. */ + x += width/2; + x = CA_CLAMP(x, 0, screen_width-1); - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_HPOS, "%i.%03i", - (int) (x/(screen_width-1)), (int) (1000.0*x/(screen_width-1)) % 1000)) < 0) - return ret; - } + /* We use these strange format strings here to avoid that libc + * applies locale information on the formatting of floating + * numbers. */ - if (y >= 0 && height > 0) { - screen_height = gdk_screen_get_height(gtk_widget_get_screen(GTK_WIDGET(w))); + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_HPOS, "%i.%03i", + (int) (x/(screen_width-1)), (int) (1000.0*x/(screen_width-1)) % 1000)) < 0) + return ret; + } - y += height/2; - y = CA_CLAMP(y, 0, screen_height-1); + if (y >= 0 && height > 0) { + screen_height = gdk_screen_get_height(gtk_widget_get_screen(GTK_WIDGET(w))); - if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_VPOS, "%i.%03i", - (int) (y/(screen_height-1)), (int) (1000.0*y/(screen_height-1)) % 1000)) < 0) - return ret; + y += height/2; + y = CA_CLAMP(y, 0, screen_height-1); + + if ((ret = ca_proplist_setf(p, CA_PROP_WINDOW_VPOS, "%i.%03i", + (int) (y/(screen_height-1)), (int) (1000.0*y/(screen_height-1)) % 1000)) < 0) + return ret; + } } } +#endif return CA_SUCCESS; } --- libcanberra-0.30/src/canberra-gtk-module.c 2012-05-15 06:23:57.000000000 -0400 +++ libcanberra-0.30.wayland/src/canberra-gtk-module.c 2014-04-21 16:20:28.735393686 -0400 @@ -25,7 +25,9 @@ #endif #include +#ifdef GDK_WINDOWING_X11 #include +#endif #include #include "canberra-gtk.h" @@ -299,6 +301,7 @@ return d; } +#ifdef GDK_WINDOWING_X11 static gint window_get_desktop(GdkDisplay *d, GdkWindow *w) { Atom type_return; gint format_return; @@ -395,6 +398,7 @@ return ret; } +#endif static void dispatch_sound_event(SoundEventData *d) { int ret = CA_SUCCESS; @@ -456,13 +460,16 @@ hint == GDK_WINDOW_TYPE_HINT_DIALOG) { gboolean played_sound = FALSE; - gboolean is_xembed; + gboolean is_xembed = FALSE; - is_xembed = - gtk_widget_get_realized(GTK_WIDGET(d->object)) && - window_is_xembed( - gtk_widget_get_display(GTK_WIDGET(d->object)), - gtk_widget_get_window(GTK_WIDGET(d->object))); +#ifdef GDK_WINDOWING_X11 + if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (d->object)))) + is_xembed = + gtk_widget_get_realized(GTK_WIDGET(d->object)) && + window_is_xembed( + gtk_widget_get_display(GTK_WIDGET(d->object)), + gtk_widget_get_window(GTK_WIDGET(d->object))); +#endif g_object_set_qdata(d->object, is_xembed_quark, GINT_TO_POINTER(is_xembed)); @@ -581,8 +588,16 @@ GdkDisplay *display; display = gtk_widget_get_display(GTK_WIDGET(d->object)); - w_desktop = window_get_desktop(display, gtk_widget_get_window(GTK_WIDGET(d->object))); - c_desktop = display_get_desktop(display); +#ifdef GDK_WINDOWING_X11 + if (GDK_IS_X11_DISPLAY (display)) { + w_desktop = window_get_desktop(display, gtk_widget_get_window(GTK_WIDGET(d->object))); + c_desktop = display_get_desktop(display); + } else +#endif + { + w_desktop = 0; + c_desktop = 0; + } } if ((e->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&