[mutter/wip/login1: 4/7] meta-weston-launch: Remove the "VT-switched lock"



commit 1436017344547573a202700611386d7565ac2d8e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Mar 11 17:33:14 2014 -0400

    meta-weston-launch: Remove the "VT-switched lock"
    
    We'll replace it by pausing the Clutter master clock.

 src/wayland/meta-weston-launch.c |   45 ++++++-------------------------------
 1 files changed, 8 insertions(+), 37 deletions(-)
---
diff --git a/src/wayland/meta-weston-launch.c b/src/wayland/meta-weston-launch.c
index 563af20..3cc6972 100644
--- a/src/wayland/meta-weston-launch.c
+++ b/src/wayland/meta-weston-launch.c
@@ -49,14 +49,9 @@
 struct _MetaLauncher
 {
   GSocket *weston_launch;
+  GSource *weston_launch_source;
 
   gboolean vt_switched;
-
-  GMainContext *nested_context;
-  GMainLoop *nested_loop;
-
-  GSource *inner_source;
-  GSource *outer_source;
 };
 
 static void handle_request_vt_switch (MetaLauncher *self);
@@ -251,8 +246,9 @@ static void
 handle_vt_enter (MetaLauncher *launcher)
 {
   g_assert (launcher->vt_switched);
+  launcher->vt_switched = FALSE;
 
-  g_main_loop_quit (launcher->nested_loop);
+  meta_launcher_enter (launcher);
 }
 
 static void
@@ -271,22 +267,11 @@ handle_request_vt_switch (MetaLauncher *launcher)
   if (!ok) {
     g_warning ("Failed to acknowledge VT switch: %s", error->message);
     g_error_free (error);
-
     return;
   }
 
   g_assert (!launcher->vt_switched);
   launcher->vt_switched = TRUE;
-
-  /* We can't do anything at this point, because we don't
-     have input devices and we don't have the DRM master,
-     so let's run a nested busy loop until the VT is reentered */
-  g_main_loop_run (launcher->nested_loop);
-
-  g_assert (launcher->vt_switched);
-  launcher->vt_switched = FALSE;
-
-  meta_launcher_enter (launcher);
 }
 
 static gboolean
@@ -350,18 +335,10 @@ meta_launcher_new (void)
 
   self->weston_launch = g_socket_new_from_fd (launch_fd, NULL);
 
-  self->nested_context = g_main_context_new ();
-  self->nested_loop = g_main_loop_new (self->nested_context, FALSE);
-
-  self->outer_source = g_socket_create_source (self->weston_launch, G_IO_IN, NULL);
-  g_source_set_callback (self->outer_source, (GSourceFunc)on_socket_readable, self, NULL);
-  g_source_attach (self->outer_source, NULL);
-  g_source_unref (self->outer_source);
-
-  self->inner_source = g_socket_create_source (self->weston_launch, G_IO_IN, NULL);
-  g_source_set_callback (self->inner_source, (GSourceFunc)on_socket_readable, self, NULL);
-  g_source_attach (self->inner_source, self->nested_context);
-  g_source_unref (self->inner_source);
+  self->weston_launch_source = g_socket_create_source (self->weston_launch, G_IO_IN, NULL);
+  g_source_set_callback (self->weston_launch_source, (GSourceFunc)on_socket_readable, self, NULL);
+  g_source_attach (self->weston_launch_source, NULL);
+  g_source_unref (self->weston_launch_source);
 
   clutter_evdev_set_open_callback (on_evdev_device_open,
                                    on_evdev_device_close,
@@ -385,14 +362,8 @@ meta_launcher_new (void)
 void
 meta_launcher_free (MetaLauncher *launcher)
 {
-  g_source_destroy (launcher->outer_source);
-  g_source_destroy (launcher->inner_source);
-
-  g_main_loop_unref (launcher->nested_loop);
-  g_main_context_unref (launcher->nested_context);
-
+  g_source_destroy (launcher->weston_launch_source);
   g_object_unref (launcher->weston_launch);
-
   g_slice_free (MetaLauncher, launcher);
 }
 


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