mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Do not hide controls while navigating panel
This commit is contained in:
@@ -29,6 +29,15 @@ class ClapperCustomButton extends Gtk.Button
|
|||||||
this.margin_top = (isFullscreen) ? 6 : 4;
|
this.margin_top = (isFullscreen) ? 6 : 4;
|
||||||
this.isFullscreen = isFullscreen;
|
this.isFullscreen = isFullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vfunc_clicked()
|
||||||
|
{
|
||||||
|
if(!this.isFullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
let { player } = this.get_ancestor(Gtk.Grid);
|
||||||
|
player._setHideControlsTimeout();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var IconButton = GObject.registerClass(
|
var IconButton = GObject.registerClass(
|
||||||
@@ -131,8 +140,9 @@ class ClapperPopoverButton extends IconButton
|
|||||||
|
|
||||||
vfunc_clicked()
|
vfunc_clicked()
|
||||||
{
|
{
|
||||||
this.set_state_flags(Gtk.StateFlags.CHECKED, false);
|
super.vfunc_clicked();
|
||||||
|
|
||||||
|
this.set_state_flags(Gtk.StateFlags.CHECKED, false);
|
||||||
this.popover.set_parent(this);
|
this.popover.set_parent(this);
|
||||||
this.popover.popup();
|
this.popover.popup();
|
||||||
}
|
}
|
||||||
|
30
clapper_src/controls.js
vendored
30
clapper_src/controls.js
vendored
@@ -1,4 +1,4 @@
|
|||||||
const { GObject, Gtk } = imports.gi;
|
const { GObject, Gdk, Gtk } = imports.gi;
|
||||||
const Buttons = imports.clapper_src.buttons;
|
const Buttons = imports.clapper_src.buttons;
|
||||||
const Debug = imports.clapper_src.debug;
|
const Debug = imports.clapper_src.debug;
|
||||||
const Misc = imports.clapper_src.misc;
|
const Misc = imports.clapper_src.misc;
|
||||||
@@ -56,6 +56,11 @@ class ClapperControls extends Gtk.Box
|
|||||||
this.unfullscreenButton.connect('clicked', this._onUnfullscreenClicked.bind(this));
|
this.unfullscreenButton.connect('clicked', this._onUnfullscreenClicked.bind(this));
|
||||||
this.unfullscreenButton.set_visible(false);
|
this.unfullscreenButton.set_visible(false);
|
||||||
|
|
||||||
|
let keyController = new Gtk.EventControllerKey();
|
||||||
|
keyController.connect('key-pressed', this._onControlsKeyPressed.bind(this));
|
||||||
|
keyController.connect('key-released', this._onControlsKeyReleased.bind(this));
|
||||||
|
this.add_controller(keyController);
|
||||||
|
|
||||||
this.add_css_class('playercontrols');
|
this.add_css_class('playercontrols');
|
||||||
this.realizeSignal = this.connect('realize', this._onRealize.bind(this));
|
this.realizeSignal = this.connect('realize', this._onRealize.bind(this));
|
||||||
}
|
}
|
||||||
@@ -416,4 +421,27 @@ class ClapperControls extends Gtk.Box
|
|||||||
let positionSeconds = Math.round(scale.get_value());
|
let positionSeconds = Math.round(scale.get_value());
|
||||||
clapperWidget.player.seek_seconds(positionSeconds);
|
clapperWidget.player.seek_seconds(positionSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Only happens when navigating through controls panel */
|
||||||
|
_onControlsKeyPressed(controller, keyval, keycode, state)
|
||||||
|
{
|
||||||
|
let { player } = this.get_ancestor(Gtk.Grid);
|
||||||
|
player._setHideControlsTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
_onControlsKeyReleased(controller, keyval, keycode, state)
|
||||||
|
{
|
||||||
|
switch(keyval) {
|
||||||
|
case Gdk.KEY_space:
|
||||||
|
case Gdk.KEY_Return:
|
||||||
|
case Gdk.KEY_Escape:
|
||||||
|
case Gdk.KEY_Right:
|
||||||
|
case Gdk.KEY_Left:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let { player } = this.get_ancestor(Gtk.Grid);
|
||||||
|
player._onWidgetKeyReleased(controller, keyval, keycode, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@@ -418,6 +418,7 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
root.connect('close-request', this._onCloseRequest.bind(this));
|
root.connect('close-request', this._onCloseRequest.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Widget only - does not happen when using controls navigation */
|
||||||
_onWidgetKeyPressed(controller, keyval, keycode, state)
|
_onWidgetKeyPressed(controller, keyval, keycode, state)
|
||||||
{
|
{
|
||||||
this.keyPressCount++;
|
this.keyPressCount++;
|
||||||
@@ -447,6 +448,7 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Also happens after using controls navigation for selected keys */
|
||||||
_onWidgetKeyReleased(controller, keyval, keycode, state)
|
_onWidgetKeyReleased(controller, keyval, keycode, state)
|
||||||
{
|
{
|
||||||
this.keyPressCount = 0;
|
this.keyPressCount = 0;
|
||||||
|
Reference in New Issue
Block a user