ServerContextService: Check for mapped/unmapped

Visible does not tell us if the widget is actually visible on the
screen.
This commit is contained in:
Guido Günther
2019-07-17 00:11:20 +02:00
parent 93e9b2dde9
commit 8dafad80b1

View File

@ -45,8 +45,6 @@ struct _ServerContextService {
GtkWidget *window; GtkWidget *window;
GtkWidget *widget; GtkWidget *widget;
gulong notify_visible_handler;
gdouble size_constraint_landscape[2]; gdouble size_constraint_landscape[2];
gdouble size_constraint_portrait[2]; gdouble size_constraint_portrait[2];
}; };
@ -111,16 +109,21 @@ on_notify_fullscreen (GObject *object,
} }
static void static void
on_notify_visible (GObject *object, on_notify_map (GObject *object,
GParamSpec *spec,
ServerContextService *context) ServerContextService *context)
{ {
gboolean visible; g_object_set (context, "visible", TRUE, NULL);
g_object_get (object, "visible", &visible, NULL);
g_object_set (context, "visible", visible, NULL);
} }
static void
on_notify_unmap (GObject *object,
ServerContextService *context)
{
g_object_set (context, "visible", FALSE, NULL);
}
static void static void
set_geometry (ServerContextService *context) set_geometry (ServerContextService *context)
{ {
@ -193,14 +196,11 @@ make_window (ServerContextService *context)
NULL NULL
); );
g_signal_connect (context->window, "destroy", g_object_connect (context->window,
G_CALLBACK(on_destroy), "signal::destroy", G_CALLBACK(on_destroy), context,
context); "signal::map", G_CALLBACK(on_notify_map), context,
"signal::unmap", G_CALLBACK(on_notify_unmap), context,
context->notify_visible_handler = NULL);
g_signal_connect (context->window, "notify::visible",
G_CALLBACK(on_notify_visible),
context);
// The properties below are just to make hacking easier. // The properties below are just to make hacking easier.
// The way we use layer-shell overrides some, // The way we use layer-shell overrides some,