Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
xdg-desktop-portal-gtk.22176
xdg-desktop-portal-gtk-idle-timeout.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xdg-desktop-portal-gtk-idle-timeout.patch of Package xdg-desktop-portal-gtk.22176
Index: xdg-desktop-portal-gtk-1.8.0/src/session.c =================================================================== --- xdg-desktop-portal-gtk-1.8.0.orig/src/session.c +++ xdg-desktop-portal-gtk-1.8.0/src/session.c @@ -148,6 +148,7 @@ session_finalize (GObject *object) { Session *session = (Session *)object; + idle_timeout_release (); g_hash_table_remove (sessions, session->id); g_free (session->id); @@ -161,6 +162,7 @@ session_constructed (GObject *object) Session *session = (Session *)object; g_hash_table_insert (sessions, g_strdup (session->id), session); + idle_timeout_inhibit (); G_OBJECT_CLASS (session_parent_class)->constructed (object); } Index: xdg-desktop-portal-gtk-1.8.0/src/xdg-desktop-portal-gtk.c =================================================================== --- xdg-desktop-portal-gtk-1.8.0.orig/src/xdg-desktop-portal-gtk.c +++ xdg-desktop-portal-gtk-1.8.0/src/xdg-desktop-portal-gtk.c @@ -58,9 +58,14 @@ #include "wallpaper.h" +#define IDLE_TIMEOUT_MS 1000 + static GMainLoop *loop = NULL; static GHashTable *outstanding_handles = NULL; +static gint idle_timeout_id; +static gint idle_timeout_inhibit_count; + static gboolean opt_verbose; static gboolean opt_replace; static gboolean show_version; @@ -213,6 +218,45 @@ on_name_lost (GDBusConnection *connectio g_main_loop_quit (loop); } +static gboolean +on_idle_timeout (void) +{ + g_main_loop_quit (loop); + return FALSE; +} + +static void +idle_timeout_stop (void) +{ + if (idle_timeout_id) + { + g_source_remove (idle_timeout_id); + idle_timeout_id = 0; + } +} + +static void +idle_timeout_restart (void) +{ + idle_timeout_stop (); + idle_timeout_id = g_timeout_add (IDLE_TIMEOUT_MS, (GSourceFunc) on_idle_timeout, NULL); +} + +void +idle_timeout_inhibit (void) +{ + idle_timeout_stop (); + idle_timeout_inhibit_count++; +} + +void +idle_timeout_release (void) +{ + idle_timeout_inhibit_count--; + if (idle_timeout_inhibit_count == 0) + idle_timeout_restart (); +} + int main (int argc, char *argv[]) { @@ -286,6 +330,7 @@ main (int argc, char *argv[]) NULL, NULL); + idle_timeout_restart (); g_main_loop_run (loop); g_bus_unown_name (owner_id);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor