From e4309567520cea4e86c514ad927e01a8a6167bfc Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Tue, 13 Oct 2020 20:27:58 +0200 Subject: [PATCH] Allow navigating over buttons via keyboard --- clapper_src/controls.js | 12 +----------- clapper_src/headerbar.js | 6 ++++-- clapper_src/window.js | 5 +++-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/clapper_src/controls.js b/clapper_src/controls.js index 513dca2d..d86a4cc3 100644 --- a/clapper_src/controls.js +++ b/clapper_src/controls.js @@ -57,12 +57,9 @@ var Controls = GObject.registerClass({ this.fullscreenButton = Gtk.Button.new_from_icon_name( 'view-fullscreen-symbolic', ); - this.setDefaultWidgetBehaviour(this.fullscreenButton); this.openMenuButton = Gtk.Button.new_from_icon_name( 'open-menu-symbolic', ); - this.setDefaultWidgetBehaviour(this.openMenuButton); - //this.forall(this.setDefaultWidgetBehaviour); this.add_css_class('playercontrols'); @@ -136,7 +133,6 @@ var Controls = GObject.registerClass({ 'toggled', this._onCheckButtonToggled.bind(this, checkButton) ); - this.setDefaultWidgetBehaviour(checkButton); box.append(checkButton); } @@ -160,12 +156,6 @@ var Controls = GObject.registerClass({ } } - setDefaultWidgetBehaviour(widget) - { - widget.can_focus = false; - //widget.can_default = false; - } - handleScaleIncrement(type, isUp) { let value = this[`${type}Scale`].get_value(); @@ -201,6 +191,7 @@ var Controls = GObject.registerClass({ draw_value: false, hexpand: true, valign: Gtk.Align.CENTER, + can_focus: false, }); this.togglePlayButton.bind_property('margin_top', @@ -247,7 +238,6 @@ var Controls = GObject.registerClass({ this.volumeAdjustment.set_upper(2); this.volumeAdjustment.set_step_increment(0.05); this.volumeAdjustment.set_page_increment(0.05); - this.setDefaultWidgetBehaviour(this.volumeScale); for(let i = 0; i <= 2; i++) { let text = (i) ? `${i}00%` : '0%'; diff --git a/clapper_src/headerbar.js b/clapper_src/headerbar.js index 3a44d25c..017b4ab4 100644 --- a/clapper_src/headerbar.js +++ b/clapper_src/headerbar.js @@ -5,7 +5,9 @@ class ClapperHeaderBar extends Gtk.HeaderBar { _init(window, startButtons, endButtons) { - super._init(); + super._init({ + can_focus: false, + }); this.set_title_widget(this._createWidgetForWindow(window)); startButtons.forEach(btn => this.pack_start(btn)); @@ -43,7 +45,7 @@ class ClapperHeaderBar extends Gtk.HeaderBar { let box = new Gtk.Box ({ orientation: Gtk.Orientation.VERTICAL, - valign: Gtk.Align.CENTER + valign: Gtk.Align.CENTER, }); this.titleLabel = new Gtk.Label({ diff --git a/clapper_src/window.js b/clapper_src/window.js index 5ca1d546..a9228202 100644 --- a/clapper_src/window.js +++ b/clapper_src/window.js @@ -28,8 +28,9 @@ var Window = GObject.registerClass({ _onStateNotify(toplevel) { - let { state } = toplevel; - let isFullscreen = Boolean(state & Gdk.ToplevelState.FULLSCREEN); + let isFullscreen = Boolean( + toplevel.state & Gdk.ToplevelState.FULLSCREEN + ); if(this.isFullscreen === isFullscreen) return;