mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-19 13:30:02 +00:00
wayland: Implement GdkToplevel::decorated
... and use that instead of custom announce_csd/announce_ssd APIs.
This commit is contained in:
parent
31143f9611
commit
ac16e375c7
@ -33,9 +33,6 @@ void gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
|
||||
const char *application_object_path,
|
||||
const char *unique_bus_name);
|
||||
|
||||
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
|
||||
void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
|
||||
|
||||
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
|
||||
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
|
||||
|
||||
|
@ -141,6 +141,7 @@ struct _GdkWaylandToplevel
|
||||
gboolean has_bounds;
|
||||
|
||||
char *title;
|
||||
gboolean decorated;
|
||||
|
||||
GdkGeometry geometry_hints;
|
||||
GdkSurfaceHints geometry_mask;
|
||||
@ -1256,6 +1257,32 @@ gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
|
||||
|
||||
#define LAST_PROP 1
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_set_decorated (GdkWaylandToplevel *self,
|
||||
gboolean decorated)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (self)));
|
||||
|
||||
if (self->decorated == decorated)
|
||||
return;
|
||||
|
||||
self->decorated = decorated;
|
||||
|
||||
if (display_wayland->server_decoration_manager)
|
||||
{
|
||||
if (self->server_decoration == NULL)
|
||||
self->server_decoration =
|
||||
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
|
||||
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (self)));
|
||||
|
||||
org_kde_kwin_server_decoration_request_mode (self->server_decoration,
|
||||
decorated ? ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER
|
||||
: ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), "decorated");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -1291,6 +1318,7 @@ gdk_wayland_toplevel_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
|
||||
gdk_wayland_toplevel_set_decorated (toplevel, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
|
||||
@ -1346,6 +1374,7 @@ gdk_wayland_toplevel_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
|
||||
g_value_set_boolean (value, toplevel->decorated);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
|
||||
@ -2451,44 +2480,6 @@ gdk_wayland_toplevel_set_application_id (GdkToplevel *toplevel,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
|
||||
GdkWaylandToplevel *toplevel_wayland;
|
||||
|
||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||
toplevel_wayland = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
if (!display_wayland->server_decoration_manager)
|
||||
return;
|
||||
toplevel_wayland->server_decoration =
|
||||
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
|
||||
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (toplevel_wayland)));
|
||||
if (toplevel_wayland->server_decoration)
|
||||
org_kde_kwin_server_decoration_request_mode (toplevel_wayland->server_decoration,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
|
||||
GdkWaylandToplevel *toplevel_wayland;
|
||||
|
||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||
toplevel_wayland = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
if (!display_wayland->server_decoration_manager)
|
||||
return;
|
||||
toplevel_wayland->server_decoration =
|
||||
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
|
||||
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (toplevel_wayland)));
|
||||
if (toplevel_wayland->server_decoration)
|
||||
org_kde_kwin_server_decoration_request_mode (toplevel_wayland->server_decoration,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel)
|
||||
{
|
||||
|
@ -4340,17 +4340,6 @@ gtk_window_realize (GtkWidget *widget)
|
||||
|
||||
gdk_toplevel_set_decorated (GDK_TOPLEVEL (surface), priv->decorated && !priv->client_decorated);
|
||||
gdk_toplevel_set_deletable (GDK_TOPLEVEL (surface), priv->deletable);
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_SURFACE (surface))
|
||||
{
|
||||
if (priv->client_decorated)
|
||||
gdk_wayland_toplevel_announce_csd (GDK_TOPLEVEL (surface));
|
||||
else
|
||||
gdk_wayland_toplevel_announce_ssd (GDK_TOPLEVEL (surface));
|
||||
}
|
||||
#endif
|
||||
|
||||
gdk_toplevel_set_modal (GDK_TOPLEVEL (surface), priv->modal);
|
||||
|
||||
if (priv->startup_id)
|
||||
|
Loading…
Reference in New Issue
Block a user