mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Fix volume button icon and window key events
This commit is contained in:
@@ -52,11 +52,9 @@ var App = GObject.registerClass({
|
|||||||
this.windowRealizeSignal = this.window.connect(
|
this.windowRealizeSignal = this.window.connect(
|
||||||
'realize', this._onWindowRealize.bind(this)
|
'realize', this._onWindowRealize.bind(this)
|
||||||
);
|
);
|
||||||
/*
|
this.window.keyController.connect(
|
||||||
this.window.connect(
|
'key-pressed', this._onWindowKeyPressEvent.bind(this)
|
||||||
'key-press-event', this._onWindowKeyPressEvent.bind(this)
|
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
this.window.connect(
|
this.window.connect(
|
||||||
'fullscreen-changed', this._onWindowFullscreenChanged.bind(this)
|
'fullscreen-changed', this._onWindowFullscreenChanged.bind(this)
|
||||||
);
|
);
|
||||||
@@ -173,9 +171,6 @@ var App = GObject.registerClass({
|
|||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
this.interface.addPlayer(this.player);
|
this.interface.addPlayer(this.player);
|
||||||
|
|
||||||
this.player.connect('warning', this._onPlayerWarning.bind(this));
|
|
||||||
this.player.connect('error', this._onPlayerError.bind(this));
|
|
||||||
this.player.connect('state-changed', this._onPlayerStateChanged.bind(this));
|
this.player.connect('state-changed', this._onPlayerStateChanged.bind(this));
|
||||||
/*
|
/*
|
||||||
this.player.connectWidget(
|
this.player.connectWidget(
|
||||||
@@ -213,15 +208,11 @@ var App = GObject.registerClass({
|
|||||||
this.interface.setFullscreenMode(isFullscreen);
|
this.interface.setFullscreenMode(isFullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onWindowKeyPressEvent(self, event)
|
_onWindowKeyPressEvent(self, keyval, keycode, state)
|
||||||
{
|
{
|
||||||
let [res, key] = event.get_keyval();
|
|
||||||
if(!res) return;
|
|
||||||
|
|
||||||
//let keyName = Gdk.keyval_name(key);
|
|
||||||
let bool = false;
|
let bool = false;
|
||||||
|
|
||||||
switch(key) {
|
switch(keyval) {
|
||||||
case Gdk.KEY_space:
|
case Gdk.KEY_space:
|
||||||
case Gdk.KEY_Return:
|
case Gdk.KEY_Return:
|
||||||
this.player.toggle_play();
|
this.player.toggle_play();
|
||||||
@@ -294,6 +285,7 @@ var App = GObject.registerClass({
|
|||||||
if(state === GstPlayer.PlayerState.BUFFERING)
|
if(state === GstPlayer.PlayerState.BUFFERING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
let isInhibited = false;
|
||||||
let flags = Gtk.ApplicationInhibitFlags.SUSPEND
|
let flags = Gtk.ApplicationInhibitFlags.SUSPEND
|
||||||
| Gtk.ApplicationInhibitFlags.IDLE;
|
| Gtk.ApplicationInhibitFlags.IDLE;
|
||||||
|
|
||||||
@@ -306,6 +298,10 @@ var App = GObject.registerClass({
|
|||||||
flags,
|
flags,
|
||||||
'video is playing'
|
'video is playing'
|
||||||
);
|
);
|
||||||
|
if(!this.inhibitCookie)
|
||||||
|
debug(new Error('could not inhibit session!'));
|
||||||
|
|
||||||
|
isInhibited = (this.inhibitCookie > 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(!this.inhibitCookie)
|
if(!this.inhibitCookie)
|
||||||
@@ -315,7 +311,7 @@ var App = GObject.registerClass({
|
|||||||
this.inhibitCookie = null;
|
this.inhibitCookie = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//debug('set prevent suspend to: ' + this.is_inhibited(flags));
|
debug(`set prevent suspend to: ${isInhibited}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPlayerButtonPressEvent(self, event)
|
_onPlayerButtonPressEvent(self, event)
|
||||||
@@ -414,16 +410,6 @@ var App = GObject.registerClass({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPlayerWarning(self, error)
|
|
||||||
{
|
|
||||||
debug(error.message, 'LEVEL_WARNING');
|
|
||||||
}
|
|
||||||
|
|
||||||
_onPlayerError(self, error)
|
|
||||||
{
|
|
||||||
debug(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
_onWindowCloseRequest()
|
_onWindowCloseRequest()
|
||||||
{
|
{
|
||||||
this.window.destroy();
|
this.window.destroy();
|
||||||
|
@@ -453,16 +453,12 @@ class ClapperInterface extends Gtk.Grid
|
|||||||
: 'overamplified';
|
: 'overamplified';
|
||||||
|
|
||||||
let iconName = `audio-volume-${icon}-symbolic`;
|
let iconName = `audio-volume-${icon}-symbolic`;
|
||||||
/*
|
if(this.controls.volumeButton.icon_name !== iconName)
|
||||||
if(this.controls.volumeButton.image.icon_name !== iconName)
|
|
||||||
{
|
{
|
||||||
debug(`set volume icon: ${icon}`);
|
debug(`set volume icon: ${icon}`);
|
||||||
this.controls.volumeButton.image.set_from_icon_name(
|
this.controls.volumeButton.set_icon_name(iconName);
|
||||||
iconName,
|
|
||||||
this.controls.volumeButton.image.icon_size
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if(volume === this.lastVolumeValue)
|
if(volume === this.lastVolumeValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -68,9 +68,6 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
|
|
||||||
this.set_config(config);
|
this.set_config(config);
|
||||||
this.set_mute(false);
|
this.set_mute(false);
|
||||||
|
|
||||||
/* FIXME: remove once GUI buttons are back */
|
|
||||||
this.set_volume(0.5);
|
|
||||||
this.set_plugin_rank('vah264dec', 300);
|
this.set_plugin_rank('vah264dec', 300);
|
||||||
|
|
||||||
this.loop = GLib.MainLoop.new(null, false);
|
this.loop = GLib.MainLoop.new(null, false);
|
||||||
@@ -86,6 +83,8 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
this.connect('state-changed', this._onStateChanged.bind(this));
|
this.connect('state-changed', this._onStateChanged.bind(this));
|
||||||
this.connect('uri-loaded', this._onUriLoaded.bind(this));
|
this.connect('uri-loaded', this._onUriLoaded.bind(this));
|
||||||
this.connect('end-of-stream', this._onStreamEnded.bind(this));
|
this.connect('end-of-stream', this._onStreamEnded.bind(this));
|
||||||
|
this.connect('warning', this._onPlayerWarning.bind(this));
|
||||||
|
this.connect('error', this._onPlayerError.bind(this));
|
||||||
this.connectWidget('destroy', this._onWidgetDestroy.bind(this));
|
this.connectWidget('destroy', this._onWidgetDestroy.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +252,16 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
this.loop.run();
|
this.loop.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onPlayerWarning(self, error)
|
||||||
|
{
|
||||||
|
debug(error.message, 'LEVEL_WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
_onPlayerError(self, error)
|
||||||
|
{
|
||||||
|
debug(error);
|
||||||
|
}
|
||||||
|
|
||||||
_onWidgetDestroy()
|
_onWidgetDestroy()
|
||||||
{
|
{
|
||||||
while(this._widgetSignals.length)
|
while(this._widgetSignals.length)
|
||||||
|
@@ -17,6 +17,10 @@ var Window = GObject.registerClass({
|
|||||||
destroy_with_parent: true,
|
destroy_with_parent: true,
|
||||||
});
|
});
|
||||||
this.isFullscreen = false;
|
this.isFullscreen = false;
|
||||||
|
|
||||||
|
this.keyController = new Gtk.EventControllerKey();
|
||||||
|
this.add_controller(this.keyController);
|
||||||
|
|
||||||
this.mapSignal = this.connect('map', this._onMap.bind(this));
|
this.mapSignal = this.connect('map', this._onMap.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user