diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 83060d1d2..22312d75f 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -31,6 +31,8 @@ #include #include +#include "clutter/egl/clutter-egl.h" +#include "clutter/evdev/clutter-evdev.h" #include "meta-barrier-native.h" #include "meta-idle-monitor-native.h" #include "meta-monitor-manager-kms.h" @@ -531,3 +533,36 @@ meta_activate_session (void) return TRUE; } + +void +meta_backend_native_pause (MetaBackendNative *native) +{ + clutter_evdev_release_devices (); + clutter_egl_freeze_master_clock (); +} + +void meta_backend_native_resume (MetaBackendNative *native) +{ + MetaBackend *backend = META_BACKEND (native); + MetaRenderer *renderer; + MetaCursorRenderer *cursor_renderer; + MetaCursorRendererNative *cursor_renderer_native; + ClutterActor *stage; + MetaIdleMonitor *idle_monitor; + + renderer = meta_backend_get_renderer (backend); + meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer)); + + clutter_evdev_reclaim_devices (); + clutter_egl_thaw_master_clock (); + + stage = meta_backend_get_stage (backend); + clutter_actor_queue_redraw (stage); + + cursor_renderer = meta_backend_get_cursor_renderer (backend); + cursor_renderer_native = META_CURSOR_RENDERER_NATIVE (cursor_renderer); + meta_cursor_renderer_native_force_update (cursor_renderer_native); + + idle_monitor = meta_backend_get_idle_monitor (backend, 0); + meta_idle_monitor_native_reset_idletime (idle_monitor); +} diff --git a/src/backends/native/meta-backend-native.h b/src/backends/native/meta-backend-native.h index 08e48d71e..3ba57a0cf 100644 --- a/src/backends/native/meta-backend-native.h +++ b/src/backends/native/meta-backend-native.h @@ -34,4 +34,8 @@ G_DECLARE_FINAL_TYPE (MetaBackendNative, meta_backend_native, gboolean meta_activate_vt (int vt, GError **error); +void meta_backend_native_pause (MetaBackendNative *backend_native); + +void meta_backend_native_resume (MetaBackendNative *backend_native); + #endif /* META_BACKEND_NATIVE_H */ diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index b93a17206..4a9a7276e 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -43,6 +42,7 @@ #include "meta-dbus-login1.h" #include "backends/meta-backend-private.h" +#include "backends/native/meta-backend-native.h" #include "meta-cursor-renderer-native.h" #include "meta-idle-monitor-native.h" #include "meta-renderer-native.h" @@ -110,42 +110,6 @@ get_seat_proxy (GCancellable *cancellable, return seat; } -static void -session_unpause (void) -{ - MetaBackend *backend; - MetaRenderer *renderer; - - backend = meta_get_backend (); - renderer = meta_backend_get_renderer (backend); - meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer)); - - clutter_evdev_reclaim_devices (); - clutter_egl_thaw_master_clock (); - - { - MetaBackend *backend = meta_get_backend (); - MetaCursorRendererNative *cursor_renderer_native = - META_CURSOR_RENDERER_NATIVE (meta_backend_get_cursor_renderer (backend)); - ClutterActor *stage = meta_backend_get_stage (backend); - - /* When we mode-switch back, we need to immediately queue a redraw - * in case nothing else queued one for us, and force the cursor to - * update. */ - - clutter_actor_queue_redraw (stage); - meta_cursor_renderer_native_force_update (cursor_renderer_native); - meta_idle_monitor_native_reset_idletime (meta_idle_monitor_get_core ()); - } -} - -static void -session_pause (void) -{ - clutter_evdev_release_devices (); - clutter_egl_freeze_master_clock (); -} - static gboolean take_device (Login1Session *session_proxy, int dev_major, @@ -281,6 +245,8 @@ out: static void sync_active (MetaLauncher *self) { + MetaBackend *backend = meta_get_backend (); + MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend); gboolean active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy)); if (active == self->session_active) @@ -289,9 +255,9 @@ sync_active (MetaLauncher *self) self->session_active = active; if (active) - session_unpause (); + meta_backend_native_resume (backend_native); else - session_pause (); + meta_backend_native_pause (backend_native); } static void