From dbdb6988a234f73373a0ce20a697323b49e48e08 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Tue, 6 Oct 2020 12:04:28 +0200 Subject: [PATCH] Fix window "fullscreen-changed" signal --- clapper_src/app.js | 3 +++ clapper_src/window.js | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/clapper_src/app.js b/clapper_src/app.js index dc4644f5..b609e066 100644 --- a/clapper_src/app.js +++ b/clapper_src/app.js @@ -164,6 +164,9 @@ var App = GObject.registerClass({ if(!this.player.widget) return this.quit(); + + this.player.widget.width_request = 960; + this.player.widget.height_request = 540; /* this.player.widget.add_events( Gdk.EventMask.SCROLL_MASK diff --git a/clapper_src/window.js b/clapper_src/window.js index 51ae3343..5ca1d546 100644 --- a/clapper_src/window.js +++ b/clapper_src/window.js @@ -13,14 +13,11 @@ var Window = GObject.registerClass({ super._init({ application: application, title: title || 'Clapper', - //border_width: 0, resizable: true, - //window_position: Gtk.WindowPosition.CENTER, - width_request: 960, - height_request: 642, destroy_with_parent: true, }); this.isFullscreen = false; + this.mapSignal = this.connect('map', this._onMap.bind(this)); } toggleFullscreen() @@ -28,15 +25,11 @@ var Window = GObject.registerClass({ let un = (this.isFullscreen) ? 'un' : ''; this[`${un}fullscreen`](); } -/* - vfunc_window_state_event(event) - { - super.vfunc_window_state_event(event); - let isFullscreen = Boolean( - event.new_window_state - & Gdk.WindowState.FULLSCREEN - ); + _onStateNotify(toplevel) + { + let { state } = toplevel; + let isFullscreen = Boolean(state & Gdk.ToplevelState.FULLSCREEN); if(this.isFullscreen === isFullscreen) return; @@ -44,5 +37,12 @@ var Window = GObject.registerClass({ this.isFullscreen = isFullscreen; this.emit('fullscreen-changed', this.isFullscreen); } -*/ + + _onMap() + { + this.disconnect(this.mapSignal); + + let surface = this.get_surface(); + surface.connect('notify::state', this._onStateNotify.bind(this)); + } });