Performance: add option to disable window shadows

Rendering window shadows in GTK4 doubles GPU usage. This commit adds an option to disable them for performance gain (useful on low-end devices).
This commit is contained in:
Rafostar
2020-11-13 19:26:49 +01:00
parent 4413fdb8a2
commit f660d900ba
8 changed files with 68 additions and 13 deletions

View File

@@ -52,8 +52,14 @@ var Widget = GObject.registerClass({
this.revealerBottom = new Revealers.RevealerBottom();
this.controls = new Controls();
this.controlsBox = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
});
this.controlsBox.add_css_class('controlsbox');
this.controlsBox.append(this.controls);
this.attach(this.overlay, 0, 0, 1, 1);
this.attach(this.controls, 0, 1, 1, 1);
this.attach(this.controlsBox, 0, 1, 1, 1);
this.mapSignal = this.connect('map', this._onMap.bind(this));
@@ -101,7 +107,7 @@ var Widget = GObject.registerClass({
let root = this.get_root();
let action = (isFullscreen) ? 'add' : 'remove';
root[action + '_css_class']('gpufriendly');
root[action + '_css_class']('gpufriendlyfs');
if(!this.floatingMode)
this._changeControlsPlacement(isFullscreen);
@@ -185,12 +191,12 @@ var Widget = GObject.registerClass({
_changeControlsPlacement(isOnTop)
{
if(isOnTop) {
this.remove(this.controls);
this.controlsBox.remove(this.controls);
this.revealerBottom.append(this.controls);
}
else {
this.revealerBottom.remove(this.controls);
this.attach(this.controls, 0, 1, 1, 1);
this.controlsBox.append(this.controls);
}
}