Sync layersurface with Phosh
Copy layersurface & layer shell protocol from phosh (https://gitlab.gnome.org/World/Phosh/phosh/)
This commit is contained in:
committed by
Dorota Czaplejewicz
parent
5f12199de1
commit
6e46512044
@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Purism SPC
|
* Copyright (C) 2018-2023 Purism SPC
|
||||||
* SPDX-License-Identifier: GPL-3.0+
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
* Author: Guido Günther <agx@sigxcpu.org>
|
* Author: Guido Günther <agx@sigxcpu.org>
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
||||||
WARNING: this file is taken directly from phosh, with no modificaions apart from this message. Please update phosh instead of changing this file. Please copy the file back here afterwards, with the same notice.
|
WARNING: this file is taken directly from phosh, with no modificaions apart
|
||||||
|
from this message. Please update phosh instead of changing this file. Please
|
||||||
|
copy the file back here afterwards, with an updated version of this notice.
|
||||||
|
|
||||||
|
Up-to-date with Phosh revision 953894a2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -16,6 +22,16 @@ WARNING: this file is taken directly from phosh, with no modificaions apart from
|
|||||||
|
|
||||||
#include <gdk/gdkwayland.h>
|
#include <gdk/gdkwayland.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PhoshLayerSurface:
|
||||||
|
*
|
||||||
|
* A #GtkWindow rendered as a LayerSurface by the compositor
|
||||||
|
*
|
||||||
|
* #PhoshLayerSurface allows to use a Wayland surface backed by the
|
||||||
|
* layer-shell protocol as #GtkWindow. This allows to render e.g. panels and
|
||||||
|
* backgrounds using GTK.
|
||||||
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PHOSH_LAYER_SURFACE_PROP_0,
|
PHOSH_LAYER_SURFACE_PROP_0,
|
||||||
PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL,
|
PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL,
|
||||||
@ -43,7 +59,6 @@ enum {
|
|||||||
};
|
};
|
||||||
static guint signals [N_SIGNALS];
|
static guint signals [N_SIGNALS];
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct wl_surface *wl_surface;
|
struct wl_surface *wl_surface;
|
||||||
struct zwlr_layer_surface_v1 *layer_surface;
|
struct zwlr_layer_surface_v1 *layer_surface;
|
||||||
@ -52,19 +67,21 @@ typedef struct {
|
|||||||
guint anchor;
|
guint anchor;
|
||||||
guint layer;
|
guint layer;
|
||||||
gboolean kbd_interactivity;
|
gboolean kbd_interactivity;
|
||||||
gint exclusive_zone;
|
int exclusive_zone;
|
||||||
gint margin_top, margin_bottom;
|
int margin_top, margin_bottom;
|
||||||
gint margin_left, margin_right;
|
int margin_left, margin_right;
|
||||||
gint width, height;
|
int width, height;
|
||||||
gint configured_width, configured_height;
|
int configured_width, configured_height;
|
||||||
gchar *namespace;
|
char *namespace;
|
||||||
struct zwlr_layer_shell_v1 *layer_shell;
|
struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
struct wl_output *wl_output;
|
struct wl_output *wl_output;
|
||||||
} PhoshLayerSurfacePrivate;
|
} PhoshLayerSurfacePrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (PhoshLayerSurface, phosh_layer_surface, GTK_TYPE_WINDOW)
|
G_DEFINE_TYPE_WITH_PRIVATE (PhoshLayerSurface, phosh_layer_surface, GTK_TYPE_WINDOW)
|
||||||
|
|
||||||
static void layer_surface_configure(void *data,
|
|
||||||
|
static void
|
||||||
|
layer_surface_configure (void *data,
|
||||||
struct zwlr_layer_surface_v1 *surface,
|
struct zwlr_layer_surface_v1 *surface,
|
||||||
uint32_t serial,
|
uint32_t serial,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
@ -72,6 +89,7 @@ static void layer_surface_configure(void *data,
|
|||||||
{
|
{
|
||||||
PhoshLayerSurface *self = data;
|
PhoshLayerSurface *self = data;
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
@ -80,36 +98,43 @@ static void layer_surface_configure(void *data,
|
|||||||
|
|
||||||
if (priv->configured_height != height) {
|
if (priv->configured_height != height) {
|
||||||
priv->configured_height = height;
|
priv->configured_height = height;
|
||||||
|
changed = TRUE;
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->configured_width != width) {
|
if (priv->configured_width != width) {
|
||||||
priv->configured_width = width;
|
priv->configured_width = width;
|
||||||
|
changed = TRUE;
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH]);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug("Configured %p", self);
|
g_debug ("Configured %s (%p) (%dx%d)", priv->namespace, self, width, height);
|
||||||
|
if (changed)
|
||||||
g_signal_emit (self, signals[CONFIGURED], 0);
|
g_signal_emit (self, signals[CONFIGURED], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void layer_surface_closed (void *data,
|
static void
|
||||||
|
layer_surface_closed (void *data,
|
||||||
struct zwlr_layer_surface_v1 *surface)
|
struct zwlr_layer_surface_v1 *surface)
|
||||||
{
|
{
|
||||||
PhoshLayerSurface *self = data;
|
PhoshLayerSurface *self = data;
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
g_return_if_fail (priv->layer_surface == surface);
|
g_return_if_fail (priv->layer_surface == surface);
|
||||||
|
g_debug ("Destroying layer surface '%s'", priv->namespace);
|
||||||
zwlr_layer_surface_v1_destroy (priv->layer_surface);
|
zwlr_layer_surface_v1_destroy (priv->layer_surface);
|
||||||
priv->layer_surface = NULL;
|
priv->layer_surface = NULL;
|
||||||
gtk_widget_destroy (GTK_WIDGET (self));
|
gtk_widget_destroy (GTK_WIDGET (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
static struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
||||||
.configure = layer_surface_configure,
|
.configure = layer_surface_configure,
|
||||||
.closed = layer_surface_closed,
|
.closed = layer_surface_closed,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
phosh_layer_surface_set_property (GObject *object,
|
phosh_layer_surface_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
@ -118,7 +143,7 @@ phosh_layer_surface_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||||
gint width, height;
|
int width, height;
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
|
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
|
||||||
@ -131,7 +156,7 @@ phosh_layer_surface_set_property (GObject *object,
|
|||||||
priv->anchor = g_value_get_uint (value);
|
priv->anchor = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_LAYER:
|
case PHOSH_LAYER_SURFACE_PROP_LAYER:
|
||||||
priv->layer = g_value_get_uint (value);
|
phosh_layer_surface_set_layer (self, g_value_get_uint (value));
|
||||||
break;
|
break;
|
||||||
case PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY:
|
case PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY:
|
||||||
phosh_layer_surface_set_kbd_interactivity (self, g_value_get_boolean (value));
|
phosh_layer_surface_set_kbd_interactivity (self, g_value_get_boolean (value));
|
||||||
@ -249,15 +274,17 @@ phosh_layer_surface_get_property (GObject *object,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
|
phosh_layer_surface_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (widget);
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
GdkWindow *gdk_window;
|
GdkWindow *gdk_window;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->realize (widget);
|
||||||
|
|
||||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
||||||
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
||||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||||
@ -267,20 +294,24 @@ on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_phosh_layer_surface_mapped (PhoshLayerSurface *self, gpointer unused)
|
phosh_layer_surface_map (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (widget);
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
GdkWindow *gdk_window;
|
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->map (widget);
|
||||||
|
|
||||||
if (!priv->wl_surface) {
|
if (!priv->wl_surface) {
|
||||||
|
GdkWindow *gdk_window;
|
||||||
|
|
||||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
||||||
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
||||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||||
}
|
}
|
||||||
g_debug ("Mapped %p", priv->wl_surface);
|
g_debug ("Mapped %p, namespace: %s", priv->wl_surface, priv->namespace);
|
||||||
|
|
||||||
priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface (priv->layer_shell,
|
priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface (priv->layer_shell,
|
||||||
priv->wl_surface,
|
priv->wl_surface,
|
||||||
@ -306,37 +337,20 @@ on_phosh_layer_surface_mapped (PhoshLayerSurface *self, gpointer unused)
|
|||||||
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_phosh_layer_surface_unmapped (PhoshLayerSurface *self, gpointer unused)
|
phosh_layer_surface_unmap (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (widget);
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
if (priv->layer_surface) {
|
|
||||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
g_clear_pointer (&priv->layer_surface, zwlr_layer_surface_v1_destroy);
|
||||||
priv->layer_surface = NULL;
|
|
||||||
}
|
|
||||||
priv->wl_surface = NULL;
|
priv->wl_surface = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
GTK_WIDGET_CLASS (phosh_layer_surface_parent_class)->unmap (widget);
|
||||||
phosh_layer_surface_constructed (GObject *object)
|
|
||||||
{
|
|
||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
|
||||||
|
|
||||||
g_signal_connect (self, "realize",
|
|
||||||
G_CALLBACK (on_phosh_layer_surface_realized),
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (self, "map",
|
|
||||||
G_CALLBACK (on_phosh_layer_surface_mapped),
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (self, "unmap",
|
|
||||||
G_CALLBACK (on_phosh_layer_surface_unmapped),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->constructed (object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -346,10 +360,7 @@ phosh_layer_surface_dispose (GObject *object)
|
|||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
g_clear_pointer (&priv->layer_surface, zwlr_layer_surface_v1_destroy);
|
||||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
|
||||||
priv->layer_surface = NULL;
|
|
||||||
}
|
|
||||||
g_clear_pointer (&priv->namespace, g_free);
|
g_clear_pointer (&priv->namespace, g_free);
|
||||||
|
|
||||||
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->dispose (object);
|
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->dispose (object);
|
||||||
@ -360,26 +371,29 @@ static void
|
|||||||
phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = (GObjectClass *)klass;
|
GObjectClass *object_class = (GObjectClass *)klass;
|
||||||
|
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
|
||||||
|
|
||||||
object_class->constructed = phosh_layer_surface_constructed;
|
|
||||||
object_class->dispose = phosh_layer_surface_dispose;
|
object_class->dispose = phosh_layer_surface_dispose;
|
||||||
|
|
||||||
object_class->set_property = phosh_layer_surface_set_property;
|
object_class->set_property = phosh_layer_surface_set_property;
|
||||||
object_class->get_property = phosh_layer_surface_get_property;
|
object_class->get_property = phosh_layer_surface_get_property;
|
||||||
|
|
||||||
|
widget_class->realize = phosh_layer_surface_realize;
|
||||||
|
widget_class->map = phosh_layer_surface_map;
|
||||||
|
widget_class->unmap = phosh_layer_surface_unmap;
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL] =
|
props[PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL] =
|
||||||
g_param_spec_pointer (
|
g_param_spec_pointer (
|
||||||
"layer-shell",
|
"layer-shell",
|
||||||
"Wayland Layer Shell Global",
|
"Wayland Layer Shell Global",
|
||||||
"The layer shell wayland global",
|
"The layer shell wayland global",
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT] =
|
props[PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT] =
|
||||||
g_param_spec_pointer (
|
g_param_spec_pointer (
|
||||||
"wl-output",
|
"wl-output",
|
||||||
"Wayland Output",
|
"Wayland Output",
|
||||||
"The wl_output associated with this surface",
|
"The wl_output associated with this surface",
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_ANCHOR] =
|
props[PHOSH_LAYER_SURFACE_PROP_ANCHOR] =
|
||||||
g_param_spec_uint (
|
g_param_spec_uint (
|
||||||
@ -389,7 +403,7 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
|||||||
0,
|
0,
|
||||||
G_MAXUINT,
|
G_MAXUINT,
|
||||||
0,
|
0,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER] =
|
props[PHOSH_LAYER_SURFACE_PROP_LAYER] =
|
||||||
g_param_spec_uint (
|
g_param_spec_uint (
|
||||||
@ -399,7 +413,7 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
|||||||
0,
|
0,
|
||||||
G_MAXUINT,
|
G_MAXUINT,
|
||||||
0,
|
0,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] =
|
props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] =
|
||||||
g_param_spec_boolean (
|
g_param_spec_boolean (
|
||||||
@ -506,13 +520,13 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
|||||||
"Namespace",
|
"Namespace",
|
||||||
"Namespace of the layer surface",
|
"Namespace of the layer surface",
|
||||||
"",
|
"",
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PHOSH_LAYER_SURFACE_PROP_LAST_PROP, props);
|
g_object_class_install_properties (object_class, PHOSH_LAYER_SURFACE_PROP_LAST_PROP, props);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhoshLayersurface::configured
|
* PhoshLayerSurface::configured
|
||||||
* @self: The #PhoshLayersurface instance.
|
* @self: The #PhoshLayerSurface instance.
|
||||||
*
|
*
|
||||||
* This signal is emitted once we received the configure event from the
|
* This signal is emitted once we received the configure event from the
|
||||||
* compositor.
|
* compositor.
|
||||||
@ -539,11 +553,14 @@ phosh_layer_surface_new (gpointer layer_shell,
|
|||||||
{
|
{
|
||||||
return g_object_new (PHOSH_TYPE_LAYER_SURFACE,
|
return g_object_new (PHOSH_TYPE_LAYER_SURFACE,
|
||||||
"layer-shell", layer_shell,
|
"layer-shell", layer_shell,
|
||||||
"wl-output", wl_output);
|
"wl-output", wl_output,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_get_surface:
|
* phosh_layer_surface_get_surface:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
*
|
*
|
||||||
* Get the layer layer surface or #NULL if the window
|
* Get the layer layer surface or #NULL if the window
|
||||||
* is not yet realized.
|
* is not yet realized.
|
||||||
@ -561,6 +578,7 @@ phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_get_wl_surface:
|
* phosh_layer_surface_get_wl_surface:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
*
|
*
|
||||||
* Get the layer wayland surface or #NULL if the window
|
* Get the layer wayland surface or #NULL if the window
|
||||||
* is not yet realized.
|
* is not yet realized.
|
||||||
@ -575,58 +593,63 @@ phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self)
|
|||||||
return priv->wl_surface;
|
return priv->wl_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_size:
|
* phosh_layer_surface_set_size:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @width: the height in pixels
|
||||||
|
* @height: the width in pixels
|
||||||
*
|
*
|
||||||
* Set the size of a layer surface. A value of '-1' indicates 'use old value'
|
* Set the size of a layer surface. A value of '-1' indicates 'use old value'
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
phosh_layer_surface_set_size(PhoshLayerSurface *self, gint width, gint height)
|
phosh_layer_surface_set_size (PhoshLayerSurface *self, int width, int height)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
gint old_width, old_height;
|
int old_width, old_height;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->height == height && priv->width == width) {
|
if (priv->height == height && priv->width == width)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
old_width = priv->width;
|
old_width = priv->width;
|
||||||
old_height = priv->height;
|
old_height = priv->height;
|
||||||
|
|
||||||
if (width != -1) {
|
if (width != -1)
|
||||||
priv->width = width;
|
priv->width = width;
|
||||||
}
|
|
||||||
|
|
||||||
if (height != -1) {
|
if (height != -1)
|
||||||
priv->height = height;
|
priv->height = height;
|
||||||
}
|
|
||||||
|
|
||||||
if (gtk_widget_get_mapped (GTK_WIDGET (self))) {
|
if (gtk_widget_get_mapped (GTK_WIDGET (self))) {
|
||||||
zwlr_layer_surface_v1_set_size (priv->layer_surface, priv->width, priv->height);
|
zwlr_layer_surface_v1_set_size (priv->layer_surface, priv->width, priv->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->height != old_height) {
|
if (priv->height != old_height)
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT]);
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->width != old_width) {
|
if (priv->width != old_width)
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_margins:
|
* phosh_layer_surface_set_margins:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @top: the top margin in pixels
|
||||||
|
* @right: the right margin in pixels
|
||||||
|
* @bottom: the bottom margin in pixels
|
||||||
|
* @left: the left margin in pixels
|
||||||
*
|
*
|
||||||
* Set anchor margins of a layer surface.
|
* Set anchor margins of a layer surface.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
phosh_layer_surface_set_margins(PhoshLayerSurface *self, gint top, gint right, gint bottom, gint left)
|
phosh_layer_surface_set_margins (PhoshLayerSurface *self, int top, int right, int bottom, int left)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
gint old_top, old_bottom, old_left, old_right;
|
int old_top, old_bottom, old_left, old_right;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
@ -636,64 +659,62 @@ phosh_layer_surface_set_margins(PhoshLayerSurface *self, gint top, gint right, g
|
|||||||
old_right = priv->margin_right;
|
old_right = priv->margin_right;
|
||||||
old_bottom = priv->margin_bottom;
|
old_bottom = priv->margin_bottom;
|
||||||
|
|
||||||
if (old_top == top && old_left == left && old_right == right && old_bottom == bottom) {
|
if (old_top == top && old_left == left && old_right == right && old_bottom == bottom)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
priv->margin_top = top;
|
priv->margin_top = top;
|
||||||
priv->margin_left = left;
|
priv->margin_left = left;
|
||||||
priv->margin_right = right;
|
priv->margin_right = right;
|
||||||
priv->margin_bottom = bottom;
|
priv->margin_bottom = bottom;
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
if (priv->layer_surface)
|
||||||
zwlr_layer_surface_v1_set_margin (priv->layer_surface, top, right, bottom, left);
|
zwlr_layer_surface_v1_set_margin (priv->layer_surface, top, right, bottom, left);
|
||||||
}
|
|
||||||
|
|
||||||
if (old_top != top) {
|
if (old_top != top)
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_TOP]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_TOP]);
|
||||||
}
|
if (old_bottom != bottom)
|
||||||
if (old_bottom != bottom) {
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_BOTTOM]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_BOTTOM]);
|
||||||
}
|
if (old_left != left)
|
||||||
if (old_left != left) {
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_LEFT]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_LEFT]);
|
||||||
}
|
if (old_right != right)
|
||||||
if (old_right != right) {
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_RIGHT]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_MARGIN_RIGHT]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_exclusive_zone:
|
* phosh_layer_surface_set_exclusive_zone:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @zone: Size of the exclusive zone.
|
||||||
*
|
*
|
||||||
* Set exclusive zone of a layer surface.
|
* Set exclusive zone of a layer surface.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self, gint zone)
|
phosh_layer_surface_set_exclusive_zone (PhoshLayerSurface *self, int zone)
|
||||||
{
|
{
|
||||||
PhoshLayerSurfacePrivate *priv;
|
PhoshLayerSurfacePrivate *priv;
|
||||||
gint old_zone;
|
int old_zone;
|
||||||
|
|
||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
old_zone = priv->exclusive_zone;
|
old_zone = priv->exclusive_zone;
|
||||||
|
|
||||||
if (old_zone == zone) {
|
if (old_zone == zone)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
priv->exclusive_zone = zone;
|
priv->exclusive_zone = zone;
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
if (priv->layer_surface)
|
||||||
zwlr_layer_surface_v1_set_exclusive_zone (priv->layer_surface, zone);
|
zwlr_layer_surface_v1_set_exclusive_zone (priv->layer_surface, zone);
|
||||||
}
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_set_keyboard_interactivity:
|
* phosh_layer_surface_set_keyboard_interactivity:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @interactivity: %TRUE if the #PhoshLayerSurface should receive keyboard input.
|
||||||
*
|
*
|
||||||
* Set keyboard ineractivity a layer surface.
|
* Set keyboard ineractivity a layer surface.
|
||||||
*/
|
*/
|
||||||
@ -705,20 +726,48 @@ phosh_layer_surface_set_kbd_interactivity (PhoshLayerSurface *self, gboolean int
|
|||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->kbd_interactivity == interactivity) {
|
if (priv->kbd_interactivity == interactivity)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
priv->kbd_interactivity = interactivity;
|
priv->kbd_interactivity = interactivity;
|
||||||
|
|
||||||
if (priv->layer_surface) {
|
if (priv->layer_surface)
|
||||||
zwlr_layer_surface_v1_set_keyboard_interactivity (priv->layer_surface, interactivity);
|
zwlr_layer_surface_v1_set_keyboard_interactivity (priv->layer_surface, interactivity);
|
||||||
}
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phosh_layer_surface_set_layer:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
|
* @layer: The layer.
|
||||||
|
*
|
||||||
|
* Sets the layer a layer-surface belongs to `layer`.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
phosh_layer_surface_set_layer (PhoshLayerSurface *self, guint32 layer)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
if (priv->layer == layer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv->layer = layer;
|
||||||
|
|
||||||
|
if (priv->layer_surface)
|
||||||
|
zwlr_layer_surface_v1_set_layer (priv->layer_surface, layer);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phosh_layer_surface_wl_surface_commit:
|
* phosh_layer_surface_wl_surface_commit:
|
||||||
|
* @self: The #PhoshLayerSurface
|
||||||
*
|
*
|
||||||
* Forces a commit of layer surface's state.
|
* Forces a commit of layer surface's state.
|
||||||
*/
|
*/
|
||||||
@ -730,7 +779,52 @@ phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self)
|
|||||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
priv = phosh_layer_surface_get_instance_private (self);
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->wl_surface) {
|
if (priv->wl_surface)
|
||||||
wl_surface_commit (priv->wl_surface);
|
wl_surface_commit (priv->wl_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
phosh_layer_surface_get_margins (PhoshLayerSurface *self, int *top, int *right, int *bottom, int *left)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
if (top)
|
||||||
|
*top = priv->margin_top;
|
||||||
|
|
||||||
|
if (right)
|
||||||
|
*right = priv->margin_right;
|
||||||
|
|
||||||
|
if (bottom)
|
||||||
|
*bottom = priv->margin_bottom;
|
||||||
|
|
||||||
|
if (left)
|
||||||
|
*left = priv->margin_left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
phosh_layer_surface_get_configured_width (PhoshLayerSurface *self)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (PHOSH_IS_LAYER_SURFACE (self), 0);
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
return priv->configured_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
phosh_layer_surface_get_configured_height (PhoshLayerSurface *self)
|
||||||
|
{
|
||||||
|
PhoshLayerSurfacePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (PHOSH_IS_LAYER_SURFACE (self), 0);
|
||||||
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
|
return priv->configured_height;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Purism SPC
|
* Copyright (C) 2018 Purism SPC
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-3.0+
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
WARNING: this file is taken directly from phosh, with no modificaions apart from this message. Please update phosh instead of changing this file. Please copy the file back here afterwards, with the same notice.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -17,6 +10,8 @@ WARNING: this file is taken directly from phosh, with no modificaions apart from
|
|||||||
/* TODO: We use the enum constants from here, use glib-mkenums */
|
/* TODO: We use the enum constants from here, use glib-mkenums */
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define PHOSH_TYPE_LAYER_SURFACE (phosh_layer_surface_get_type ())
|
#define PHOSH_TYPE_LAYER_SURFACE (phosh_layer_surface_get_type ())
|
||||||
|
|
||||||
G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_SURFACE, GtkWindow)
|
G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_SURFACE, GtkWindow)
|
||||||
@ -24,6 +19,7 @@ G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_S
|
|||||||
/**
|
/**
|
||||||
* PhoshLayerSurfaceClass
|
* PhoshLayerSurfaceClass
|
||||||
* @parent_class: The parent class
|
* @parent_class: The parent class
|
||||||
|
* @configured: invoked when layer surface is configured
|
||||||
*/
|
*/
|
||||||
struct _PhoshLayerSurfaceClass
|
struct _PhoshLayerSurfaceClass
|
||||||
{
|
{
|
||||||
@ -39,15 +35,26 @@ GtkWidget *phosh_layer_surface_new (gpointer layer_shell,
|
|||||||
struct zwlr_layer_surface_v1 *phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self);
|
struct zwlr_layer_surface_v1 *phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self);
|
||||||
struct wl_surface *phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self);
|
struct wl_surface *phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self);
|
||||||
void phosh_layer_surface_set_size(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_size(PhoshLayerSurface *self,
|
||||||
gint width,
|
int width,
|
||||||
gint height);
|
int height);
|
||||||
void phosh_layer_surface_set_margins(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_margins(PhoshLayerSurface *self,
|
||||||
gint top,
|
int top,
|
||||||
gint right,
|
int right,
|
||||||
gint bottom,
|
int bottom,
|
||||||
gint left);
|
int left);
|
||||||
void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self,
|
||||||
gint zone);
|
int zone);
|
||||||
void phosh_layer_surface_set_kbd_interactivity(PhoshLayerSurface *self,
|
void phosh_layer_surface_set_kbd_interactivity(PhoshLayerSurface *self,
|
||||||
gboolean interactivity);
|
gboolean interactivity);
|
||||||
|
void phosh_layer_surface_set_layer (PhoshLayerSurface *self,
|
||||||
|
guint32 layer);
|
||||||
void phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self);
|
void phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self);
|
||||||
|
void phosh_layer_surface_get_margins (PhoshLayerSurface *self,
|
||||||
|
int *top,
|
||||||
|
int *right,
|
||||||
|
int *bottom,
|
||||||
|
int *left);
|
||||||
|
int phosh_layer_surface_get_configured_width (PhoshLayerSurface *self);
|
||||||
|
int phosh_layer_surface_get_configured_height (PhoshLayerSurface *self);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="1">
|
<interface name="zwlr_layer_shell_v1" version="4">
|
||||||
<description summary="create surfaces that are layers of the desktop">
|
<description summary="create surfaces that are layers of the desktop">
|
||||||
Clients can use this interface to assign the surface_layer role to
|
Clients can use this interface to assign the surface_layer role to
|
||||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||||
@ -47,6 +47,12 @@
|
|||||||
or manipulate a buffer prior to the first layer_surface.configure call
|
or manipulate a buffer prior to the first layer_surface.configure call
|
||||||
must also be treated as errors.
|
must also be treated as errors.
|
||||||
|
|
||||||
|
After creating a layer_surface object and setting it up, the client
|
||||||
|
must perform an initial commit without any buffer attached.
|
||||||
|
The compositor will reply with a layer_surface.configure event.
|
||||||
|
The client must acknowledge it and is then allowed to attach a buffer
|
||||||
|
to map the surface.
|
||||||
|
|
||||||
You may pass NULL for output to allow the compositor to decide which
|
You may pass NULL for output to allow the compositor to decide which
|
||||||
output to use. Generally this will be the one that the user most
|
output to use. Generally this will be the one that the user most
|
||||||
recently interacted with.
|
recently interacted with.
|
||||||
@ -82,17 +88,35 @@
|
|||||||
<entry name="top" value="2"/>
|
<entry name="top" value="2"/>
|
||||||
<entry name="overlay" value="3"/>
|
<entry name="overlay" value="3"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
|
<!-- Version 3 additions -->
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor" since="3">
|
||||||
|
<description summary="destroy the layer_shell object">
|
||||||
|
This request indicates that the client will not use the layer_shell
|
||||||
|
object any more. Objects that have been created through this instance
|
||||||
|
are not affected.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zwlr_layer_surface_v1" version="1">
|
<interface name="zwlr_layer_surface_v1" version="4">
|
||||||
<description summary="layer metadata interface">
|
<description summary="layer metadata interface">
|
||||||
An interface that may be implemented by a wl_surface, for surfaces that
|
An interface that may be implemented by a wl_surface, for surfaces that
|
||||||
are designed to be rendered as a layer of a stacked desktop-like
|
are designed to be rendered as a layer of a stacked desktop-like
|
||||||
environment.
|
environment.
|
||||||
|
|
||||||
Layer surface state (size, anchor, exclusive zone, margin, interactivity)
|
Layer surface state (layer, size, anchor, exclusive zone,
|
||||||
is double-buffered, and will be applied at the time wl_surface.commit of
|
margin, interactivity) is double-buffered, and will be applied at the
|
||||||
the corresponding wl_surface is called.
|
time wl_surface.commit of the corresponding wl_surface is called.
|
||||||
|
|
||||||
|
Attaching a null buffer to a layer surface unmaps it.
|
||||||
|
|
||||||
|
Unmapping a layer_surface means that the surface cannot be shown by the
|
||||||
|
compositor until it is explicitly mapped again. The layer_surface
|
||||||
|
returns to the state it had right after layer_shell.get_layer_surface.
|
||||||
|
The client can re-map the surface by performing a commit without any
|
||||||
|
buffer attached, waiting for a configure event and handling it as usual.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<request name="set_size">
|
<request name="set_size">
|
||||||
@ -127,14 +151,19 @@
|
|||||||
|
|
||||||
<request name="set_exclusive_zone">
|
<request name="set_exclusive_zone">
|
||||||
<description summary="configures the exclusive geometry of this surface">
|
<description summary="configures the exclusive geometry of this surface">
|
||||||
Requests that the compositor avoids occluding an area of the surface
|
Requests that the compositor avoids occluding an area with other
|
||||||
with other surfaces. The compositor's use of this information is
|
surfaces. The compositor's use of this information is
|
||||||
implementation-dependent - do not assume that this region will not
|
implementation-dependent - do not assume that this region will not
|
||||||
actually be occluded.
|
actually be occluded.
|
||||||
|
|
||||||
A positive value is only meaningful if the surface is anchored to an
|
A positive value is only meaningful if the surface is anchored to one
|
||||||
edge, rather than a corner. The zone is the number of surface-local
|
edge or an edge and both perpendicular edges. If the surface is not
|
||||||
coordinates from the edge that is considered exclusive.
|
anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||||
|
to only two parallel edges or anchored to all edges, a positive value
|
||||||
|
will be treated the same as zero.
|
||||||
|
|
||||||
|
A positive zone is the distance from the edge in surface-local
|
||||||
|
coordinates to consider exclusive.
|
||||||
|
|
||||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||||
how they should interact with surfaces that do. If set to zero, the
|
how they should interact with surfaces that do. If set to zero, the
|
||||||
@ -174,21 +203,85 @@
|
|||||||
<arg name="left" type="int"/>
|
<arg name="left" type="int"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<enum name="keyboard_interactivity">
|
||||||
|
<description summary="types of keyboard interaction possible for a layer shell surface">
|
||||||
|
Types of keyboard interaction possible for layer shell surfaces. The
|
||||||
|
rationale for this is twofold: (1) some applications are not interested
|
||||||
|
in keyboard events and not allowing them to be focused can improve the
|
||||||
|
desktop experience; (2) some applications will want to take exclusive
|
||||||
|
keyboard focus.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<entry name="none" value="0">
|
||||||
|
<description summary="no keyboard focus is possible">
|
||||||
|
This value indicates that this surface is not interested in keyboard
|
||||||
|
events and the compositor should never assign it the keyboard focus.
|
||||||
|
|
||||||
|
This is the default value, set for newly created layer shell surfaces.
|
||||||
|
|
||||||
|
This is useful for e.g. desktop widgets that display information or
|
||||||
|
only have interaction with non-keyboard input devices.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="exclusive" value="1">
|
||||||
|
<description summary="request exclusive keyboard focus">
|
||||||
|
Request exclusive keyboard focus if this surface is above the shell surface layer.
|
||||||
|
|
||||||
|
For the top and overlay layers, the seat will always give
|
||||||
|
exclusive keyboard focus to the top-most layer which has keyboard
|
||||||
|
interactivity set to exclusive. If this layer contains multiple
|
||||||
|
surfaces with keyboard interactivity set to exclusive, the compositor
|
||||||
|
determines the one receiving keyboard events in an implementation-
|
||||||
|
defined manner. In this case, no guarantee is made when this surface
|
||||||
|
will receive keyboard focus (if ever).
|
||||||
|
|
||||||
|
For the bottom and background layers, the compositor is allowed to use
|
||||||
|
normal focus semantics.
|
||||||
|
|
||||||
|
This setting is mainly intended for applications that need to ensure
|
||||||
|
they receive all keyboard events, such as a lock screen or a password
|
||||||
|
prompt.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="on_demand" value="2" since="4">
|
||||||
|
<description summary="request regular keyboard focus semantics">
|
||||||
|
This requests the compositor to allow this surface to be focused and
|
||||||
|
unfocused by the user in an implementation-defined manner. The user
|
||||||
|
should be able to unfocus this surface even regardless of the layer
|
||||||
|
it is on.
|
||||||
|
|
||||||
|
Typically, the compositor will want to use its normal mechanism to
|
||||||
|
manage keyboard focus between layer shell surfaces with this setting
|
||||||
|
and regular toplevels on the desktop layer (e.g. click to focus).
|
||||||
|
Nevertheless, it is possible for a compositor to require a special
|
||||||
|
interaction to focus or unfocus layer shell surfaces (e.g. requiring
|
||||||
|
a click even if focus follows the mouse normally, or providing a
|
||||||
|
keybinding to switch focus between layers).
|
||||||
|
|
||||||
|
This setting is mainly intended for desktop shell components (e.g.
|
||||||
|
panels) that allow keyboard interaction. Using this option can allow
|
||||||
|
implementing a desktop shell that can be fully usable without the
|
||||||
|
mouse.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
</enum>
|
||||||
|
|
||||||
<request name="set_keyboard_interactivity">
|
<request name="set_keyboard_interactivity">
|
||||||
<description summary="requests keyboard events">
|
<description summary="requests keyboard events">
|
||||||
Set to 1 to request that the seat send keyboard events to this layer
|
Set how keyboard events are delivered to this surface. By default,
|
||||||
surface. For layers below the shell surface layer, the seat will use
|
layer shell surfaces do not receive keyboard events; this request can
|
||||||
normal focus semantics. For layers above the shell surface layers, the
|
be used to change this.
|
||||||
seat will always give exclusive keyboard focus to the top-most layer
|
|
||||||
which has keyboard interactivity set to true.
|
This setting is inherited by child surfaces set by the get_popup
|
||||||
|
request.
|
||||||
|
|
||||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||||
you do not want to receive them, set the input region on your surface
|
you do not want to receive them, set the input region on your surface
|
||||||
to an empty region.
|
to an empty region.
|
||||||
|
|
||||||
Events is double-buffered, see wl_surface.commit.
|
Keyboard interactivity is double-buffered, see wl_surface.commit.
|
||||||
</description>
|
</description>
|
||||||
<arg name="keyboard_interactivity" type="uint"/>
|
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="get_popup">
|
<request name="get_popup">
|
||||||
@ -273,6 +366,7 @@
|
|||||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||||
|
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
<enum name="anchor" bitfield="true">
|
<enum name="anchor" bitfield="true">
|
||||||
@ -281,5 +375,16 @@
|
|||||||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
|
<!-- Version 2 additions -->
|
||||||
|
|
||||||
|
<request name="set_layer" since="2">
|
||||||
|
<description summary="change the layer of the surface">
|
||||||
|
Change the layer that the surface is rendered on.
|
||||||
|
|
||||||
|
Layer is double-buffered, see wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|||||||
Reference in New Issue
Block a user