Allow navigating over buttons via keyboard

This commit is contained in:
Rafostar
2020-10-13 20:27:58 +02:00
parent d3e4f3bb0f
commit e430956752
3 changed files with 8 additions and 15 deletions

View File

@@ -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%';

View File

@@ -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({

View File

@@ -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;