mirror of
https://github.com/elementary/gala.git
synced 2024-08-15 18:10:39 +03:00
WindowManager: dim parents of modals (#1285)
This commit is contained in:
parent
65da8f7767
commit
de1b897bab
@ -16,6 +16,7 @@
|
||||
<ul>
|
||||
<li>Support for high-resolution scroll events</li>
|
||||
<li>Redesigned Alt + Tab switcher</li>
|
||||
<li>Dim the parents of modal dialogs</li>
|
||||
<li>Updated translations</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
@ -183,10 +183,6 @@
|
||||
<summary>Arrangement of buttons on the titlebar</summary>
|
||||
<description>Arrangement of buttons on the titlebar. The value should be a string, such as "menu:minimize,maximize,spacer,close"; the colon separates the left corner of the window from the right corner, and the button names are comma-separated. Duplicate buttons are not allowed. Unknown button names are silently ignored so that buttons can be added in future metacity versions without breaking older versions. A special spacer tag can be used to insert some space between two adjacent buttons.</description>
|
||||
</key>
|
||||
<key type="b" name="dim-parents">
|
||||
<default>false</default>
|
||||
<summary>Dims parent windows when spawning modal dialogs</summary>
|
||||
</key>
|
||||
<key type="d" name="alt-tab-window-opacity">
|
||||
<range min="0.0" max="1.0"/>
|
||||
<default>0.0</default>
|
||||
|
@ -722,15 +722,21 @@ namespace Gala {
|
||||
out x, out y);
|
||||
}
|
||||
|
||||
public void dim_window (Meta.Window window, bool dim) {
|
||||
/*FIXME we need a super awesome blureffect here, the one from clutter is just... bah!
|
||||
var win = window.get_compositor_private () as Meta.WindowActor;
|
||||
if (dim) {
|
||||
if (win.has_effects ())
|
||||
return;
|
||||
win.add_effect_with_name ("darken", new Clutter.BlurEffect ());
|
||||
} else
|
||||
win.clear_effects ();*/
|
||||
private void toggle_dim_parent (Meta.Window window) {
|
||||
if (window.window_type == Meta.WindowType.MODAL_DIALOG) {
|
||||
var ancestor = window.find_root_ancestor ();
|
||||
if (ancestor != null && ancestor != window) {
|
||||
var win = (Meta.WindowActor) ancestor.get_compositor_private ();
|
||||
if (win.has_effects ()) {
|
||||
win.clear_effects ();
|
||||
} else {
|
||||
var dark_effect = new Clutter.BrightnessContrastEffect ();
|
||||
dark_effect.set_brightness (-0.4f);
|
||||
|
||||
win.add_effect (dark_effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1381,11 +1387,7 @@ namespace Gala {
|
||||
}
|
||||
});
|
||||
|
||||
var appearance_settings = new GLib.Settings (Config.SCHEMA + ".appearance");
|
||||
if (appearance_settings.get_boolean ("dim-parents") &&
|
||||
window.window_type == Meta.WindowType.MODAL_DIALOG &&
|
||||
window.is_attached_dialog ())
|
||||
dim_window (window.find_root_ancestor (), true);
|
||||
toggle_dim_parent (window);
|
||||
|
||||
break;
|
||||
case Meta.WindowType.NOTIFICATION:
|
||||
@ -1463,7 +1465,7 @@ namespace Gala {
|
||||
destroy_completed (actor);
|
||||
});
|
||||
|
||||
dim_window (window.find_root_ancestor (), false);
|
||||
toggle_dim_parent (window);
|
||||
|
||||
break;
|
||||
case Meta.WindowType.MENU:
|
||||
|
Loading…
Reference in New Issue
Block a user