layout: Protect against broken monitor size reports
VNC / XRDP reports nonsensial (i.e 0) monitor dimensions causing us to end up with a dpi of "Infinity" and thus scale even though we shouldn't. https://bugzilla.redhat.com/show_bug.cgi?id=1065788
This commit is contained in:
parent
470889f1c3
commit
e5c982351f
@ -489,6 +489,12 @@ const LayoutManager = new Lang.Class({
|
|||||||
|
|
||||||
_updateScaling: function() {
|
_updateScaling: function() {
|
||||||
let primary = this.monitors[this.primaryIndex];
|
let primary = this.monitors[this.primaryIndex];
|
||||||
|
let width_mm = global.gdk_screen.get_monitor_width_mm(this.primaryIndex);
|
||||||
|
let height_mm = global.gdk_screen.get_monitor_height_mm(this.primaryIndex);
|
||||||
|
if (width_mm == 0 || height_mm == 0) {
|
||||||
|
St.ThemeContext.get_for_stage(global.stage).scale_factor = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
let dpi_x = primary.width / (global.gdk_screen.get_monitor_width_mm(this.primaryIndex) / 25.4);
|
let dpi_x = primary.width / (global.gdk_screen.get_monitor_width_mm(this.primaryIndex) / 25.4);
|
||||||
let dpi_y = primary.height / (global.gdk_screen.get_monitor_height_mm(this.primaryIndex) / 25.4);
|
let dpi_y = primary.height / (global.gdk_screen.get_monitor_height_mm(this.primaryIndex) / 25.4);
|
||||||
if (dpi_x > HIGH_DPI_LIMIT && dpi_y > HIGH_DPI_LIMIT)
|
if (dpi_x > HIGH_DPI_LIMIT && dpi_y > HIGH_DPI_LIMIT)
|
||||||
|
Loading…
Reference in New Issue
Block a user