summaryrefslogtreecommitdiff
path: root/eel/eel-editable-label.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-03-29 16:09:16 -0400
committerlukefromdc <[email protected]>2018-04-04 21:53:21 -0400
commitef78aa3fe9043d256f269b4aa25234e42b9eecae (patch)
tree53c4185c0857e159d610c92eca71eee9698177c4 /eel/eel-editable-label.c
parentcfd502157420406aa56a6b5319f0bd8dc90df8e4 (diff)
downloadcaja-ef78aa3fe9043d256f269b4aa25234e42b9eecae.tar.bz2
caja-ef78aa3fe9043d256f269b4aa25234e42b9eecae.tar.xz
Scale screen dimensions
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