summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlistair Buxton <a.j.buxton@gmail.com>2018-11-18 00:05:01 +0000
committerSimon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>2018-12-02 23:59:12 +0100
commit3c2b62db2a795cc83b33c87e48f11e9db0ca2c63 (patch)
tree67a15d359d86c4651c15ee6a912e2a68a141caf3 /plugins
parentc7e53e8747c28ed0138abc953d67dc26c098dc76 (diff)
downloadxfce4-panel-3c2b62db2a795cc83b33c87e48f11e9db0ca2c63.tar.gz
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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/tasklist/tasklist-widget.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 845463d9..a79c9ff0 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,