diff --git a/gdk/wayland/gdkwaylandwindow.h b/gdk/wayland/gdkwaylandwindow.h index 9619a66fcb..1821feb8c2 100644 --- a/gdk/wayland/gdkwaylandwindow.h +++ b/gdk/wayland/gdkwaylandwindow.h @@ -53,6 +53,15 @@ struct wl_shell_surface *gdk_wayland_window_get_wl_shell_surface (GdkWindow *win GDK_AVAILABLE_IN_ALL void gdk_wayland_window_set_use_custom_surface (GdkWindow *window); +GDK_AVAILABLE_IN_3_10 +void gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window, + const char *application_id, + const char *app_menu_path, + const char *menubar_path, + const char *window_object_path, + const char *application_object_path, + const char *unique_bus_name); + G_END_DECLS #endif /* __GDK_WAYLAND_WINDOW_H__ */ diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 0fcad36b1c..633ca83c54 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -2289,3 +2289,33 @@ gdk_wayland_window_set_use_custom_surface (GdkWindow *window) impl->use_custom_surface = TRUE; } + +void +gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window, + const char *application_id, + const char *app_menu_path, + const char *menubar_path, + const char *window_object_path, + const char *application_object_path, + const char *unique_bus_name) +{ + GdkWindowImplWayland *impl; + + g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window)); + + impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + + if (!impl->surface) + gdk_wayland_window_create_surface (window); + + if (impl->gtk_surface == NULL) + return; + + gtk_surface_set_dbus_properties (impl->gtk_surface, + application_id, + app_menu_path, + menubar_path, + window_object_path, + application_object_path, + unique_bus_name); +} diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c index 7797eb8729..5d931beefd 100644 --- a/gtk/gtkapplicationwindow.c +++ b/gtk/gtkapplicationwindow.c @@ -34,6 +34,9 @@ #ifdef GDK_WINDOWING_X11 #include #endif +#ifdef GDK_WINDOWING_WAYLAND +#include +#endif #ifdef HAVE_GIO_UNIX #include @@ -865,8 +868,28 @@ gtk_application_window_real_map (GtkWidget *widget) if (window->priv->menubar) gtk_widget_map (window->priv->menubar); - GTK_WIDGET_CLASS (gtk_application_window_parent_class) - ->map (widget); +#ifdef GDK_WINDOWING_WAYLAND + { + GdkWindow *gdkwindow; + GtkApplication *application; + + application = gtk_window_get_application (GTK_WINDOW (window)); + gdkwindow = gtk_widget_get_window (widget); + + if (GDK_IS_WAYLAND_WINDOW (gdkwindow) && window->priv->session) + { + gdk_wayland_window_set_dbus_properties_libgtk_only (gdkwindow, + g_application_get_application_id (G_APPLICATION (application)), + gtk_application_get_app_menu_object_path (application), + gtk_application_get_menubar_object_path (application), + window->priv->object_path, + g_application_get_dbus_object_path (G_APPLICATION (application)), + g_dbus_connection_get_unique_name (window->priv->session)); + } + } +#endif + + GTK_WIDGET_CLASS (gtk_application_window_parent_class)->map (widget); } static void