Commit 75a32e24 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

layer-surface: Distinguish requested and configured width/height

{width,height} represent the user request while
configured_{width,height} represent what the compositor sent us.

This allows clients to see how their size request matches the
actual surface size.
parent d7951f5e
Pipeline #40794 passed with stages
in 9 minutes and 12 seconds
......@@ -25,6 +25,8 @@ enum {
PHOSH_LAYER_SURFACE_PROP_MARGIN_RIGHT,
PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH,
PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT,
PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH,
PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT,
PHOSH_LAYER_SURFACE_PROP_NAMESPACE,
PHOSH_LAYER_SURFACE_PROP_LAST_PROP
};
......@@ -49,6 +51,7 @@ typedef struct {
gint margin_top, margin_bottom;
gint margin_left, margin_right;
gint width, height;
gint configured_width, configured_height;
gchar *namespace;
struct zwlr_layer_shell_v1 *layer_shell;
struct wl_output *wl_output;
......@@ -70,14 +73,14 @@ static void layer_surface_configure(void *data,
gtk_window_resize (GTK_WINDOW (self), width, height);
zwlr_layer_surface_v1_ack_configure(surface, serial);
if (priv->height != height) {
priv->height = height;
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT]);
if (priv->configured_height != height) {
priv->configured_height = height;
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT]);
}
if (priv->width != width) {
priv->width = width;
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH]);
if (priv->configured_width != width) {
priv->configured_width = width;
g_object_notify_by_pspec (G_OBJECT (self), props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH]);
}
g_debug("Configured %p", self);
......@@ -224,6 +227,12 @@ phosh_layer_surface_get_property (GObject *object,
case PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT:
g_value_set_uint (value, priv->height);
break;
case PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH:
g_value_set_uint (value, priv->configured_width);
break;
case PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT:
g_value_set_uint (value, priv->configured_height);
break;
case PHOSH_LAYER_SURFACE_PROP_NAMESPACE:
g_value_set_string (value, priv->namespace);
break;
......@@ -466,6 +475,27 @@ phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_WIDTH] =
g_param_spec_uint (
"configured-width",
"Configured width",
"The width of the layer surface set by the compositor",
0,
G_MAXUINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
props[PHOSH_LAYER_SURFACE_PROP_CONFIGURED_HEIGHT] =
g_param_spec_uint (
"configured-height",
"Configured height",
"The height of the layer surface set by the compositor",
0,
G_MAXUINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
props[PHOSH_LAYER_SURFACE_PROP_NAMESPACE] =
g_param_spec_string (
"namespace",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment