mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-05 19:15:32 +00:00
src/calls-call-window.c: Inhibit suspend during active call
This commit is contained in:
parent
c43bfe3ebb
commit
9619ebb674
1 changed files with 26 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue