1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-30 15:49:31 +00:00

src/calls-call-window.c: Inhibit suspend during active call

This commit is contained in:
Evangelos Ribeiro Tzaras 2020-08-06 22:28:37 +02:00 committed by Guido Gunther
parent c43bfe3ebb
commit 9619ebb674

View file

@ -60,6 +60,8 @@ struct _CallsCallWindow
GtkStack *call_stack;
GtkFlowBox *call_selector;
guint inhibit_cookie;
#ifdef CALLS_WAYLAND
gboolean screensaver_active;
struct zwlr_layer_shell_v1 *layer_shell_iface;
@ -164,6 +166,28 @@ update_layer_surface (CallsCallWindow *self,
#endif // CALLS_WAYLAND
static void
session_inhibit (CallsCallWindow *self, gboolean inhibit)
{
if (inhibit)
{
if (self->inhibit_cookie == 0)
self->inhibit_cookie =
gtk_application_inhibit (gtk_window_get_application (GTK_WINDOW (self)),
GTK_WINDOW (self),
GTK_APPLICATION_INHIBIT_SUSPEND,
"call active");
}
else
{
gtk_application_uninhibit (gtk_window_get_application (GTK_WINDOW (self)),
self->inhibit_cookie);
self->inhibit_cookie = 0;
}
}
static void
update_visibility (CallsCallWindow *self)
{
@ -184,6 +208,8 @@ update_visibility (CallsCallWindow *self)
{
gtk_stack_set_visible_child_name (self->main_stack, "active-call");
}
session_inhibit (self, !!calls);
}