WM: Drop Meta.ShadowFactory (#1625)

This commit is contained in:
Leo 2023-04-07 07:54:02 +09:00 committed by GitHub
parent fb2d244112
commit ca807c669f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 68 deletions

View File

@ -275,27 +275,27 @@
<key type="as" name="normal-focused"> <key type="as" name="normal-focused">
<default>['20', '-1', '0', '15', '100']</default> <default>['20', '-1', '0', '15', '100']</default>
<summary>Defines the shadow of normal focused windows</summary> <summary>Defines the shadow of normal focused windows</summary>
<description>The first value is the radius of the blur of the shadow, the second one the top fade (which is usually just -1), the third and fourth the x- and y-offset and the last the opacity. So [blur-radius, top-fade, x-offset, y-offset, opacity].</description> <description>DEPRECATED: This key is deprecated and ignored.</description>
</key> </key>
<key type="as" name="normal-unfocused"> <key type="as" name="normal-unfocused">
<default>['6', '-1', '0', '4', '80']</default> <default>['6', '-1', '0', '4', '80']</default>
<summary>Defines the shadow of a normal unfocused window</summary> <summary>Defines the shadow of a normal unfocused window</summary>
<description>See normal-focused.</description> <description>DEPRECATED: This key is deprecated and ignored.</description>
</key> </key>
<key type="as" name="menu"> <key type="as" name="menu">
<default>['6', '-1', '0', '4', '80']</default> <default>['6', '-1', '0', '4', '80']</default>
<summary>Defines the shadow of a menu</summary> <summary>Defines the shadow of a menu</summary>
<description>See normal-focused.</description> <description>DEPRECATED: This key is deprecated and ignored.</description>
</key> </key>
<key type="as" name="dialog-focused"> <key type="as" name="dialog-focused">
<default>['12', '-1', '0', '4', '100']</default> <default>['12', '-1', '0', '4', '100']</default>
<summary>Defines the shadow of a focused dialog</summary> <summary>Defines the shadow of a focused dialog</summary>
<description>See normal-focused.</description> <description>DEPRECATED: This key is deprecated and ignored.</description>
</key> </key>
<key type="as" name="dialog-unfocused"> <key type="as" name="dialog-unfocused">
<default>['6', '-1', '0', '4', '80']</default> <default>['6', '-1', '0', '4', '80']</default>
<summary>Defines the shadow of an unfocused dialog</summary> <summary>Defines the shadow of an unfocused dialog</summary>
<description>See normal-focused.</description> <description>DEPRECATED: This key is deprecated and ignored.</description>
</key> </key>
</schema> </schema>

View File

@ -28,64 +28,6 @@ namespace Gala {
&& Meta.Prefs.get_workspaces_only_on_primary (); && Meta.Prefs.get_workspaces_only_on_primary ();
} }
private static GLib.Settings? shadow_settings = null;
/*
* Reload shadow settings
*/
public static void reload_shadow () {
if (shadow_settings == null) {
shadow_settings = new GLib.Settings (Config.SCHEMA + ".shadows");
}
var factory = Meta.ShadowFactory.get_default ();
Meta.ShadowParams shadow;
//normal focused
shadow = get_shadowparams ("normal-focused");
factory.set_params ("normal", true, shadow);
//normal unfocused
shadow = get_shadowparams ("normal-unfocused");
factory.set_params ("normal", false, shadow);
//menus
shadow = get_shadowparams ("menu");
factory.set_params ("menu", false, shadow);
factory.set_params ("dropdown-menu", false, shadow);
factory.set_params ("popup-menu", false, shadow);
//dialog focused
shadow = get_shadowparams ("dialog-focused");
factory.set_params ("dialog", true, shadow);
factory.set_params ("modal_dialog", false, shadow);
//dialog unfocused
shadow = get_shadowparams ("dialog-unfocused");
factory.set_params ("dialog", false, shadow);
factory.set_params ("modal_dialog", false, shadow);
}
private static Meta.ShadowParams get_shadowparams (string class_name) {
var val = shadow_settings.get_strv (class_name);
if (val == null || val.length != 5 || int.parse (val[0]) < 1) {
warning ("Invalid shadow settings");
return Meta.ShadowParams () {
radius = 1,
top_fade = 0,
x_offset = 0,
y_offset = 0,
opacity = 0
};
}
return Meta.ShadowParams () {
radius = int.parse (val[0]),
top_fade = int.parse (val[1]),
x_offset = int.parse (val[2]),
y_offset = int.parse (val[3]),
opacity = (uint8)int.parse (val[4])
};
}
/** /**
* set the area where clutter can receive events * set the area where clutter can receive events
**/ **/

View File

@ -280,11 +280,6 @@ namespace Gala {
Meta.KeyBinding.set_custom_handler ("move-to-workspace-left", (Meta.KeyHandlerFunc) handle_move_to_workspace); Meta.KeyBinding.set_custom_handler ("move-to-workspace-left", (Meta.KeyHandlerFunc) handle_move_to_workspace);
Meta.KeyBinding.set_custom_handler ("move-to-workspace-right", (Meta.KeyHandlerFunc) handle_move_to_workspace); Meta.KeyBinding.set_custom_handler ("move-to-workspace-right", (Meta.KeyHandlerFunc) handle_move_to_workspace);
/*shadows*/
InternalUtils.reload_shadow ();
var shadow_settings = new GLib.Settings (Config.SCHEMA + ".shadows");
shadow_settings.changed.connect (InternalUtils.reload_shadow);
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager (); unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.connect (on_monitors_changed); monitor_manager.monitors_changed.connect (on_monitors_changed);