diff options
Diffstat (limited to 'mate-panel')
-rw-r--r-- | mate-panel/panel-background-monitor.c | 17 | ||||
-rw-r--r-- | mate-panel/panel-multiscreen.c | 14 |
2 files changed, 31 insertions, 0 deletions
diff --git a/mate-panel/panel-background-monitor.c b/mate-panel/panel-background-monitor.c index 2bd7fe15..a660ca1e 100644 --- a/mate-panel/panel-background-monitor.c +++ b/mate-panel/panel-background-monitor.c @@ -80,7 +80,11 @@ struct _PanelBackgroundMonitor { G_DEFINE_TYPE (PanelBackgroundMonitor, panel_background_monitor, G_TYPE_OBJECT) +#if GTK_CHECK_VERSION (3, 0, 0) +static PanelBackgroundMonitor *global_background_monitor = NULL; +#else static PanelBackgroundMonitor **global_background_monitors = NULL; +#endif static guint signals [LAST_SIGNAL] = { 0 }; @@ -198,6 +202,18 @@ panel_background_monitor_new (GdkScreen *screen) PanelBackgroundMonitor * panel_background_monitor_get_for_screen (GdkScreen *screen) { +#if GTK_CHECK_VERSION (3, 0, 0) + if (!global_background_monitor) { + global_background_monitor = panel_background_monitor_new (screen); + + g_object_add_weak_pointer (G_OBJECT (global_background_monitor), + (void **) &global_background_monitor); + + return global_background_monitor; + } + + return g_object_ref (global_background_monitor); +#else int screen_number; screen_number = gdk_screen_get_number (screen); @@ -222,6 +238,7 @@ panel_background_monitor_get_for_screen (GdkScreen *screen) } return g_object_ref (global_background_monitors [screen_number]); +#endif } static void diff --git a/mate-panel/panel-multiscreen.c b/mate-panel/panel-multiscreen.c index 7142b02a..10935b4e 100644 --- a/mate-panel/panel-multiscreen.c +++ b/mate-panel/panel-multiscreen.c @@ -417,7 +417,11 @@ panel_multiscreen_init (void) return; display = gdk_display_get_default (); +#if GTK_CHECK_VERSION (3, 0, 0) + screens = 1; +#else screens = gdk_display_get_n_screens (display); +#endif panel_multiscreen_init_randr (display); @@ -449,10 +453,15 @@ panel_multiscreen_init (void) void panel_multiscreen_reinit (void) { +#if GTK_CHECK_VERSION (3, 0, 0) + GdkScreen *screen; + GList *toplevels, *l; +#else GdkDisplay *display; GList *toplevels, *l; int new_screens; int i; +#endif if (monitors) g_free (monitors); @@ -465,6 +474,10 @@ panel_multiscreen_reinit (void) g_free (geometries); } +#if GTK_CHECK_VERSION (3, 0, 0) + screen = gdk_screen_get_default (); + g_signal_handlers_disconnect_by_func (screen, panel_multiscreen_queue_reinit, NULL); +#else display = gdk_display_get_default (); /* Don't use the screens variable since in the future, we might * want to call this function when a screen appears/disappears. */ @@ -478,6 +491,7 @@ panel_multiscreen_reinit (void) panel_multiscreen_queue_reinit, NULL); } +#endif initialized = FALSE; panel_multiscreen_init (); |