From fd2ad7e59650ea60f0c8f0b8436208e7674bef5b Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Wed, 2 Sep 2020 16:56:58 +0200 Subject: [PATCH] Listen for key presses on window instead of player This fixes a GNOME bug where sometimes key press events are not emited --- clapper_src/app.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/clapper_src/app.js b/clapper_src/app.js index cb0a7aae..2a0fef1b 100644 --- a/clapper_src/app.js +++ b/clapper_src/app.js @@ -57,7 +57,13 @@ var App = GObject.registerClass({ _buildUI() { this.window = new Window(this, APP_NAME); - this.window.connect('realize', this._onWindowRealize.bind(this)); + + this.window.connect( + 'realize', this._onWindowRealize.bind(this) + ); + this.window.connect( + 'key-press-event', this._onWindowKeyPressEvent.bind(this) + ); this.window.connect( 'fullscreen-changed', this._onWindowFullscreenChanged.bind(this) ); @@ -88,9 +94,6 @@ var App = GObject.registerClass({ this.player.connect('warning', this._onPlayerWarning.bind(this)); this.player.connect('error', this._onPlayerError.bind(this)); - this.player.widget.connect( - 'key-press-event', this._onPlayerKeyPressEvent.bind(this) - ); this.player.widget.connect( 'button-press-event', this._onPlayerButtonPressEvent.bind(this) ); @@ -142,7 +145,7 @@ var App = GObject.registerClass({ this.interface.controls[action](); } - _onPlayerKeyPressEvent(self, event) + _onWindowKeyPressEvent(self, event) { let [res, key] = event.get_keyval(); if(!res) return;