Observe surface width instead of video widget

This commit is contained in:
Rafostar
2021-02-07 21:47:25 +01:00
parent 8a5702f296
commit 65f1e8e60e
2 changed files with 12 additions and 2 deletions

3
src/controls.js vendored
View File

@@ -509,10 +509,9 @@ class ClapperControls extends Gtk.Box
: Misc.getCubicValue(settings.get_double('volume-last')); : Misc.getCubicValue(settings.get_double('volume-last'));
this.volumeScale.set_value(initialVolume); this.volumeScale.set_value(initialVolume);
player.widget.connect('resize', this._onPlayerResize.bind(this));
} }
_onPlayerResize(widget, width, height) _onPlayerResize(width, height)
{ {
const isMobile = (width < 560); const isMobile = (width < 560);
if(this.isMobile === isMobile) if(this.isMobile === isMobile)

View File

@@ -21,6 +21,7 @@ class ClapperWidget extends Gtk.Grid
this.windowSize = JSON.parse(settings.get_string('window-size')); this.windowSize = JSON.parse(settings.get_string('window-size'));
this.floatSize = JSON.parse(settings.get_string('float-size')); this.floatSize = JSON.parse(settings.get_string('float-size'));
this.layoutWidth = 0;
this.fullscreenMode = false; this.fullscreenMode = false;
this.floatingMode = false; this.floatingMode = false;
@@ -549,6 +550,15 @@ class ClapperWidget extends Gtk.Grid
debug(`interface in fullscreen mode: ${isFullscreen}`); debug(`interface in fullscreen mode: ${isFullscreen}`);
} }
_onLayoutUpdate(surface, width, height)
{
if(width === this.layoutWidth)
return;
this.layoutWidth = width;
this.controls._onPlayerResize(width, height);
}
_onLeave(controller) _onLeave(controller)
{ {
if( if(
@@ -586,5 +596,6 @@ class ClapperWidget extends Gtk.Grid
} }
surface.connect('notify::state', this._onStateNotify.bind(this)); surface.connect('notify::state', this._onStateNotify.bind(this));
surface.connect('layout', this._onLayoutUpdate.bind(this));
} }
}); });