diff options
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-background.c | 17 | ||||
-rw-r--r-- | eel/eel-editable-label.c | 2 | ||||
-rw-r--r-- | eel/eel-gtk-extensions.c | 44 |
3 files changed, 31 insertions, 32 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c index ae585d6a..5b00f849 100644 --- a/eel/eel-background.c +++ b/eel/eel-background.c @@ -311,9 +311,20 @@ drawable_get_adjusted_size (EelBackground *self, if (self->details->is_desktop) { GdkScreen *screen = gtk_widget_get_screen (self->details->widget); - gint scale = gtk_widget_get_scale_factor (self->details->widget); - *width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; - *height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; + GdkDisplay *display = gdk_screen_get_display (screen); + if (GDK_IS_X11_DISPLAY (display)) + { + gint scale = gtk_widget_get_scale_factor (self->details->widget); + *width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; + *height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; + } + else { + GdkRectangle workarea = {0}; + gdk_monitor_get_workarea(gdk_display_get_monitor_at_window(gdk_display_get_default(), + gtk_widget_get_window (self->details->widget)), &workarea); + *width = workarea.width; + *height = workarea.height; + } } else { diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c index d18f5df9..92ce7015 100644 --- a/eel/eel-editable-label.c +++ b/eel/eel-editable-label.c @@ -1042,7 +1042,7 @@ eel_editable_label_ensure_layout (EelEditableLabel *label, scale = gtk_widget_get_scale_factor (widget); width = MIN (width, wrap_width); width = MIN (width, - PANGO_SCALE * (WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale + 1) / 2); + PANGO_SCALE * (gdk_screen_width () + 1) / 2); pango_layout_set_width (label->layout, width); pango_layout_get_extents (label->layout, NULL, &logical_rect); diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c index 2218b02b..21c3c358 100644 --- a/eel/eel-gtk-extensions.c +++ b/eel/eel-gtk-extensions.c @@ -80,22 +80,23 @@ eel_gtk_window_get_geometry_string (GtkWindow *window) static void sanity_check_window_position (int *left, int *top) { - GdkScreen *screen; - gint scale; - g_assert (left != NULL); g_assert (top != NULL); - - screen = gdk_screen_get_default (); - scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen)); + GdkDisplay *display; + GdkWindow *root_window; + GdkRectangle workarea = {0}; /* Make sure the top of the window is on screen, for * draggability (might not be necessary with all window managers, * but seems reasonable anyway). Make sure the top of the window * isn't off the bottom of the screen, or so close to the bottom * that it might be obscured by the panel. + * */ - *top = CLAMP (*top, 0, HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale - MINIMUM_ON_SCREEN_HEIGHT); + root_window = gdk_screen_get_root_window (gdk_screen_get_default()); + display = gdk_display_get_default (); + gdk_monitor_get_workarea(gdk_display_get_monitor_at_window (display, root_window), &workarea); + *top = CLAMP (*top, 0, workarea.height - MINIMUM_ON_SCREEN_HEIGHT); /* FIXME bugzilla.eazel.com 669: * If window has negative left coordinate, set_uposition sends it @@ -108,33 +109,23 @@ sanity_check_window_position (int *left, int *top) * the screen, or so close to the right edge that it might be * obscured by the panel. */ - *left = CLAMP (*left, 0, WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale - MINIMUM_ON_SCREEN_WIDTH); + *left = CLAMP (*left, 0, workarea.width - MINIMUM_ON_SCREEN_WIDTH); } static void sanity_check_window_dimensions (guint *width, guint *height) { - GdkScreen *screen; - int screen_width; - int screen_height; - int scale; - g_assert (width != NULL); g_assert (height != NULL); - screen = gdk_screen_get_default (); - scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen)); - screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; - screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; - /* Pin the size of the window to the screen, so we don't end up in * a state where the window is so big essential parts of it can't * be reached (might not be necessary with all window managers, * but seems reasonable anyway). */ - *width = MIN (*width, (guint) screen_width); - *height = MIN (*height, (guint) screen_height); -} + *width = MIN ((int)*width, gdk_screen_width()); + *height = MIN ((int)*height, gdk_screen_height()); + } /** * eel_gtk_window_set_initial_geometry: @@ -160,7 +151,9 @@ eel_gtk_window_set_initial_geometry (GtkWindow *window, guint width, guint height) { + GdkScreen *screen; int real_left, real_top; + int screen_width, screen_height; g_return_if_fail (GTK_IS_WINDOW (window)); @@ -172,17 +165,12 @@ eel_gtk_window_set_initial_geometry (GtkWindow *window, if ((geometry_flags & EEL_GDK_X_VALUE) && (geometry_flags & EEL_GDK_Y_VALUE)) { - GdkScreen *screen; - int screen_width, screen_height; - int scale; - real_left = left; real_top = top; screen = gtk_window_get_screen (window); - scale = gtk_widget_get_scale_factor (GTK_WIDGET (window)); - screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; - screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale; + screen_width = gdk_screen_get_width (screen); + screen_height = gdk_screen_get_height (screen); /* This is sub-optimal. GDK doesn't allow us to set win_gravity * to South/East types, which should be done if using negative |