mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 15:15:39 +03:00
Make dimming optional
This commit is contained in:
parent
dd03b3afde
commit
7481383314
@ -115,6 +115,8 @@
|
||||
<description summary="requests to make a surface system modal">
|
||||
This will block all user input outside the surface and most system shortcuts.
|
||||
</description>
|
||||
|
||||
<arg name="dim" type="uint" summary="1 to dim, 0 to not dim"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
@ -76,7 +76,7 @@ namespace Pantheon.Desktop {
|
||||
[CCode (has_target = false, has_typedef = false)]
|
||||
public delegate void SetKeepAbove (Wl.Client client, Wl.Resource resource);
|
||||
[CCode (has_target = false, has_typedef = false)]
|
||||
public delegate void MakeModal (Wl.Client client, Wl.Resource resource);
|
||||
public delegate void MakeModal (Wl.Client client, Wl.Resource resource, uint dim);
|
||||
[CCode (has_target = false, has_typedef = false)]
|
||||
public delegate void Destroy (Wl.Client client, Wl.Resource resource);
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ namespace Gala {
|
||||
window.make_above ();
|
||||
}
|
||||
|
||||
internal static void make_modal (Wl.Client client, Wl.Resource resource) {
|
||||
internal static void make_modal (Wl.Client client, Wl.Resource resource, uint dim) {
|
||||
unowned ExtendedBehaviorSurface? eb_surface = resource.get_user_data<ExtendedBehaviorSurface> ();
|
||||
if (eb_surface.wayland_surface == null) {
|
||||
warning ("Window tried to make modal but wayland surface is null.");
|
||||
@ -342,7 +342,7 @@ namespace Gala {
|
||||
return;
|
||||
}
|
||||
|
||||
ShellClientsManager.get_instance ().make_modal (window);
|
||||
ShellClientsManager.get_instance ().make_modal (window, dim == 1);
|
||||
}
|
||||
|
||||
internal static void destroy_panel_surface (Wl.Client client, Wl.Resource resource) {
|
||||
|
@ -144,7 +144,8 @@ public class Gala.ShellClientsManager : Object {
|
||||
windows[window].set_hide_mode (hide_mode);
|
||||
}
|
||||
|
||||
public void make_modal (Meta.Window window) {
|
||||
public void make_modal (Meta.Window window, bool dim) {
|
||||
wm.modal_actor.make_modal (window);
|
||||
wm.modal_actor.dim = dim;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,16 @@
|
||||
public class Gala.ModalActor : Clutter.Actor {
|
||||
public Meta.Display display { get; construct; }
|
||||
|
||||
public bool dim {
|
||||
set {
|
||||
if (value) {
|
||||
background_color = { 0, 0, 0, 200 };
|
||||
} else {
|
||||
background_color = { 0, 0, 0, 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int modal_dialogs = 0;
|
||||
|
||||
public ModalActor (Meta.Display display) {
|
||||
@ -59,6 +69,10 @@
|
||||
|
||||
private void check_visible () {
|
||||
visible = modal_dialogs > 0;
|
||||
|
||||
if (visible) {
|
||||
get_parent ().set_child_above_sibling (this, null);
|
||||
}
|
||||
}
|
||||
|
||||
public bool is_modal () {
|
||||
|
Loading…
Reference in New Issue
Block a user