mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
Remove old floating mode leftovers
Clapper has now much simpler floating mode. This overcomplicated code is not needed anymore.
This commit is contained in:
@@ -205,41 +205,6 @@ radio {
|
||||
min-height: 6px;
|
||||
}
|
||||
|
||||
/* Floating Mode */
|
||||
.floatingwindow {
|
||||
border-radius: 8px;
|
||||
}
|
||||
.osd.floatingcontrols .playercontrols {
|
||||
-gtk-icon-size: 16px;
|
||||
}
|
||||
.osd.floatingcontrols .playbackicon {
|
||||
-gtk-icon-size: 20px;
|
||||
}
|
||||
.osd.floatingcontrols button {
|
||||
border-radius: 10px;
|
||||
min-width: 24px;
|
||||
min-height: 24px;
|
||||
}
|
||||
.osd.floatingcontrols .positionscale {
|
||||
margin-top: -2px;
|
||||
}
|
||||
.osd.floatingcontrols .positionscale trough highlight {
|
||||
border-radius: 3px;
|
||||
min-height: 12px;
|
||||
}
|
||||
.osd.floatingcontrols .positionscale.fine-tune trough highlight {
|
||||
border-radius: 3px;
|
||||
min-height: 12px;
|
||||
}
|
||||
.osd.floatingcontrols .positionscale mark indicator {
|
||||
min-height: 5px;
|
||||
min-width: 1px;
|
||||
}
|
||||
.osd.floatingcontrols .positionscale.fine-tune mark indicator {
|
||||
min-height: 5px;
|
||||
min-width: 1px;
|
||||
}
|
||||
|
||||
.narrowbutton {
|
||||
min-width: 8px;
|
||||
}
|
||||
@@ -265,11 +230,6 @@ radio {
|
||||
font-size: 21px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.osd.floatingcontrols .chapterlabel {
|
||||
font: inherit;
|
||||
font-size: 100%;
|
||||
min-width: 32px;
|
||||
}
|
||||
|
||||
/* Preferences */
|
||||
.prefsnotebook grid {
|
||||
|
@@ -104,10 +104,6 @@
|
||||
<default>'[960, 583]'</default>
|
||||
<summary>Stores window size to restore on next launch</summary>
|
||||
</key>
|
||||
<key name="float-size" type="s">
|
||||
<default>'[480, 270]'</default>
|
||||
<summary>Stores floating window size to restore on next launch</summary>
|
||||
</key>
|
||||
<key name="volume-last" type="d">
|
||||
<default>1</default>
|
||||
<summary>Stores last linear volume value to apply on startup</summary>
|
||||
|
@@ -18,11 +18,7 @@ class ClapperCustomButton extends Gtk.Button
|
||||
|
||||
super._init(opts);
|
||||
|
||||
this.floatUnaffected = false;
|
||||
this.wantedVisible = true;
|
||||
this.isFullscreen = false;
|
||||
this.isFloating = false;
|
||||
|
||||
this.add_css_class('flat');
|
||||
}
|
||||
|
||||
@@ -43,32 +39,6 @@ class ClapperCustomButton extends Gtk.Button
|
||||
this.isFullscreen = isFullscreen;
|
||||
}
|
||||
|
||||
setFloatingMode(isFloating)
|
||||
{
|
||||
if(this.isFloating === isFloating)
|
||||
return;
|
||||
|
||||
this.isFloating = isFloating;
|
||||
|
||||
if(this.floatUnaffected)
|
||||
return;
|
||||
|
||||
if(isFloating)
|
||||
super.set_visible(false);
|
||||
else
|
||||
super.set_visible(this.wantedVisible);
|
||||
}
|
||||
|
||||
set_visible(isVisible)
|
||||
{
|
||||
this.wantedVisible = isVisible;
|
||||
|
||||
if(this.isFloating && !this.floatUnaffected)
|
||||
super.set_visible(false);
|
||||
else
|
||||
super.set_visible(isVisible);
|
||||
}
|
||||
|
||||
vfunc_clicked()
|
||||
{
|
||||
if(!this.isFullscreen)
|
||||
@@ -79,24 +49,14 @@ class ClapperCustomButton extends Gtk.Button
|
||||
}
|
||||
});
|
||||
|
||||
var IconButton = GObject.registerClass(
|
||||
class ClapperIconButton extends CustomButton
|
||||
{
|
||||
_init(icon)
|
||||
{
|
||||
super._init({
|
||||
icon_name: icon,
|
||||
});
|
||||
this.floatUnaffected = true;
|
||||
}
|
||||
});
|
||||
|
||||
var IconToggleButton = GObject.registerClass(
|
||||
class ClapperIconToggleButton extends IconButton
|
||||
class ClapperIconToggleButton extends CustomButton
|
||||
{
|
||||
_init(primaryIcon, secondaryIcon)
|
||||
{
|
||||
super._init(primaryIcon);
|
||||
super._init({
|
||||
icon_name: primaryIcon,
|
||||
});
|
||||
|
||||
this.primaryIcon = primaryIcon;
|
||||
this.secondaryIcon = secondaryIcon;
|
||||
|
23
src/controls.js
vendored
23
src/controls.js
vendored
@@ -47,7 +47,6 @@ class ClapperControls extends Gtk.Box
|
||||
'go-previous-symbolic',
|
||||
'go-next-symbolic'
|
||||
);
|
||||
revealTracksButton.floatUnaffected = false;
|
||||
revealTracksButton.add_css_class('narrowbutton');
|
||||
this.buttonsArr.push(revealTracksButton);
|
||||
const tracksRevealer = new Revealers.ButtonsRevealer(
|
||||
@@ -90,12 +89,6 @@ class ClapperControls extends Gtk.Box
|
||||
this.unfullscreenButton.connect('clicked', this._onUnfullscreenClicked.bind(this));
|
||||
this.unfullscreenButton.set_visible(false);
|
||||
|
||||
this.unfloatButton = this.addButton(
|
||||
'preferences-desktop-remote-desktop-symbolic'
|
||||
);
|
||||
this.unfloatButton.connect('clicked', this._onUnfloatClicked.bind(this));
|
||||
this.unfloatButton.set_visible(false);
|
||||
|
||||
const keyController = new Gtk.EventControllerKey();
|
||||
keyController.connect('key-pressed', this._onControlsKeyPressed.bind(this));
|
||||
keyController.connect('key-released', this._onControlsKeyReleased.bind(this));
|
||||
@@ -117,14 +110,6 @@ class ClapperControls extends Gtk.Box
|
||||
this.set_can_focus(isFullscreen);
|
||||
}
|
||||
|
||||
setFloatingMode(isFloating)
|
||||
{
|
||||
this.isMobile = null;
|
||||
|
||||
for(let button of this.buttonsArr)
|
||||
button.setFloatingMode(isFloating);
|
||||
}
|
||||
|
||||
setLiveMode(isLive, isSeekable)
|
||||
{
|
||||
if(isLive)
|
||||
@@ -147,7 +132,7 @@ class ClapperControls extends Gtk.Box
|
||||
{
|
||||
const button = (buttonIcon instanceof Gtk.Button)
|
||||
? buttonIcon
|
||||
: new Buttons.IconButton(buttonIcon);
|
||||
: new Buttons.CustomButton({ icon_name: buttonIcon });
|
||||
|
||||
if(!revealer)
|
||||
this.append(button);
|
||||
@@ -528,12 +513,6 @@ class ClapperControls extends Gtk.Box
|
||||
root.unfullscreen();
|
||||
}
|
||||
|
||||
_onUnfloatClicked(button)
|
||||
{
|
||||
const clapperWidget = this.get_ancestor(Gtk.Grid);
|
||||
clapperWidget.setFloatingMode(false);
|
||||
}
|
||||
|
||||
_onCheckButtonToggled(checkButton)
|
||||
{
|
||||
if(!checkButton.get_active())
|
||||
|
@@ -342,7 +342,7 @@ class ClapperPlayer extends PlayerBase
|
||||
|
||||
if(this.cursorInPlayer) {
|
||||
const clapperWidget = this.widget.get_ancestor(Gtk.Grid);
|
||||
if(clapperWidget.fullscreenMode || clapperWidget.floatingMode) {
|
||||
if(clapperWidget.fullscreenMode) {
|
||||
this._clearTimeout('updateTime');
|
||||
clapperWidget.revealControls(false);
|
||||
}
|
||||
@@ -644,7 +644,7 @@ class ClapperPlayer extends PlayerBase
|
||||
this._setHideCursorTimeout();
|
||||
|
||||
const clapperWidget = this.widget.get_ancestor(Gtk.Grid);
|
||||
if(clapperWidget.fullscreenMode || clapperWidget.floatingMode)
|
||||
if(clapperWidget.fullscreenMode)
|
||||
this._setHideControlsTimeout();
|
||||
}
|
||||
|
||||
@@ -676,12 +676,7 @@ class ClapperPlayer extends PlayerBase
|
||||
clapperWidget.revealerTop.set_cursor(defaultCursor);
|
||||
this._setHideCursorTimeout();
|
||||
|
||||
if(clapperWidget.floatingMode && !clapperWidget.fullscreenMode) {
|
||||
clapperWidget.revealerBottom.set_can_focus(false);
|
||||
clapperWidget.revealerBottom.revealChild(true);
|
||||
this._setHideControlsTimeout();
|
||||
}
|
||||
else if(clapperWidget.fullscreenMode) {
|
||||
if(clapperWidget.fullscreenMode) {
|
||||
if(!this._updateTimeTimeout)
|
||||
this._setUpdateTimeInterval();
|
||||
|
||||
|
@@ -198,15 +198,6 @@ class ClapperRevealerBottom extends CustomRevealer
|
||||
this.revealerBox.remove(widget);
|
||||
}
|
||||
|
||||
setFloatingClass(isFloating)
|
||||
{
|
||||
if(isFloating === this.revealerBox.has_css_class('floatingcontrols'))
|
||||
return;
|
||||
|
||||
const action = (isFloating) ? 'add' : 'remove';
|
||||
this.revealerBox[`${action}_css_class`]('floatingcontrols');
|
||||
}
|
||||
|
||||
set_visible(isVisible)
|
||||
{
|
||||
const isChange = super.set_visible(isVisible);
|
||||
@@ -322,18 +313,6 @@ class ClapperButtonsRevealer extends Gtk.Revealer
|
||||
}
|
||||
}
|
||||
|
||||
set_reveal_child(isReveal)
|
||||
{
|
||||
if(this.reveal_child === isReveal)
|
||||
return;
|
||||
|
||||
const grandson = this.child.get_first_child();
|
||||
if(grandson && grandson.isFloating && !grandson.isFullscreen)
|
||||
return;
|
||||
|
||||
super.set_reveal_child(isReveal);
|
||||
}
|
||||
|
||||
append(widget)
|
||||
{
|
||||
this.get_child().append(widget);
|
||||
|
@@ -21,11 +21,9 @@ class ClapperWidget extends Gtk.Grid
|
||||
Misc.loadCustomCss();
|
||||
|
||||
this.windowSize = JSON.parse(settings.get_string('window-size'));
|
||||
this.floatSize = JSON.parse(settings.get_string('float-size'));
|
||||
this.layoutWidth = 0;
|
||||
|
||||
this.fullscreenMode = false;
|
||||
this.floatingMode = false;
|
||||
this.isSeekable = false;
|
||||
this.isMobileMonitor = false;
|
||||
|
||||
@@ -120,14 +118,7 @@ class ClapperWidget extends Gtk.Grid
|
||||
if(!this.isMobileMonitor)
|
||||
root[action + '_css_class']('tvmode');
|
||||
|
||||
if(!this.floatingMode)
|
||||
this._changeControlsPlacement(isFullscreen);
|
||||
else {
|
||||
this._setWindowFloating(!isFullscreen);
|
||||
this.revealerBottom.setFloatingClass(!isFullscreen);
|
||||
this.controls.setFloatingMode(!isFullscreen);
|
||||
this.controls.unfloatButton.set_visible(!isFullscreen);
|
||||
}
|
||||
this._changeControlsPlacement(isFullscreen);
|
||||
|
||||
this.controls.setFullscreenMode(isFullscreen);
|
||||
this.showControls(isFullscreen);
|
||||
@@ -143,64 +134,10 @@ class ClapperWidget extends Gtk.Grid
|
||||
}
|
||||
}
|
||||
|
||||
setFloatingMode(isFloating)
|
||||
{
|
||||
if(this.floatingMode === isFloating)
|
||||
return;
|
||||
|
||||
const root = this.get_root();
|
||||
const size = root.get_default_size();
|
||||
|
||||
this._saveWindowSize(size);
|
||||
|
||||
if(isFloating) {
|
||||
this.windowSize = size;
|
||||
this.player.widget.set_size_request(192, 108);
|
||||
}
|
||||
else {
|
||||
this.floatSize = size;
|
||||
this.player.widget.set_size_request(-1, -1);
|
||||
}
|
||||
|
||||
this.floatingMode = isFloating;
|
||||
|
||||
this.revealerBottom.setFloatingClass(isFloating);
|
||||
this._changeControlsPlacement(isFloating);
|
||||
this.controls.setFloatingMode(isFloating);
|
||||
this.controls.unfloatButton.set_visible(isFloating);
|
||||
this._setWindowFloating(isFloating);
|
||||
|
||||
const resize = (isFloating)
|
||||
? this.floatSize
|
||||
: this.windowSize;
|
||||
|
||||
root.set_default_size(resize[0], resize[1]);
|
||||
debug(`resized window: ${resize[0]}x${resize[1]}`);
|
||||
|
||||
this.revealerBottom.showChild(false);
|
||||
this.player.widget.grab_focus();
|
||||
}
|
||||
|
||||
_setWindowFloating(isFloating)
|
||||
{
|
||||
const root = this.get_root();
|
||||
const cssClass = 'floatingwindow';
|
||||
|
||||
if(isFloating === root.has_css_class(cssClass))
|
||||
return;
|
||||
|
||||
const action = (isFloating) ? 'add' : 'remove';
|
||||
root[action + '_css_class'](cssClass);
|
||||
}
|
||||
|
||||
_saveWindowSize(size)
|
||||
{
|
||||
const rootName = (this.floatingMode)
|
||||
? 'float'
|
||||
: 'window';
|
||||
|
||||
settings.set_string(`${rootName}-size`, JSON.stringify(size));
|
||||
debug(`saved ${rootName} size: ${size[0]}x${size[1]}`);
|
||||
settings.set_string('window-size', JSON.stringify(size));
|
||||
debug(`saved window size: ${size[0]}x${size[1]}`);
|
||||
}
|
||||
|
||||
_changeControlsPlacement(isOnTop)
|
||||
@@ -599,7 +536,6 @@ class ClapperWidget extends Gtk.Grid
|
||||
{
|
||||
if(
|
||||
this.fullscreenMode
|
||||
|| !this.floatingMode
|
||||
|| this.player.isWidgetDragging
|
||||
)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user