size: Hardcode size to work around screen rotation

Phoc sends output information *after* changing keyboard surface size. Squeekboard adjusts size on surface events, but not on output in this revision, making it unaware of display size at the time of adjustment, resulting in bad adjustment.

This change hardcodes the proportions again to make it work at least on the Librem5.
This commit is contained in:
Dorota Czaplejewicz
2020-06-28 17:14:49 +00:00
parent 762e12431d
commit 4f72779681

View File

@ -87,6 +87,18 @@ on_notify_unmap (GObject *object,
g_object_set (context, "visible", FALSE, NULL); g_object_set (context, "visible", FALSE, NULL);
} }
static uint32_t
calculate_height(int32_t width)
{
uint32_t height = 180;
if (width < 360 && width > 0) {
height = ((unsigned)width * 7 / 12); // to match 360×210
} else if (width < 540) {
height = 180 + (540 - (unsigned)width) * 30 / 180; // smooth transition
}
return height;
}
static void static void
on_surface_configure(PhoshLayerSurface *surface, ServerContextService *context) on_surface_configure(PhoshLayerSurface *surface, ServerContextService *context)
{ {
@ -97,7 +109,12 @@ on_surface_configure(PhoshLayerSurface *surface, ServerContextService *context)
"configured-height", &height, "configured-height", &height,
NULL); NULL);
guint desired_height = squeek_uiman_get_perceptual_height(context->manager); // When the geometry event comes after surface.configure,
// this entire height calculation does nothing.
// guint desired_height = squeek_uiman_get_perceptual_height(context->manager);
// Temporarily use old method, until the size manager is complete.
guint desired_height = calculate_height(width);
guint configured_height = (guint)height; guint configured_height = (guint)height;
// if height was already requested once but a different one was given // if height was already requested once but a different one was given
// (for the same set of surrounding properties), // (for the same set of surrounding properties),