mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18:40:40 -05:00
backends/native: explicitly pause on suspend
The kernel forces a VT switch during suspend on some hardware, and not on others. We run code from the VT switch handler that we need to also get run on resume. This commit makes sure we explicitly run the VT switch handler during suspend and resume.
This commit is contained in:
parent
5f1325ed0a
commit
bac2a0752b
@ -60,6 +60,8 @@ struct _MetaBackendNativePrivate
|
||||
{
|
||||
MetaLauncher *launcher;
|
||||
MetaBarrierManagerNative *barrier_manager;
|
||||
|
||||
gboolean is_paused;
|
||||
};
|
||||
typedef struct _MetaBackendNativePrivate MetaBackendNativePrivate;
|
||||
|
||||
@ -332,6 +334,15 @@ meta_backend_native_post_init (MetaBackend *backend)
|
||||
NULL, NULL);
|
||||
clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter,
|
||||
meta_backend_get_monitor_manager (backend));
|
||||
|
||||
g_signal_connect (G_OBJECT (backend),
|
||||
"suspending",
|
||||
G_CALLBACK (meta_backend_native_pause),
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (backend),
|
||||
"resuming",
|
||||
G_CALLBACK (meta_backend_native_resume),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static MetaMonitorManager *
|
||||
@ -631,11 +642,18 @@ meta_backend_native_pause (MetaBackendNative *native)
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitorManagerKms *monitor_manager_kms =
|
||||
META_MONITOR_MANAGER_KMS (monitor_manager);
|
||||
MetaBackendNativePrivate *priv =
|
||||
meta_backend_native_get_instance_private (native);
|
||||
|
||||
if (priv->is_paused)
|
||||
return;
|
||||
|
||||
clutter_evdev_release_devices ();
|
||||
clutter_egl_freeze_master_clock ();
|
||||
|
||||
meta_monitor_manager_kms_pause (monitor_manager_kms);
|
||||
|
||||
priv->is_paused = TRUE;
|
||||
}
|
||||
|
||||
void meta_backend_native_resume (MetaBackendNative *native)
|
||||
@ -645,6 +663,8 @@ void meta_backend_native_resume (MetaBackendNative *native)
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitorManagerKms *monitor_manager_kms =
|
||||
META_MONITOR_MANAGER_KMS (monitor_manager);
|
||||
MetaBackendNativePrivate *priv =
|
||||
meta_backend_native_get_instance_private (native);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
CoglContext *cogl_context =
|
||||
@ -652,6 +672,9 @@ void meta_backend_native_resume (MetaBackendNative *native)
|
||||
ClutterActor *stage;
|
||||
MetaIdleMonitor *idle_monitor;
|
||||
|
||||
if (!priv->is_paused)
|
||||
return;
|
||||
|
||||
if (cogl_has_feature (cogl_context, COGL_FEATURE_ID_UNSTABLE_TEXTURES))
|
||||
{
|
||||
clutter_clear_glyph_cache ();
|
||||
@ -669,4 +692,6 @@ void meta_backend_native_resume (MetaBackendNative *native)
|
||||
|
||||
idle_monitor = meta_backend_get_idle_monitor (backend, 0);
|
||||
meta_idle_monitor_reset_idletime (idle_monitor);
|
||||
|
||||
priv->is_paused = FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user