Detect mobile monitor based on application-pixels

This commit is contained in:
Rafostar
2021-02-07 21:20:14 +01:00
parent 65b4df13a8
commit 8a5702f296
2 changed files with 10 additions and 1 deletions

2
src/controls.js vendored
View File

@@ -28,6 +28,8 @@ class ClapperControls extends Gtk.Box
this.currentPosition = 0;
this.currentDuration = 0;
this.isPositionDragging = false;
this.isMobileMonitor = false;
this.isMobile = false;
this.showHours = false;

View File

@@ -571,13 +571,20 @@ class ClapperWidget extends Gtk.Grid
const geometry = monitor.geometry;
const size = this.windowSize;
debug(`detected monitor resolution: ${geometry.width}x${geometry.height}`);
debug(`monitor application-pixels: ${geometry.width}x${geometry.height}`);
if(geometry.width >= size[0] && geometry.height >= size[1]) {
root.set_default_size(size[0], size[1]);
debug(`restored window size: ${size[0]}x${size[1]}`);
}
const monitorWidth = Math.max(geometry.width, geometry.height);
if(monitorWidth < 1280) {
this.controls.isMobileMonitor = true;
debug('mobile monitor detected');
}
surface.connect('notify::state', this._onStateNotify.bind(this));
}
});