From 2770e1769c332f5c85aa1ce3dcab6d14a22b52b3 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Sat, 29 Feb 2020 15:06:27 +0000 Subject: [PATCH] sizing: Ignore scaling factor for layout selection --- eek/eek-gtk-keyboard.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eek/eek-gtk-keyboard.c b/eek/eek-gtk-keyboard.c index ddcf09e1..4da4024a 100644 --- a/eek/eek-gtk-keyboard.c +++ b/eek/eek-gtk-keyboard.c @@ -103,9 +103,10 @@ eek_gtk_keyboard_real_draw (GtkWidget *self, return FALSE; } +// Units of pixel size static enum squeek_arrangement_kind get_type(uint32_t width, uint32_t height) { (void)height; - if (width < 540) { + if (width < 1080) { return ARRANGEMENT_KIND_BASE; } return ARRANGEMENT_KIND_WIDE; @@ -117,11 +118,11 @@ eek_gtk_keyboard_real_size_allocate (GtkWidget *self, { EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self)); - + uint32_t scale = (uint32_t)gtk_widget_get_scale_factor(self); // check if the change would switch types enum squeek_arrangement_kind new_type = get_type( - (uint32_t)(allocation->width - allocation->x), - (uint32_t)(allocation->height - allocation->y)); + (uint32_t)(allocation->width - allocation->x) * scale, + (uint32_t)(allocation->height - allocation->y) * scale); if (priv->layout->arrangement != new_type) { priv->layout->arrangement = new_type;