mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Fix startup window size on XOrg
The window size was restored too early which caused the window to be a little bigger then it should on each launch. Restore window size after that window was mapped.
This commit is contained in:
10
src/app.js
10
src/app.js
@@ -30,6 +30,8 @@ class ClapperApp extends AppBase
|
||||
window.add_css_class('nobackground');
|
||||
window.set_child(clapperWidget);
|
||||
window.set_titlebar(dummyHeaderbar);
|
||||
|
||||
this.mapSignal = window.connect('map', this._onWindowMap.bind(this));
|
||||
}
|
||||
|
||||
vfunc_open(files, hint)
|
||||
@@ -39,4 +41,12 @@ class ClapperApp extends AppBase
|
||||
this._openFiles(files);
|
||||
this.activate();
|
||||
}
|
||||
|
||||
_onWindowMap(window)
|
||||
{
|
||||
window.disconnect(this.mapSignal);
|
||||
this.mapSignal = null;
|
||||
|
||||
window.child._onWindowMap(window);
|
||||
}
|
||||
});
|
||||
|
@@ -23,8 +23,6 @@ class ClapperWidget extends Gtk.Grid
|
||||
|
||||
this.posX = 0;
|
||||
this.posY = 0;
|
||||
|
||||
this.windowSize = JSON.parse(settings.get_string('window-size'));
|
||||
this.layoutWidth = 0;
|
||||
|
||||
this.isFullscreenMode = false;
|
||||
@@ -59,8 +57,6 @@ class ClapperWidget extends Gtk.Grid
|
||||
this.attach(this.overlay, 0, 0, 1, 1);
|
||||
this.attach(this.controlsRevealer, 0, 1, 1, 1);
|
||||
|
||||
this.mapSignal = this.connect('map', this._onMap.bind(this));
|
||||
|
||||
this.player = new Player();
|
||||
const playerWidget = this.player.widget;
|
||||
|
||||
@@ -549,20 +545,17 @@ class ClapperWidget extends Gtk.Grid
|
||||
this.controls._onPlayerResize(width, height);
|
||||
}
|
||||
|
||||
_onMap()
|
||||
_onWindowMap(window)
|
||||
{
|
||||
this.disconnect(this.mapSignal);
|
||||
|
||||
const root = this.get_root();
|
||||
const surface = root.get_surface();
|
||||
const monitor = root.display.get_monitor_at_surface(surface);
|
||||
const surface = window.get_surface();
|
||||
const monitor = window.display.get_monitor_at_surface(surface);
|
||||
const geometry = monitor.geometry;
|
||||
const size = this.windowSize;
|
||||
const size = JSON.parse(settings.get_string('window-size'));
|
||||
|
||||
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]);
|
||||
window.set_default_size(size[0], size[1]);
|
||||
debug(`restored window size: ${size[0]}x${size[1]}`);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user