diff options
-rw-r--r-- | eel/eel-editable-label.c | 14 | ||||
-rw-r--r-- | eel/eel-gtk-extensions.c | 18 | ||||
-rw-r--r-- | libcaja-private/caja-icon-container.c | 9 |
3 files changed, 32 insertions, 9 deletions
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c index ee1e792a..fb1fb29b 100644 --- a/eel/eel-editable-label.c +++ b/eel/eel-editable-label.c @@ -1051,6 +1051,7 @@ eel_editable_label_ensure_layout (EelEditableLabel *label, else { gint wrap_width; + gint sc_width; pango_layout_set_width (label->layout, -1); pango_layout_get_extents (label->layout, NULL, &logical_rect); @@ -1060,10 +1061,13 @@ eel_editable_label_ensure_layout (EelEditableLabel *label, /* Try to guess a reasonable maximum width */ longest_paragraph = width; + gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), + NULL, NULL, &sc_width, NULL); + wrap_width = get_label_wrap_width (label); width = MIN (width, wrap_width); width = MIN (width, - PANGO_SCALE * (gdk_screen_width () + 1) / 2); + PANGO_SCALE * (sc_width + 1) / 2); pango_layout_set_width (label->layout, width); pango_layout_get_extents (label->layout, NULL, &logical_rect); @@ -3047,6 +3051,7 @@ popup_position_func (GtkMenu *menu, GtkWidget *widget; GtkRequisition req; GtkAllocation allocation; + gint sc_width, sc_height; label = EEL_EDITABLE_LABEL (user_data); widget = GTK_WIDGET (label); @@ -3061,8 +3066,11 @@ popup_position_func (GtkMenu *menu, *x += allocation.width / 2; *y += allocation.height; - *x = CLAMP (*x, 0, MAX (0, gdk_screen_width () - req.width)); - *y = CLAMP (*y, 0, MAX (0, gdk_screen_height () - req.height)); + gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), + NULL, NULL, &sc_width, &sc_height); + + *x = CLAMP (*x, 0, MAX (0, sc_width - req.width)); + *y = CLAMP (*y, 0, MAX (0, sc_height - req.height)); } static void diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c index b9d870c5..e388636a 100644 --- a/eel/eel-gtk-extensions.c +++ b/eel/eel-gtk-extensions.c @@ -86,6 +86,11 @@ eel_gtk_window_get_geometry_string (GtkWindow *window) static void sanity_check_window_position (int *left, int *top) { + gint sc_width, sc_height; + + gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), + NULL, NULL, &sc_width, &sc_height); + g_assert (left != NULL); g_assert (top != NULL); @@ -95,7 +100,7 @@ sanity_check_window_position (int *left, int *top) * 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, gdk_screen_height() - MINIMUM_ON_SCREEN_HEIGHT); + *top = CLAMP (*top, 0, sc_height - MINIMUM_ON_SCREEN_HEIGHT); /* FIXME bugzilla.eazel.com 669: * If window has negative left coordinate, set_uposition sends it @@ -108,12 +113,17 @@ 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, gdk_screen_width() - MINIMUM_ON_SCREEN_WIDTH); + *left = CLAMP (*left, 0, sc_width - MINIMUM_ON_SCREEN_WIDTH); } static void sanity_check_window_dimensions (guint *width, guint *height) { + gint sc_width, sc_height; + + gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), + NULL, NULL, &sc_width, &sc_height); + g_assert (width != NULL); g_assert (height != NULL); @@ -122,8 +132,8 @@ sanity_check_window_dimensions (guint *width, guint *height) * be reached (might not be necessary with all window managers, * but seems reasonable anyway). */ - *width = MIN (*width, gdk_screen_width()); - *height = MIN (*height, gdk_screen_height()); + *width = MIN (*width, sc_width); + *height = MIN (*height, sc_height); } /** diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index c37a0d1a..aaff045c 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -326,6 +326,7 @@ icon_set_position (CajaIcon *icon, int item_width, item_height; int height_above, width_left; int min_x, max_x, min_y, max_y; + int sc_width, sc_height; if (icon->x == x && icon->y == y) { @@ -354,12 +355,16 @@ icon_set_position (CajaIcon *icon, For now, we have a cheesy workaround: */ + + gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), + NULL, NULL, &sc_width, &sc_height); + container_x = 0; container_y = 0; - container_width = gdk_screen_width () - container_x + container_width = sc_width - container_x - container->details->left_margin - container->details->right_margin; - container_height = gdk_screen_height () - container_y + container_height = sc_height - container_y - container->details->top_margin - container->details->bottom_margin; pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit; |