sizing: Ignore scaling factor for layout selection

This commit is contained in:
Dorota Czaplejewicz
2020-02-29 15:06:27 +00:00
parent 3cd170acc3
commit 2770e1769c

View File

@ -103,9 +103,10 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
return FALSE; return FALSE;
} }
// Units of pixel size
static enum squeek_arrangement_kind get_type(uint32_t width, uint32_t height) { static enum squeek_arrangement_kind get_type(uint32_t width, uint32_t height) {
(void)height; (void)height;
if (width < 540) { if (width < 1080) {
return ARRANGEMENT_KIND_BASE; return ARRANGEMENT_KIND_BASE;
} }
return ARRANGEMENT_KIND_WIDE; return ARRANGEMENT_KIND_WIDE;
@ -117,11 +118,11 @@ eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
{ {
EekGtkKeyboardPrivate *priv = EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self)); 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 // check if the change would switch types
enum squeek_arrangement_kind new_type = get_type( enum squeek_arrangement_kind new_type = get_type(
(uint32_t)(allocation->width - allocation->x), (uint32_t)(allocation->width - allocation->x) * scale,
(uint32_t)(allocation->height - allocation->y)); (uint32_t)(allocation->height - allocation->y) * scale);
if (priv->layout->arrangement != new_type) { if (priv->layout->arrangement != new_type) {
priv->layout->arrangement = new_type; priv->layout->arrangement = new_type;