display: Correctly round scaled monitor size
We were converting the floating point numbers to integers using a cast, which causes them to be always rounded down. The result is that a monitor may be too small by a pixel, creating broken configurations. Also fix the same issue when calculating whether a scale should be supported. See https://gitlab.gnome.org/GNOME/mutter/issues/412
This commit is contained in:
parent
1bfe19ebcf
commit
4db431d7f1
2 changed files with 8 additions and 4 deletions
|
@ -117,8 +117,8 @@ get_scaled_geometry (CcDisplayConfig *config,
|
|||
if (cc_display_config_is_layout_logical (config))
|
||||
{
|
||||
double scale = cc_display_monitor_get_scale (output);
|
||||
*w /= scale;
|
||||
*h /= scale;
|
||||
*w = round (*w / scale);
|
||||
*h = round (*h / scale);
|
||||
}
|
||||
|
||||
apply_rotation_to_geometry (output, w, h);
|
||||
|
|
|
@ -627,11 +627,15 @@ make_orientation_row (CcDisplayPanel *panel, CcDisplayMonitor *output)
|
|||
static gboolean
|
||||
display_mode_supported_at_scale (CcDisplayMode *mode, double scale)
|
||||
{
|
||||
int width, height;
|
||||
gint width, height;
|
||||
gint scaled_width, scaled_height;
|
||||
|
||||
cc_display_mode_get_resolution (mode, &width, &height);
|
||||
|
||||
return width / scale >= MINIMUM_WIDTH && height / scale >= MINIMUM_HEIGHT;
|
||||
scaled_width = round (width / scale);
|
||||
scaled_height = round (height / scale);
|
||||
|
||||
return scaled_width >= MINIMUM_WIDTH && scaled_height >= MINIMUM_HEIGHT;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue