Merge branch 'wayland_surface_app_id_changing' into 'master'

add a way to change the application_id of a toplevel wayland GdkSurface

See merge request GNOME/gtk!2205
This commit is contained in:
Matthias Clasen 2020-07-09 13:28:07 +00:00
commit 06dd8c2cfd
2 changed files with 37 additions and 13 deletions

View File

@ -1648,6 +1648,38 @@ create_zxdg_toplevel_v6_resources (GdkSurface *surface)
surface);
}
void
gdk_wayland_surface_set_application_id (GdkSurface *surface, const char* application_id)
{
GdkWaylandSurface *impl;
GdkWaylandDisplay *display_wayland;
g_return_if_fail (application_id != NULL);
if (GDK_SURFACE_DESTROYED (surface))
return;
if (!is_realized_toplevel (surface))
return;
display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
impl = GDK_WAYLAND_SURFACE (surface);
switch (display_wayland->shell_variant)
{
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
xdg_toplevel_set_app_id (impl->display_server.xdg_toplevel,
application_id);
break;
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
zxdg_toplevel_v6_set_app_id (impl->display_server.zxdg_toplevel_v6,
application_id);
break;
default:
g_assert_not_reached ();
}
}
static void
gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
{
@ -1702,19 +1734,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
if (app_id == NULL)
app_id = "GTK+ Application";
switch (display_wayland->shell_variant)
{
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
xdg_toplevel_set_app_id (impl->display_server.xdg_toplevel,
app_id);
break;
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
zxdg_toplevel_v6_set_app_id (impl->display_server.zxdg_toplevel_v6,
app_id);
break;
default:
g_assert_not_reached ();
}
gdk_wayland_surface_set_application_id (surface, app_id);
maybe_set_gtk_surface_dbus_properties (surface);
maybe_set_gtk_surface_modal (surface);

View File

@ -74,6 +74,10 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface,
char *parent_handle_str);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_surface_set_application_id (GdkSurface *surface,
const char *application_id);
void gdk_wayland_surface_announce_csd (GdkSurface *surface);
G_END_DECLS