[Xfce4-commits] [apps/xfce4-screensaver] 17/17: Revert "fix password prompt flickering"

noreply at xfce.org noreply at xfce.org
Sat Mar 9 22:23:52 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit 6f0735883cfc32688b0cb48dd94e76092470f608
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Tue Mar 5 19:01:28 2019 -0500

    Revert "fix password prompt flickering"
    
    This reverts commit 03a8952fbb4eb468799e6a536d8f30c0db6e98a7.
---
 src/gs-manager.c    | 96 ++++++++++++++++++++++++++++++++---------------------
 src/gs-window-x11.c | 13 --------
 src/gs-window.h     |  2 --
 3 files changed, 59 insertions(+), 52 deletions(-)

diff --git a/src/gs-manager.c b/src/gs-manager.c
index 4e47320..338d4a3 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -76,6 +76,7 @@ struct GSManagerPrivate {
 
     guint           fading : 1;
     guint           dialog_up : 1;
+    gint            last_monitor_count;
 
     time_t          activate_time;
 
@@ -1420,8 +1421,8 @@ gs_manager_create_window_for_monitor (GSManager  *manager,
 
     gdk_monitor_get_geometry (monitor, &rect);
 
-    gs_debug ("Creating a Window [%d,%d] (%dx%d) for monitor %s",
-              rect.x, rect.y, rect.width, rect.height, gdk_monitor_get_model(monitor));
+    gs_debug ("Creating a window [%d,%d] (%dx%d)",
+              rect.x, rect.y, rect.width, rect.height);
 
     window = gs_window_new (monitor,
                             manager->priv->lock_enabled,
@@ -1478,39 +1479,46 @@ on_display_monitor_added (GdkDisplay *display,
                           GSManager  *manager) {
     GSList     *l;
     int         n_monitors;
-    gboolean    should_create = TRUE;
 
-    if (!gs_manager_is_real_monitor(monitor))
-        return;
+    g_return_if_fail (gs_manager_is_real_monitor(monitor));
 
     n_monitors = gs_manager_get_n_monitors (display);
 
-    gs_debug ("Monitor %s added on display %s, now there are %d",
-              gdk_monitor_get_model(monitor), gdk_display_get_name (display), n_monitors);
-
-    /* build password window for a new monitor if doesnt exist */
-    for (l = manager->priv->windows; l; l = l->next) {
-        GdkDisplay *this_display;
-        const gchar *this_monitor_model;
-
-        this_display = gs_window_get_display (GS_WINDOW (l->data));
-        this_monitor_model = gs_window_get_monitor_model (GS_WINDOW (l->data));
-        if (this_display == display && g_strcmp0 (this_monitor_model, gdk_monitor_get_model(monitor)) == 0) {
-            gint tmp;
-
-            gs_debug ("Found window for this Monitor");
-            gs_window_set_monitor (GS_WINDOW (l->data), monitor);
-            gtk_widget_get_preferred_width (l->data, &tmp, &tmp);
-            should_create = FALSE;
+    gs_debug ("Monitor added on display %s, now there are %d",
+              gdk_display_get_name (display), n_monitors);
+
+    if (manager->priv->last_monitor_count == 0) {
+        /* Tidy up from lid-close or other headless event once we have a new monitor.
+         * See https://gitlab.gnome.org/GNOME/gtk/issues/1466
+         */
+        l = manager->priv->windows;
+        while (l != NULL)
+        {
+            GSList *next = l->next;
+
+            manager_maybe_stop_job_for_window(manager,
+                                                GS_WINDOW(l->data));
+            g_hash_table_remove(manager->priv->jobs, l->data);
+            gs_window_disconnect_monitor(GS_WINDOW(l->data));
+            gs_window_destroy(GS_WINDOW(l->data));
+            manager->priv->windows = g_slist_delete_link(manager->priv->windows, l);
+            l = next;
         }
     }
 
-    if (should_create) {
-        gs_debug("Creating new window for Monitor %s", gdk_monitor_get_model (monitor));
-        gs_manager_create_window_for_monitor(manager, monitor);
+    manager->priv->last_monitor_count = n_monitors;
+
+    /* add a new window */
+    gs_manager_create_window_for_monitor (manager, monitor);
+
+    /* Tear down the unlock dialog in case we want to move it
+     * to the new monitor
+     */
+    l = manager->priv->windows;
+    while (l != NULL) {
+        gs_window_cancel_unlock_request (GS_WINDOW (l->data));
+        l = l->next;
     }
-    gs_manager_request_unlock(manager);
-    g_debug("added_done");
 }
 
 static void
@@ -1519,14 +1527,14 @@ on_display_monitor_removed (GdkDisplay *display,
                             GSManager  *manager) {
     GSList     *l;
     int         n_monitors;
+    GdkMonitor *last_monitor = NULL;
 
-    if (!gs_manager_is_real_monitor(monitor))
-        return;
+    g_return_if_fail (gs_manager_is_real_monitor(monitor));
 
-    n_monitors = gs_manager_get_n_monitors (display);
+    n_monitors = manager->priv->last_monitor_count = gs_manager_get_n_monitors (display);
 
-    gs_debug ("Monitor %p removed on display %s, now there are %d",
-              monitor, gdk_display_get_name (display), n_monitors);
+    gs_debug ("Monitor removed on display %s, now there are %d",
+              gdk_display_get_name (display), n_monitors);
 
     /* Tidy up from lid-close or other headless event once we have a new monitor.
      * See https://gitlab.gnome.org/GNOME/gtk/issues/1466
@@ -1536,24 +1544,37 @@ on_display_monitor_removed (GdkDisplay *display,
 
     gdk_x11_grab_server ();
 
-    /* destroy password window of a removed monitor */
-    for (l = manager->priv->windows; l; l = l->next) {
+    /* remove the now extra window */
+    l = manager->priv->windows;
+    while (l != NULL) {
         GdkDisplay *this_display;
-        const gchar *this_monitor_model;
+        GdkMonitor *this_monitor;
+        GSList     *next = l->next;
 
         this_display = gs_window_get_display (GS_WINDOW (l->data));
-        this_monitor_model = gs_window_get_monitor_model (GS_WINDOW (l->data));
-        if (this_display == display && g_strcmp0 (this_monitor_model, gdk_monitor_get_model(monitor)) == 0) {
+        this_monitor = gs_window_get_monitor (GS_WINDOW (l->data));
+        if (this_display == display && this_monitor == monitor) {
             manager_maybe_stop_job_for_window (manager,
                                                GS_WINDOW (l->data));
             g_hash_table_remove (manager->priv->jobs, l->data);
             gs_window_destroy (GS_WINDOW (l->data));
             manager->priv->windows = g_slist_delete_link (manager->priv->windows, l);
+        } else {
+            last_monitor = this_monitor;
+            gs_window_cancel_unlock_request (GS_WINDOW (l->data));
         }
+        l = next;
     }
 
     gdk_display_flush (display);
     gdk_x11_ungrab_server ();
+
+    /* add a new window */
+    if (last_monitor)
+        gs_manager_create_window_for_monitor(manager, last_monitor);
+
+    /* and put unlock dialog up whereever it's supposed to be */
+    gs_manager_request_unlock(manager);
 }
 
 static void
@@ -1680,6 +1701,7 @@ gs_manager_new (void) {
     manager = g_object_new (GS_TYPE_MANAGER, NULL);
 
     mgr = GS_MANAGER (manager);
+    mgr->priv->last_monitor_count = -1;
 
     return mgr;
 }
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index c33963f..e829b22 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -60,7 +60,6 @@ enum {
 
 struct GSWindowPrivate {
     GdkMonitor      *monitor;
-    gchar           *monitor_model;
 
     GdkRectangle     geometry;
     guint            obscured : 1;
@@ -1636,7 +1635,6 @@ gs_window_request_unlock (GSWindow *window) {
         return;
     }
 
-    gs_debug ("Requesting unlock for display %s", window->priv->monitor_model);
     if (window->priv->popup_dialog_idle_id == 0) {
         add_popup_dialog_idle (window);
     }
@@ -1799,7 +1797,6 @@ gs_window_set_monitor (GSWindow   *window,
     }
 
     window->priv->monitor = monitor;
-    window->priv->monitor_model = g_strdup(gdk_monitor_get_model(monitor));
 
     gtk_widget_queue_resize (GTK_WIDGET (window));
     gtk_widget_get_preferred_width (GTK_WIDGET (window), &tmp, &tmp);
@@ -1814,14 +1811,6 @@ gs_window_get_monitor (GSWindow *window) {
     return window->priv->monitor;
 }
 
-const gchar *
-gs_window_get_monitor_model (GSWindow *window) {
-    g_return_val_if_fail (GS_IS_WINDOW (window), NULL);
-
-    return window->priv->monitor_model;
-}
-
-
 static void
 gs_window_set_property (GObject      *object,
                         guint         prop_id,
@@ -2376,7 +2365,6 @@ gs_window_finalize (GObject *object) {
 
     g_free (window->priv->logout_command);
     g_free (window->priv->keyboard_command);
-    g_free (window->priv->monitor_model);
 
     if (window->priv->info_bar_timer_id > 0) {
         g_source_remove (window->priv->info_bar_timer_id);
@@ -2411,7 +2399,6 @@ gs_window_new (GdkMonitor *monitor,
     GdkDisplay *display = gdk_monitor_get_display (monitor);
     GdkScreen  *screen = gdk_display_get_default_screen (display);
 
-    gs_debug ("Creating new GSWindow for %s", gdk_monitor_get_model(monitor));
     result = g_object_new (GS_TYPE_WINDOW,
                            "type", GTK_WINDOW_POPUP,
                            "screen", screen,
diff --git a/src/gs-window.h b/src/gs-window.h
index 66de41e..77e2a37 100644
--- a/src/gs-window.h
+++ b/src/gs-window.h
@@ -64,8 +64,6 @@ GdkDisplay *gs_window_get_display             (GSWindow        *window);
 void        gs_window_set_monitor             (GSWindow        *window,
                                                GdkMonitor      *monitor);
 GdkMonitor *gs_window_get_monitor             (GSWindow        *window);
-const
-gchar      *gs_window_get_monitor_model       (GSWindow *window);
 
 void        gs_window_set_background_surface  (GSWindow        *window,
                                                cairo_surface_t *surface);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list