From 30bc86db0431805fa05161133ad28c3e20a15fc0 Mon Sep 17 00:00:00 2001 From: Jason Zaman Date: Mon, 16 Apr 2018 01:15:32 +0800 Subject: [PATCH] panel: port to GdkDisplay & GdkMonitor GdkScreen is deprecated since Gdk 3.22. Should use GdkDisplay or GdkMonitor instead. Also there is only ever one GdkScreen per GdkDisplay. Can have many GdkMonitors tho. Bug: https://bugzilla.xfce.org/show_bug.cgi?id=14155 Signed-off-by: Jason Zaman --- panel/panel-application.c | 2 +- panel/panel-base-window.c | 2 +- panel/panel-plugin-external-46.c | 4 +- panel/panel-plugin-external.c | 9 +- panel/panel-preferences-dialog.c | 52 ++------- panel/panel-window.c | 241 +++++++++++++++++---------------------- 6 files changed, 120 insertions(+), 190 deletions(-) diff --git a/panel/panel-application.c b/panel/panel-application.c index 21575343..df282474 100644 --- a/panel/panel-application.c +++ b/panel/panel-application.c @@ -393,7 +393,7 @@ panel_application_load_real (PanelApplication *application) && sscanf (output_name, "screen-%d", &screen_num) == 1) { if (screen_num < 1) - screen = gdk_display_get_screen (display, screen_num); + screen = gdk_display_get_default_screen (display); } g_free (output_name); diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c index c62cbf7d..850401eb 100644 --- a/panel/panel-base-window.c +++ b/panel/panel-base-window.c @@ -580,10 +580,10 @@ panel_base_window_active_timeout (gpointer user_data) static void panel_base_window_active_timeout_destroyed (gpointer user_data) { - PANEL_BASE_WINDOW (user_data)->priv->active_timeout_id = 0; PanelBaseWindow *window = PANEL_BASE_WINDOW (user_data); GtkStyleContext *context; + window->priv->active_timeout_id = 0; context = gtk_widget_get_style_context (GTK_WIDGET (window)); /* Stop the marching ants */ gtk_style_context_remove_class (context, "marching-ants"); diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c index 9ccf313b..faf7a079 100644 --- a/panel/panel-plugin-external-46.c +++ b/panel/panel-plugin-external-46.c @@ -257,7 +257,7 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external, GSList *li; XEvent event; PluginProperty *property; - GdkColor color = { 0, }; + GdkRGBA color; GdkWindow *window; panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL_46 (external)); @@ -296,7 +296,7 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external, break; case PROVIDER_PROP_TYPE_SET_BACKGROUND_COLOR: - if (gdk_color_parse (g_value_get_string (&property->value), &color)) + if (gdk_rgba_parse (&color, g_value_get_string (&property->value))) { event.xclient.data.s[1] = color.red; event.xclient.data.s[2] = color.green; diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c index 2936d2fc..49582063 100644 --- a/panel/panel-plugin-external.c +++ b/panel/panel-plugin-external.c @@ -496,14 +496,13 @@ static void panel_plugin_external_child_spawn_child_setup (gpointer data) { PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (data); - GdkScreen *screen; - gchar *name; + GdkDisplay *display; + const gchar *name; /* this is what gdk_spawn_on_screen does */ - screen = gtk_widget_get_screen (GTK_WIDGET (external)); - name = gdk_screen_make_display_name (screen); + display = gtk_widget_get_display (GTK_WIDGET (external)); + name = gdk_display_get_name (display); g_setenv ("DISPLAY", name, TRUE); - g_free (name); } diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c index 36324a16..04470fec 100644 --- a/panel/panel-preferences-dialog.c +++ b/panel/panel-preferences-dialog.c @@ -423,9 +423,9 @@ panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog, static void panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) { - GdkScreen *screen; GdkDisplay *display; - gint n_screens, n_monitors = 1; + GdkMonitor *monitor; + gint n_monitors = 1; GObject *object; GObject *store; gchar *output_name = NULL; @@ -463,15 +463,9 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) panel_preferences_dialog_bg_image_notified (dialog); - /* get run mode of the driver (multiple screens or randr) */ - screen = gtk_widget_get_screen (GTK_WIDGET (dialog->active)); + /* get run mode of the driver (multiple monitors or randr) */ display = gtk_widget_get_display (GTK_WIDGET (dialog->active)); - n_screens = 1; - n_monitors = 1; - if (G_LIKELY (n_screens <= 1)) - { - n_monitors = gdk_screen_get_n_monitors (screen); - } + n_monitors = gdk_display_get_n_monitors (display); /* update the output selector */ object = gtk_builder_get_object (GTK_BUILDER (dialog), "output-name"); @@ -485,9 +479,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) g_object_get (G_OBJECT (dialog->active), "output-name", &output_name, NULL); - if (n_screens > 1 - || n_monitors > 1 - || !panel_str_is_empty (output_name)) + if (n_monitors > 1 || !panel_str_is_empty (output_name)) { gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++, OUTPUT_NAME, "Automatic", @@ -509,42 +501,14 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) span_monitors_sensitive = TRUE; } - if (n_screens > 1) - { - for (i = 0; i < n_screens; i++) - { - /* warn the user about layouts we don't support */ - screen = gdk_display_get_screen (display, i); - if (gdk_screen_get_n_monitors (screen) > 1) - g_message ("Screen %d has multiple monitors, the panel does not " - "support such a configuration", i + 1); - - /* I18N: screen name in the output selector */ - title = g_strdup_printf (_("Screen %d"), i + 1); - name = g_strdup_printf ("screen-%d", i); - gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++, - OUTPUT_NAME, name, - OUTPUT_TITLE, title, -1); - - if (!output_selected && g_strcmp0 (name, output_name) == 0) - { - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); - output_selected = TRUE; - } - - g_free (name); - g_free (title); - } - } - else if (n_monitors >= 1) + if (n_monitors >= 1) { for (i = 0; i < n_monitors; i++) { - name = gdk_screen_get_monitor_plug_name (screen, i); + monitor = gdk_display_get_monitor(display, i); + name = g_strdup(gdk_monitor_get_model (monitor)); if (panel_str_is_empty (name)) { - g_free (name); - /* I18N: monitor name in the output selector */ title = g_strdup_printf (_("Monitor %d"), i + 1); name = g_strdup_printf ("monitor-%d", i); diff --git a/panel/panel-window.c b/panel/panel-window.c index 49caae73..e023d481 100644 --- a/panel/panel-window.c +++ b/panel/panel-window.c @@ -138,8 +138,7 @@ static void panel_window_size_allocate_set_xy (PanelWind gint *return_y); static void panel_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen); -static void panel_window_style_updated (GtkWidget *widget, - gpointer user_data); +static void panel_window_style_updated (GtkWidget *widget); static void panel_window_realize (GtkWidget *widget); static StrutsEgde panel_window_screen_struts_edge (PanelWindow *window); static void panel_window_screen_struts_set (PanelWindow *window); @@ -299,6 +298,7 @@ struct _PanelWindow /* screen and working area of this panel */ GdkScreen *screen; + GdkDisplay *display; GdkRectangle area; /* struts information */ @@ -512,6 +512,7 @@ panel_window_init (PanelWindow *window) window->id = -1; window->locked = TRUE; window->screen = NULL; + window->display = NULL; window->wnck_screen = NULL; window->wnck_active_window = NULL; window->struts_edge = STRUTS_EDGE_NONE; @@ -1045,9 +1046,9 @@ panel_window_button_press_event (GtkWidget *widget, GdkEventButton *event) { PanelWindow *window = PANEL_WINDOW (widget); + GdkSeat *seat; GdkCursor *cursor; GdkGrabStatus status; - GdkDisplay *display; guint modifiers; /* leave if the event is not for this window */ @@ -1064,15 +1065,14 @@ panel_window_button_press_event (GtkWidget *widget, panel_return_val_if_fail (window->grab_time == 0, FALSE); /* create a cursor */ - display = gdk_screen_get_display (window->screen); - cursor = gdk_cursor_new_for_display (display, GDK_FLEUR); + cursor = gdk_cursor_new_for_display (window->display, GDK_FLEUR); /* grab the pointer for dragging the window */ - status = gdk_device_grab (event->device, event->window, - GDK_OWNERSHIP_NONE, FALSE, - GDK_BUTTON_MOTION_MASK - | GDK_BUTTON_RELEASE_MASK, - cursor, event->time); + seat = gdk_device_get_seat (event->device); + + status = gdk_seat_grab (seat, event->window, + GDK_SEAT_CAPABILITY_ALL_POINTING, + FALSE, cursor, (GdkEvent*)event, NULL, NULL); g_object_unref (cursor); @@ -1114,7 +1114,7 @@ panel_window_button_release_event (GtkWidget *widget, if (window->grab_time != 0) { /* ungrab the pointer */ - gdk_device_ungrab (event->device, window->grab_time); + gdk_seat_ungrab (gdk_device_get_seat (event->device)); window->grab_time = 0; /* store the new position */ @@ -1540,24 +1540,17 @@ panel_window_screen_changed (GtkWidget *widget, /* set the new screen */ window->screen = screen; + window->display = gdk_screen_get_display (screen); g_signal_connect (G_OBJECT (window->screen), "monitors-changed", G_CALLBACK (panel_window_screen_layout_changed), window); g_signal_connect (G_OBJECT (window->screen), "size-changed", G_CALLBACK (panel_window_screen_layout_changed), window); - /* set new output name */ - if (gdk_display_get_n_screens (gdk_screen_get_display (screen)) > 1) - { - g_free (window->output_name); - window->output_name = g_strdup_printf ("screen-%d", gdk_screen_get_number (screen)); - g_object_notify (G_OBJECT (window), "output-name"); - } - /* update the screen layout */ panel_window_screen_layout_changed (screen, window); /* update wnck screen to be used for the autohide feature */ - wnck_screen = wnck_screen_get (gdk_screen_get_number (screen)); + wnck_screen = wnck_screen_get_default (); wnck_window = wnck_screen_get_active_window (wnck_screen); panel_window_update_autohide_window (window, wnck_screen, wnck_window); } @@ -1565,8 +1558,7 @@ panel_window_screen_changed (GtkWidget *widget, static void -panel_window_style_updated (GtkWidget *widget, - gpointer user_data) +panel_window_style_updated (GtkWidget *widget) { PanelWindow *window = PANEL_WINDOW (widget); PanelBaseWindow *base_window = PANEL_BASE_WINDOW (window); @@ -1653,48 +1645,56 @@ panel_window_screen_struts_set (PanelWindow *window) { gulong struts[N_STRUTS] = { 0, }; GdkRectangle *alloc = &window->alloc; + GdkMonitor *monitor; + GdkRectangle geometry; guint i; gboolean update_struts = FALSE; gint n; + gint scale_factor; const gchar *strut_border[] = { "left", "right", "top", "bottom" }; const gchar *strut_xy[] = { "y", "y", "x", "x" }; panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (cardinal_atom != 0 && net_wm_strut_partial_atom != 0); panel_return_if_fail (GDK_IS_SCREEN (window->screen)); + panel_return_if_fail (GDK_IS_DISPLAY (window->display)); if (!gtk_widget_get_realized (GTK_WIDGET (window))) return; + monitor = gdk_display_get_monitor_at_point (window->display, window->base_x, window->base_y); + scale_factor = gdk_monitor_get_scale_factor(monitor); + gdk_monitor_get_geometry(monitor, &geometry); + /* set the struts */ /* note that struts are relative to the screen edge! */ if (window->struts_edge == STRUTS_EDGE_TOP) { /* the window is snapped on the top screen edge */ - struts[STRUT_TOP] = alloc->y + alloc->height; - struts[STRUT_TOP_START_X] = alloc->x; - struts[STRUT_TOP_END_X] = alloc->x + alloc->width - 1; + struts[STRUT_TOP] = (alloc->y + alloc->height) * scale_factor; + struts[STRUT_TOP_START_X] = alloc->x * scale_factor; + struts[STRUT_TOP_END_X] = (alloc->x + alloc->width - 1) * scale_factor; } else if (window->struts_edge == STRUTS_EDGE_BOTTOM) { /* the window is snapped on the bottom screen edge */ - struts[STRUT_BOTTOM] = gdk_screen_get_height (window->screen) - alloc->y; - struts[STRUT_BOTTOM_START_X] = alloc->x; - struts[STRUT_BOTTOM_END_X] = alloc->x + alloc->width - 1; + struts[STRUT_BOTTOM] = (geometry.height - alloc->y) * scale_factor; + struts[STRUT_BOTTOM_START_X] = alloc->x * scale_factor; + struts[STRUT_BOTTOM_END_X] = (alloc->x + alloc->width - 1) * scale_factor; } else if (window->struts_edge == STRUTS_EDGE_LEFT) { /* the window is snapped on the left screen edge */ - struts[STRUT_LEFT] = alloc->x + alloc->width; - struts[STRUT_LEFT_START_Y] = alloc->y; - struts[STRUT_LEFT_END_Y] = alloc->y + alloc->height - 1; + struts[STRUT_LEFT] = (alloc->x + alloc->width) * scale_factor; + struts[STRUT_LEFT_START_Y] = alloc->y * scale_factor; + struts[STRUT_LEFT_END_Y] = (alloc->y + alloc->height - 1) * scale_factor; } else if (window->struts_edge == STRUTS_EDGE_RIGHT) { /* the window is snapped on the right screen edge */ - struts[STRUT_RIGHT] = gdk_screen_get_width (window->screen) - alloc->x; - struts[STRUT_RIGHT_START_Y] = alloc->y; - struts[STRUT_RIGHT_END_Y] = alloc->y + alloc->height - 1; + struts[STRUT_RIGHT] = (geometry.width - alloc->x) * scale_factor; + struts[STRUT_RIGHT_START_Y] = alloc->y * scale_factor; + struts[STRUT_RIGHT_END_Y] = (alloc->y + alloc->height - 1) * scale_factor; } /* store the new struts */ @@ -1895,11 +1895,13 @@ panel_window_display_layout_debug (GtkWidget *widget) { GdkDisplay *display; GdkScreen *screen; - gint n, n_screens; + GdkMonitor *monitor; gint m, n_monitors; + gint w, h; GdkRectangle rect; GString *str; - gchar *name; + const gchar *name; + gboolean composite = FALSE; panel_return_if_fail (GTK_IS_WIDGET (widget)); panel_return_if_fail (panel_debug_has_domain (PANEL_DEBUG_YES)); @@ -1907,50 +1909,51 @@ panel_window_display_layout_debug (GtkWidget *widget) str = g_string_new (NULL); display = gtk_widget_get_display (widget); + screen = gtk_widget_get_screen(widget); - n_screens = gdk_display_get_n_screens (display); - for (n = 0; n < n_screens; n++) - { - screen = gdk_display_get_screen (display, n); - g_string_append_printf (str, "screen-%d[%p]=[%d,%d]", n, screen, - gdk_screen_get_width (screen), gdk_screen_get_height (screen)); - - if (panel_debug_has_domain (PANEL_DEBUG_DISPLAY_LAYOUT)) - { - g_string_append_printf (str, "{comp=%s, sys=%p, rgba=%p}", - PANEL_DEBUG_BOOL (gdk_screen_is_composited (screen)), - gdk_screen_get_system_visual (screen), - gdk_screen_get_rgba_visual (screen)); - } +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + w = gdk_screen_get_width (screen); + h = gdk_screen_get_height (screen); +G_GNUC_END_IGNORE_DEPRECATIONS - str = g_string_append (str, " ("); + g_string_append_printf (str, "screen-0[%p]=[%d,%d]", screen, w, h); - n_monitors = gdk_screen_get_n_monitors (screen); - for (m = 0; m < n_monitors; m++) - { - name = gdk_screen_get_monitor_plug_name (screen, m); - if (name == NULL) - name = g_strdup_printf ("monitor-%d", m); + if (panel_debug_has_domain (PANEL_DEBUG_DISPLAY_LAYOUT)) + { + g_string_append_printf (str, "{comp=%s, sys=%p, rgba=%p}", + PANEL_DEBUG_BOOL (gdk_screen_is_composited (screen)), + gdk_screen_get_system_visual (screen), + gdk_screen_get_rgba_visual (screen)); + } - gdk_screen_get_monitor_geometry (screen, m, &rect); - g_string_append_printf (str, "%s=[%d,%d;%d,%d]", name, - rect.x, rect.y, rect.width, rect.height); + str = g_string_append (str, " ("); - g_free (name); + n_monitors = gdk_display_get_n_monitors (display); + for (m = 0; m < n_monitors; m++) + { + monitor = gdk_display_get_monitor (display, m); + name = gdk_monitor_get_model (monitor); + if (name == NULL) + name = g_strdup_printf ("monitor-%d", m); - if (m < n_monitors - 1) - g_string_append (str, ", "); - } + gdk_monitor_get_geometry (monitor, &rect); + g_string_append_printf (str, "%s=[%d,%d;%d,%d]", name, + rect.x, rect.y, rect.width, rect.height); - g_string_append (str, ")"); - if (n < n_screens - 1) + if (m < n_monitors - 1) g_string_append (str, ", "); } + g_string_append (str, ")"); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + composite = gdk_display_supports_composite (display); +G_GNUC_END_IGNORE_DEPRECATIONS + panel_debug (PANEL_DEBUG_DISPLAY_LAYOUT, "%p: display=%s{comp=%s}, %s", widget, gdk_display_get_name (display), - PANEL_DEBUG_BOOL (gdk_display_supports_composite (display)), + PANEL_DEBUG_BOOL (composite), str->str); g_string_free (str, TRUE); @@ -1966,12 +1969,10 @@ panel_window_screen_layout_changed (GdkScreen *screen, gint monitor_num, n_monitors, n; gint dest_x, dest_y; gint dest_w, dest_h; - gchar *name; + const gchar *name; StrutsEgde struts_edge; gboolean force_struts_update = FALSE; - gint screen_num; - GdkDisplay *display; - GdkScreen *new_screen; + GdkMonitor *monitor, *other_monitor; panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (GDK_IS_SCREEN (screen)); @@ -1993,7 +1994,7 @@ panel_window_screen_layout_changed (GdkScreen *screen, window->struts_edge = struts_edge; /* get the number of monitors */ - n_monitors = gdk_screen_get_n_monitors (screen); + n_monitors = gdk_display_get_n_monitors (window->display); panel_return_if_fail (n_monitors > 0); panel_debug (PANEL_DEBUG_POSITIONING, @@ -2006,18 +2007,17 @@ panel_window_screen_layout_changed (GdkScreen *screen, if (window->output_name == NULL && (window->span_monitors || n_monitors == 1)) { - get_screen_geometry: - /* get the screen geometry we also use this if there is only * one monitor and no output is choosen, as a fast-path */ - gdk_screen_get_monitor_geometry (screen, 0, &a); + monitor = gdk_display_get_monitor(window->display, 0); + gdk_monitor_get_geometry (monitor, &a); a.width += a.x; a.height += a.y; for (n = 1; n < n_monitors; n++) { - gdk_screen_get_monitor_geometry (screen, n, &b); + gdk_monitor_get_geometry (gdk_display_get_monitor(window->display, n), &b); a.x = MIN (a.x, b.x); a.y = MIN (a.y, b.y); @@ -2030,63 +2030,26 @@ panel_window_screen_layout_changed (GdkScreen *screen, panel_return_if_fail (a.width > 0 && a.height > 0); } - else if (window->output_name != NULL - && strncmp (window->output_name, "screen-", 7) == 0 - && sscanf (window->output_name, "screen-%d", &screen_num) == 1) - { - /* check if the panel is on the correct screen */ - if (gdk_screen_get_number (screen) != screen_num) - { - display = gdk_screen_get_display (screen); - if (gdk_display_get_n_screens (display) - 1 < screen_num) - { - panel_debug (PANEL_DEBUG_POSITIONING, - "%p: screen-%d not found, hiding panel", - window, screen_num); - - /* out of range, hide the window */ - if (gtk_widget_get_visible (GTK_WIDGET (window))) - gtk_widget_hide (GTK_WIDGET (window)); - return; - } - else - { - new_screen = gdk_display_get_screen (display, screen_num); - panel_debug (PANEL_DEBUG_POSITIONING, - "%p: moving window to screen %d[%p] to %d[%p]", - window, gdk_screen_get_number (screen), screen, - screen_num, new_screen); - - /* move window to the correct screen */ - gtk_window_set_screen (GTK_WINDOW (window), new_screen); - - /* we will invoke this function again when the screen - * changes, so bail out */ - return; - } - } - - /* screen is correct, get geometry and continue */ - goto get_screen_geometry; - } else { if (g_strcmp0 (window->output_name, "Automatic") == 0 || window->output_name == NULL) { /* get the monitor geometry based on the panel position */ - monitor_num = gdk_screen_get_monitor_at_point (screen, window->base_x, - window->base_y); - gdk_screen_get_monitor_geometry (screen, monitor_num, &a); + monitor = gdk_display_get_monitor_at_point (window->display, window->base_x, + window->base_y); + gdk_monitor_get_geometry (monitor, &a); panel_return_if_fail (a.width > 0 && a.height > 0); } else if (g_strcmp0 (window->output_name, "Primary") == 0) { normal_monitor_positioning: /* get the primary monitor */ - monitor_num = gdk_screen_get_primary_monitor (screen); + monitor = gdk_display_get_primary_monitor (window->display); + if (monitor == NULL) + monitor = gdk_display_get_monitor (window->display, 0); - gdk_screen_get_monitor_geometry (screen, monitor_num, &a); + gdk_monitor_get_geometry (monitor, &a); panel_return_if_fail (a.width > 0 && a.height > 0); } else @@ -2097,15 +2060,20 @@ panel_window_screen_layout_changed (GdkScreen *screen, && sscanf (window->output_name, "monitor-%d", &monitor_num) == 1) { /* check if extracted monitor number is out of range */ - if (n_monitors - 1 < monitor_num) - monitor_num = -1; + monitor = gdk_display_get_monitor(window->display, monitor_num); + if (monitor != NULL) + { + gdk_monitor_get_geometry (monitor, &a); + panel_return_if_fail (a.width > 0 && a.height > 0); + } } else { /* detect the monitor number by output name */ - for (n = 0, monitor_num = -1; n < n_monitors && monitor_num == -1; n++) + for (n = 0; n < n_monitors; n++) { - name = gdk_screen_get_monitor_plug_name (screen, n); + monitor = gdk_display_get_monitor(window->display, n); + name = gdk_monitor_get_model (monitor); /* check if this driver supports output names */ if (G_UNLIKELY (name == NULL)) @@ -2127,14 +2095,16 @@ panel_window_screen_layout_changed (GdkScreen *screen, } /* check if this is the monitor we're looking for */ - if (strcmp (window->output_name, name) == 0) - monitor_num = n; - - g_free (name); + if (strcasecmp (window->output_name, name) == 0) + { + gdk_monitor_get_geometry (monitor, &a); + panel_return_if_fail (a.width > 0 && a.height > 0); + break; + } } } - if (G_UNLIKELY (monitor_num == -1)) + if (G_UNLIKELY (a.height == 0 && a.width == 0)) { panel_debug (PANEL_DEBUG_POSITIONING, "%p: monitor %s not found, hiding window", @@ -2145,12 +2115,6 @@ panel_window_screen_layout_changed (GdkScreen *screen, gtk_widget_hide (GTK_WIDGET (window)); return; } - else - { - /* get the monitor geometry */ - gdk_screen_get_monitor_geometry (screen, monitor_num, &a); - panel_return_if_fail (a.width > 0 && a.height > 0); - } } /* check if another monitor is preventing the active monitor @@ -2162,12 +2126,15 @@ panel_window_screen_layout_changed (GdkScreen *screen, if (window->struts_edge == STRUTS_EDGE_NONE) break; + /* get other monitor */ + other_monitor = gdk_display_get_monitor (window->display, n); + /* skip the active monitor */ - if (monitor_num == n) + if (monitor == other_monitor) continue; /* get other monitor geometry */ - gdk_screen_get_monitor_geometry (screen, n, &b); + gdk_monitor_get_geometry (monitor, &b); /* check if this monitor prevents us from setting struts */ if ((window->struts_edge == STRUTS_EDGE_LEFT && b.x < a.x) -- 2.16.1