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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index 8fcda95f..da43cb0e 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -1049,6 +1049,7 @@ eel_editable_label_ensure_layout (EelEditableLabel *label,
else
{
gint wrap_width;
+ gint scale;
pango_layout_set_width (label->layout, -1);
pango_layout_get_extents (label->layout, NULL, &logical_rect);
@@ -1059,9 +1060,10 @@ eel_editable_label_ensure_layout (EelEditableLabel *label,
longest_paragraph = width;
wrap_width = get_label_wrap_width (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 ())) + 1) / 2);
+ PANGO_SCALE * (WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale + 1) / 2);
pango_layout_set_width (label->layout, width);
pango_layout_get_extents (label->layout, NULL, &logical_rect);
@@ -3046,6 +3048,7 @@ popup_position_func (GtkMenu *menu,
GtkWidget *widget;
GtkRequisition req;
GtkAllocation allocation;
+ gint scale;
label = EEL_EDITABLE_LABEL (user_data);
widget = GTK_WIDGET (label);
@@ -3056,12 +3059,13 @@ popup_position_func (GtkMenu *menu,
gtk_widget_get_preferred_size (widget, &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
+ scale = gtk_widget_get_scale_factor (widget);
*x += allocation.width / 2;
*y += allocation.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));
+ *x = CLAMP (*x, 0, MAX (0, WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - req.width));
+ *y = CLAMP (*y, 0, MAX (0, HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - req.height));
}
static void