mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Detect mobile monitor based on application-pixels
This commit is contained in:
2
src/controls.js
vendored
2
src/controls.js
vendored
@@ -28,6 +28,8 @@ class ClapperControls extends Gtk.Box
|
|||||||
this.currentPosition = 0;
|
this.currentPosition = 0;
|
||||||
this.currentDuration = 0;
|
this.currentDuration = 0;
|
||||||
this.isPositionDragging = false;
|
this.isPositionDragging = false;
|
||||||
|
|
||||||
|
this.isMobileMonitor = false;
|
||||||
this.isMobile = false;
|
this.isMobile = false;
|
||||||
|
|
||||||
this.showHours = false;
|
this.showHours = false;
|
||||||
|
@@ -571,13 +571,20 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
const geometry = monitor.geometry;
|
const geometry = monitor.geometry;
|
||||||
const size = this.windowSize;
|
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]) {
|
if(geometry.width >= size[0] && geometry.height >= size[1]) {
|
||||||
root.set_default_size(size[0], size[1]);
|
root.set_default_size(size[0], size[1]);
|
||||||
debug(`restored window size: ${size[0]}x${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));
|
surface.connect('notify::state', this._onStateNotify.bind(this));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user