[Xfce4-commits] [xfce/xfce4-panel] 02/04: tasklist: Don't listen for monitor changes in the plugin

noreply at xfce.org noreply at xfce.org
Sun Dec 2 23:59:38 CET 2018


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

o   c   h   o   s   i       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 xfce/xfce4-panel.

commit 3c2b62db2a795cc83b33c87e48f11e9db0ca2c63
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Sun Nov 18 00:05:01 2018 +0000

    tasklist: Don't listen for monitor changes in the plugin
    
    Previously both the panel and the plugin listened for monitor changes.
    This lead to a race condition since there was no control over which
    would receive the event first. When the panel receives the event it
    may move itself to another monitor. If the plugin receives the event
    it will update itself before the move, and then its contents will be
    wrong after the move.
    
    The fix makes the plugin listen to configure events from the panel
    instead of monitor events from Gdk. These are only sent after the
    panel has finished processing the move event. They are sent in some
    other situations too, so this is slightly in-efficient, but it is
    probably not worth worrying about.
    
    Fixes bug #10725
---
 plugins/tasklist/tasklist-widget.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 845463d..a79c9ff 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -293,6 +293,9 @@ static void               xfce_tasklist_connect_screen                   (XfceTa
 static void               xfce_tasklist_disconnect_screen                (XfceTasklist         *tasklist);
 static void               xfce_tasklist_gdk_screen_changed               (GdkScreen            *gdk_screen,
                                                                           XfceTasklist         *tasklist);
+static gboolean           xfce_tasklist_configure_event                  (GtkWidget            *widget,
+                                                                          GdkEvent             *event,
+                                                                          XfceTasklist         *tasklist);
 static void               xfce_tasklist_active_window_changed            (WnckScreen           *screen,
                                                                           WnckWindow           *previous_window,
                                                                           XfceTasklist         *tasklist);
@@ -1539,11 +1542,10 @@ xfce_tasklist_connect_screen (XfceTasklist *tasklist)
   for (li = windows; li != NULL; li = li->next)
     xfce_tasklist_window_added (tasklist->screen, li->data, tasklist);
 
-  /* monitor gdk changes */
-  g_signal_connect (G_OBJECT (tasklist->gdk_screen), "monitors-changed",
-      G_CALLBACK (xfce_tasklist_gdk_screen_changed), tasklist);
-  g_signal_connect (G_OBJECT (tasklist->gdk_screen), "size-changed",
-      G_CALLBACK (xfce_tasklist_gdk_screen_changed), tasklist);
+  /* monitor window movement */
+  g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET (tasklist))),
+                    "configure-event",
+                    G_CALLBACK (xfce_tasklist_configure_event), tasklist);
 
   /* monitor screen changes */
   g_signal_connect (G_OBJECT (tasklist->screen), "active-window-changed",
@@ -1633,6 +1635,23 @@ xfce_tasklist_gdk_screen_changed (GdkScreen    *gdk_screen,
 
 
 
+static gboolean
+xfce_tasklist_configure_event (GtkWidget    *widget,
+                               GdkEvent     *event,
+                               XfceTasklist *tasklist)
+{
+  panel_return_if_fail (XFCE_IS_TASKLIST (tasklist));
+
+  if (!tasklist->all_monitors)
+    {
+      /* update the monitor geometry */
+      xfce_tasklist_update_monitor_geometry (tasklist);
+    }
+  return FALSE;
+}
+
+
+
 static void
 xfce_tasklist_active_window_changed (WnckScreen   *screen,
                                      WnckWindow   *previous_window,

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


More information about the Xfce4-commits mailing list