diff options
author | William Wold <[email protected]> | 2019-06-20 21:18:50 +0000 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-06-21 18:47:54 +0200 |
commit | ef54e9a53d5a24933a323afccd4689f2e9f2fe69 (patch) | |
tree | c4d7e0017d7901b0d0ff280915b452caadd3641e | |
parent | ff71e289397985e45b756c4fdb126186f0c1b951 (diff) | |
download | mate-panel-ef54e9a53d5a24933a323afccd4689f2e9f2fe69.tar.bz2 mate-panel-ef54e9a53d5a24933a323afccd4689f2e9f2fe69.tar.xz |
Reinit panel-multimonitor when a monitor is invalidated
-rw-r--r-- | mate-panel/panel-multimonitor.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mate-panel/panel-multimonitor.c b/mate-panel/panel-multimonitor.c index 35fcc493..67c1b53c 100644 --- a/mate-panel/panel-multimonitor.c +++ b/mate-panel/panel-multimonitor.c @@ -380,6 +380,16 @@ panel_multimonitor_handle_monitor_changed (GdkDisplay *display, reinit_id = g_idle_add (panel_multimonitor_reinit_idle, NULL); } +static void +panel_multimonitor_handle_monitor_invalidate (GdkMonitor *monitor, + gpointer user_data) +{ + if (reinit_id) + return; + + reinit_id = g_idle_add (panel_multimonitor_reinit_idle, NULL); +} + #ifdef HAVE_X11 #ifdef HAVE_RANDR static void @@ -416,6 +426,7 @@ void panel_multimonitor_init (void) { GdkDisplay *display; + int i; if (initialized) return; @@ -437,6 +448,14 @@ panel_multimonitor_init (void) G_CALLBACK (panel_multimonitor_handle_monitor_changed), NULL); g_signal_connect (display, "monitor-removed", G_CALLBACK (panel_multimonitor_handle_monitor_changed), NULL); + for (i = 0; i < gdk_display_get_n_monitors (display); i++) { + GdkMonitor *monitor; + + monitor = gdk_display_get_monitor (display, i); + g_signal_handlers_disconnect_by_func (display, panel_multimonitor_handle_monitor_invalidate, NULL); + g_signal_connect (monitor, "invalidate", + G_CALLBACK (panel_multimonitor_handle_monitor_invalidate), NULL); + } panel_multimonitor_get_raw_monitors (&monitor_count, &geometries); panel_multimonitor_compress_overlapping_monitors (&monitor_count, &geometries); |