diff options
author | ZenWalker <[email protected]> | 2017-08-11 16:52:57 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2017-08-12 22:16:28 -0400 |
commit | 42c8d2c3373c25d6e321be6950997c0d7ce44279 (patch) | |
tree | 9eb8112ce7dd51b0073ea7521770c372b26d1039 /eel/eel-editable-label.c | |
parent | 17b3c0ca924ffcd4bd06fded98227eba626d4f0b (diff) | |
download | caja-42c8d2c3373c25d6e321be6950997c0d7ce44279.tar.bz2 caja-42c8d2c3373c25d6e321be6950997c0d7ce44279.tar.xz |
avoid deprecated gdk_screen_width/height
Diffstat (limited to 'eel/eel-editable-label.c')
-rw-r--r-- | eel/eel-editable-label.c | 14 |
1 files changed, 11 insertions, 3 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 |