summaryrefslogtreecommitdiff
path: root/eel/eel-editable-label.c
diff options
context:
space:
mode:
Diffstat (limited to 'eel/eel-editable-label.c')
-rw-r--r--eel/eel-editable-label.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index fb1fb29b..8b98a273 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -36,6 +36,7 @@
#include <pango/pango.h>
#include <gtk/gtk.h>
#include <gtk/gtk-a11y.h>
+#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
@@ -1051,7 +1052,6 @@ 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);
@@ -1061,13 +1061,10 @@ 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 * (sc_width + 1) / 2);
+ PANGO_SCALE * (WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) + 1) / 2);
pango_layout_set_width (label->layout, width);
pango_layout_get_extents (label->layout, NULL, &logical_rect);
@@ -3051,7 +3048,6 @@ 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);
@@ -3066,11 +3062,8 @@ popup_position_func (GtkMenu *menu,
*x += allocation.width / 2;
*y += allocation.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));
+ *x = CLAMP (*x, 0, MAX (0, WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - req.width));
+ *y = CLAMP (*y, 0, MAX (0, HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - req.height));
}
static void