[mutter/wip/texture-purge-on-nvidia: 16/17] wip! backend: add signals for reporting suspend and resume



commit cfd5d83a985637dc6a8085f0af81a09990d7d03c
Author: Ray Strode <rstrode redhat com>
Date:   Thu Jan 10 10:47:19 2019 -0500

    wip! backend: add signals for reporting suspend and resume
    
    FIXME: need to add an inhibitor so we can actually delay suspend

 src/backends/meta-backend.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 888e51cd9..769c46f2f 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -59,7 +59,8 @@ enum
   KEYMAP_CHANGED,
   KEYMAP_LAYOUT_GROUP_CHANGED,
   LAST_DEVICE_CHANGED,
-
+  SUSPENDING,
+  RESUMING,
   N_SIGNALS
 };
 
@@ -544,6 +545,20 @@ meta_backend_class_init (MetaBackendClass *klass)
                   0,
                   NULL, NULL, NULL,
                   G_TYPE_NONE, 1, G_TYPE_INT);
+  signals[SUSPENDING] =
+    g_signal_new ("suspending",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 0);
+  signals[RESUMING] =
+    g_signal_new ("resuming",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 0);
 
   mutter_stage_views = g_getenv ("MUTTER_STAGE_VIEWS");
   stage_views_disabled = g_strcmp0 (mutter_stage_views, "0") == 0;
@@ -587,11 +602,17 @@ prepare_for_sleep_cb (GDBusConnection *connection,
                       GVariant        *parameters,
                       gpointer         user_data)
 {
+  MetaBackend *backend = user_data;
+
   gboolean suspending;
 
   g_variant_get (parameters, "(b)", &suspending);
-  if (suspending)
+  if (suspending) {
+    g_signal_emit (backend, signals[SUSPENDING], 0);
     return;
+  }
+
+  g_signal_emit (backend, signals[RESUMING], 0);
   meta_idle_monitor_reset_idletime (meta_idle_monitor_get_core ());
 }
 
@@ -618,7 +639,7 @@ system_bus_gotten_cb (GObject      *object,
                                         NULL,
                                         G_DBUS_SIGNAL_FLAGS_NONE,
                                         prepare_for_sleep_cb,
-                                        NULL,
+                                        user_data,
                                         NULL);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]