Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions protocol/pantheon-desktop-shell-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,13 @@
by the compositor.
</description>
</request>

<request name="make_modal">
<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>
1 change: 1 addition & 0 deletions protocol/pantheon-desktop-shell.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ namespace PantheonDesktop {
public void set_keep_above ();
public void make_centered ();
public void focus ();
public void make_modal (uint dim);
}
}
17 changes: 17 additions & 0 deletions src/ExtendedBehavior.vala
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,21 @@ public interface PantheonWayland.ExtendedBehavior : Gtk.Widget, Gtk.Native {
warning ("Couldn't focus: ExtendedBehavior surface was null. Did you forget to call connect_to_shell?");
}
}

/**
* Tells the wm to make this window modal. The window will be displayed above
* all other windows. All user input outside this window and most system shortcuts
* will be blocked until this window is closed.
* If dim is true the background will be dimmed.
* This should only be called after {@link connect_to_shell}.
* This is only allowed for centered windows, so {@link make_centered} has to be called first.
*/
public void make_modal (bool dim) {
unowned PantheonDesktop.ExtendedBehavior? extended_behavior = get_data ("-pantheon-wayland-extended-behavior");
if (extended_behavior != null) {
extended_behavior.make_modal ((uint) dim);
} else {
warning ("Couldn't make modal: ExtendedBehavior surface was null. Did you forget to call connect_to_shell?");
}
}
}