mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Do not restore window size if it exceeds screen size #38
This commit is contained in:
@@ -31,10 +31,6 @@ class ClapperApp extends AppBase
|
||||
|
||||
const headerBar = new HeaderBar(this.active_window);
|
||||
this.active_window.set_titlebar(headerBar);
|
||||
|
||||
const size = clapperWidget.windowSize;
|
||||
this.active_window.set_default_size(size[0], size[1]);
|
||||
debug(`restored window size: ${size[0]}x${size[1]}`);
|
||||
}
|
||||
|
||||
vfunc_open(files, hint)
|
||||
|
@@ -566,9 +566,18 @@ class ClapperWidget extends Gtk.Grid
|
||||
this.disconnect(this.mapSignal);
|
||||
|
||||
const root = this.get_root();
|
||||
if(!root) return;
|
||||
|
||||
const surface = root.get_surface();
|
||||
const monitor = root.display.get_monitor_at_surface(surface);
|
||||
const geometry = monitor.geometry;
|
||||
const size = this.windowSize;
|
||||
|
||||
debug(`detected monitor resolution: ${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]}`);
|
||||
}
|
||||
|
||||
surface.connect('notify::state', this._onStateNotify.bind(this));
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user