Update layer surface code from phosh
As of commit 77bba4fcb2d836a58ccf8913d9a514aac6cc49a2. This allows us to split the widget creation from making it visible.
This commit is contained in:
@ -65,9 +65,9 @@ static void layer_surface_configure(void *data,
|
|||||||
uint32_t height)
|
uint32_t height)
|
||||||
{
|
{
|
||||||
PhoshLayerSurface *self = data;
|
PhoshLayerSurface *self = data;
|
||||||
|
|
||||||
gtk_window_resize (GTK_WINDOW (self), width, height);
|
gtk_window_resize (GTK_WINDOW (self), width, height);
|
||||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
||||||
gtk_widget_show_all (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
g_signal_emit (self, signals[CONFIGURED], 0);
|
g_signal_emit (self, signals[CONFIGURED], 0);
|
||||||
}
|
}
|
||||||
@ -180,20 +180,21 @@ phosh_layer_surface_get_property (GObject *object,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
phosh_layer_surface_constructed (GObject *object)
|
on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
|
||||||
{
|
{
|
||||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
PhoshLayerSurfacePrivate *priv;
|
||||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
|
||||||
GdkWindow *gdk_window;
|
GdkWindow *gdk_window;
|
||||||
|
|
||||||
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
gtk_window_set_decorated (GTK_WINDOW (self), FALSE);
|
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||||
/* Realize the window so we can get the GDK window */
|
|
||||||
gtk_widget_realize(GTK_WIDGET (self));
|
priv = phosh_layer_surface_get_instance_private (self);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
||||||
|
|
||||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||||
|
|
||||||
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,
|
||||||
@ -209,8 +210,34 @@ phosh_layer_surface_constructed (GObject *object)
|
|||||||
&layer_surface_listener,
|
&layer_surface_listener,
|
||||||
self);
|
self);
|
||||||
wl_surface_commit(priv->wl_surface);
|
wl_surface_commit(priv->wl_surface);
|
||||||
|
|
||||||
|
gtk_window_set_decorated (GTK_WINDOW (self), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_phosh_layer_surface_mapped (PhoshLayerSurface *self, gpointer unused)
|
||||||
|
{
|
||||||
|
/* Process all pending events, otherwise we end up sending ack configure
|
||||||
|
* to a not yet configured surface */
|
||||||
|
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
phosh_layer_surface_dispose (GObject *object)
|
phosh_layer_surface_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -352,6 +379,12 @@ phosh_layer_surface_new (gpointer layer_shell,
|
|||||||
"wl-output", wl_output);
|
"wl-output", wl_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phosh_layer_surface_get_surface:
|
||||||
|
*
|
||||||
|
* Get the layer layer surface or #NULL if the window
|
||||||
|
* is not yet realized.
|
||||||
|
*/
|
||||||
struct zwlr_layer_surface_v1 *
|
struct zwlr_layer_surface_v1 *
|
||||||
phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
||||||
{
|
{
|
||||||
@ -363,6 +396,12 @@ phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phosh_layer_surface_get_wl_surface:
|
||||||
|
*
|
||||||
|
* Get the layer wayland surface or #NULL if the window
|
||||||
|
* is not yet realized.
|
||||||
|
*/
|
||||||
struct wl_surface *
|
struct wl_surface *
|
||||||
phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self)
|
phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user