display: Consider monitors in landscape mode for minimum size

Some devices have panels with a native resolution in portrait mode. In
these cases the monitor will likely be used in landscape mode.

Accept the modes as if they are landscape rather than portrait. A
further improvement would be to restrict the orientation setting.

Fixes #639
This commit is contained in:
Benjamin Berg 2019-08-12 11:43:30 +02:00 committed by Benjamin Berg
parent fe932a4cea
commit 4e800cc558
2 changed files with 11 additions and 3 deletions

View file

@ -1211,13 +1211,18 @@ is_scaled_mode_allowed (CcDisplayConfigDBus *self,
CcDisplayMode *pmode,
double scale)
{
gint width, height;
CcDisplayModeDBus *mode = CC_DISPLAY_MODE_DBUS (pmode);
if (!cc_display_mode_dbus_is_supported_scale (pmode, scale))
return FALSE;
return (round (mode->width / scale) >= self->min_width &&
round (mode->height / scale) >= self->min_height);
/* Do the math as if the monitor is always in landscape mode. */
width = round (mode->width / scale);
height = round (mode->height / scale);
return (MAX (width, height) >= self->min_width &&
MIN (width, height) >= self->min_height);
}
static gboolean