diff --git a/src/app.js b/src/app.js index 6f0ef60a..7df9c3e5 100644 --- a/src/app.js +++ b/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); + } }); diff --git a/src/widget.js b/src/widget.js index a9ee8169..136e88f7 100644 --- a/src/widget.js +++ b/src/widget.js @@ -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]}`); }