forked from AuroraMiddleware/gtk
wayland: restore support for the application menu
If the compositor supports the gtk-shell interface, use it to export the application ID, dbus name and paths that can be used for the application menu. https://bugzilla.gnome.org/show_bug.cgi?id=707129
This commit is contained in:
parent
d34335e51c
commit
ed9f55d521
@ -53,6 +53,15 @@ struct wl_shell_surface *gdk_wayland_window_get_wl_shell_surface (GdkWindow *win
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gdk_wayland_window_set_use_custom_surface (GdkWindow *window);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GDK_WAYLAND_WINDOW_H__ */
|
#endif /* __GDK_WAYLAND_WINDOW_H__ */
|
||||||
|
@ -2289,3 +2289,33 @@ gdk_wayland_window_set_use_custom_surface (GdkWindow *window)
|
|||||||
|
|
||||||
impl->use_custom_surface = TRUE;
|
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);
|
||||||
|
}
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
#include <gdk/x11/gdkx.h>
|
#include <gdk/x11/gdkx.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
|
#include <gdk/wayland/gdkwayland.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GIO_UNIX
|
#ifdef HAVE_GIO_UNIX
|
||||||
#include <gio/gdesktopappinfo.h>
|
#include <gio/gdesktopappinfo.h>
|
||||||
@ -865,8 +868,28 @@ gtk_application_window_real_map (GtkWidget *widget)
|
|||||||
if (window->priv->menubar)
|
if (window->priv->menubar)
|
||||||
gtk_widget_map (window->priv->menubar);
|
gtk_widget_map (window->priv->menubar);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_application_window_parent_class)
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
->map (widget);
|
{
|
||||||
|
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
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user