From b5ea81b0356884dca6d362d61df4f68e9e84e0b3 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 15 Jan 2019 10:29:55 -0500 Subject: [PATCH 7/9] backends/native: update cursor on resume As mentioned in a previous commit, the proprietary NVIDIA driver garbles memory on suspend. That behavior, means that the cursor gets corrupted on suspend. This commit forces the cursor to redraw itself when the logind session becomes active (on VT switch and resume). --- src/backends/native/meta-backend-native.c | 1 + src/core/screen-private.h | 2 -- src/meta/screen.h | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 0730a4acb..fd95dfc11 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -628,44 +628,45 @@ meta_backend_native_pause (MetaBackendNative *native) { MetaBackend *backend = META_BACKEND (native); MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); MetaMonitorManagerKms *monitor_manager_kms = META_MONITOR_MANAGER_KMS (monitor_manager); clutter_evdev_release_devices (); clutter_egl_freeze_master_clock (); meta_monitor_manager_kms_pause (monitor_manager_kms); } void meta_backend_native_resume (MetaBackendNative *native) { MetaBackend *backend = META_BACKEND (native); MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); MetaMonitorManagerKms *monitor_manager_kms = META_MONITOR_MANAGER_KMS (monitor_manager); MetaDisplay *display = meta_get_display (); ClutterBackend *clutter_backend = clutter_get_default_backend (); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); ClutterActor *stage; MetaIdleMonitor *idle_monitor; if (cogl_has_feature (cogl_context, COGL_FEATURE_ID_UNSTABLE_TEXTURES)) { clutter_clear_glyph_cache (); + meta_screen_update_cursor (display->screen); g_signal_emit_by_name (display, "gl-video-memory-purged"); } meta_monitor_manager_kms_resume (monitor_manager_kms); clutter_evdev_reclaim_devices (); clutter_egl_thaw_master_clock (); stage = meta_backend_get_stage (backend); clutter_actor_queue_redraw (stage); idle_monitor = meta_backend_get_idle_monitor (backend, 0); meta_idle_monitor_reset_idletime (idle_monitor); } diff --git a/src/core/screen-private.h b/src/core/screen-private.h index ff796f01a..37f2a01a1 100644 --- a/src/core/screen-private.h +++ b/src/core/screen-private.h @@ -95,62 +95,60 @@ struct _MetaScreen int closing; /* Instead of unmapping withdrawn windows we can leave them mapped * and restack them below a guard window. When using a compositor * this allows us to provide live previews of unmapped windows */ Window guard_window; Window composite_overlay_window; }; struct _MetaScreenClass { GObjectClass parent_class; void (*restacked) (MetaScreen *); void (*workareas_changed) (MetaScreen *); void (*monitors_changed) (MetaScreen *); }; MetaScreen* meta_screen_new (MetaDisplay *display, guint32 timestamp); void meta_screen_free (MetaScreen *screen, guint32 timestamp); void meta_screen_init_workspaces (MetaScreen *screen); void meta_screen_manage_all_windows (MetaScreen *screen); void meta_screen_foreach_window (MetaScreen *screen, MetaListWindowsFlags flags, MetaScreenWindowFunc func, gpointer data); -void meta_screen_update_cursor (MetaScreen *screen); - void meta_screen_update_tile_preview (MetaScreen *screen, gboolean delay); void meta_screen_hide_tile_preview (MetaScreen *screen); MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen, MetaWindow *not_this_one); void meta_screen_update_workspace_layout (MetaScreen *screen); void meta_screen_update_workspace_names (MetaScreen *screen); void meta_screen_queue_workarea_recalc (MetaScreen *screen); void meta_screen_queue_check_fullscreen (MetaScreen *screen); Window meta_create_offscreen_window (Display *xdisplay, Window parent, long valuemask); typedef struct MetaWorkspaceLayout MetaWorkspaceLayout; struct MetaWorkspaceLayout { int rows; int cols; int *grid; int grid_area; int current_row; int current_col; }; void meta_screen_calc_workspace_layout (MetaScreen *screen, diff --git a/src/meta/screen.h b/src/meta/screen.h index 13c92516e..36c397418 100644 --- a/src/meta/screen.h +++ b/src/meta/screen.h @@ -98,31 +98,34 @@ int meta_screen_get_monitor_neighbor_index (MetaScreen *screen, int which_monitor, MetaScreenDirection dir); void meta_screen_focus_default_window (MetaScreen *screen, guint32 timestamp); /** * MetaScreenCorner: * @META_SCREEN_TOPLEFT: top-left corner * @META_SCREEN_TOPRIGHT: top-right corner * @META_SCREEN_BOTTOMLEFT: bottom-left corner * @META_SCREEN_BOTTOMRIGHT: bottom-right corner */ typedef enum { META_SCREEN_TOPLEFT, META_SCREEN_TOPRIGHT, META_SCREEN_BOTTOMLEFT, META_SCREEN_BOTTOMRIGHT } MetaScreenCorner; void meta_screen_override_workspace_layout (MetaScreen *screen, MetaScreenCorner starting_corner, gboolean vertical_layout, int n_rows, int n_columns); void meta_screen_set_cursor (MetaScreen *screen, MetaCursor cursor); +void meta_screen_update_cursor (MetaScreen *screen); + + #endif -- 2.18.1