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

@@ -62,7 +62,6 @@ class ClapperPlayerBase extends GstPlayer.Player
this.widget = gtkglsink.widget;
this.widget.vexpand = true;
this.widget.hexpand = true;
this.widget.set_opacity(0);
this.visualization_enabled = false;
@@ -192,6 +191,20 @@ class ClapperPlayerBase extends GstPlayer.Player
break;
}
break;
case 'render-shadows':
let root = this.widget.get_root();
if(root && root.isClapperApp) {
let cssClass = 'gpufriendly';
let renderShadows = settings.get_boolean('render-shadows');
let hasShadows = !root.has_css_class(cssClass);
if(renderShadows === hasShadows)
break;
let action = (renderShadows) ? 'remove' : 'add';
root[action + '_css_class'](cssClass);
}
break;
default:
break;
}