diff --git a/protocol/pantheon-desktop-shell-v1.xml b/protocol/pantheon-desktop-shell-v1.xml index bedbcaf..8b0183e 100644 --- a/protocol/pantheon-desktop-shell-v1.xml +++ b/protocol/pantheon-desktop-shell-v1.xml @@ -128,5 +128,14 @@ by the compositor. + + + + Request to make the surface a monitor label for the given monitor. The surface will be placed + in the top left corner of the monitor and will be kept above other surfaces. + + + + diff --git a/protocol/pantheon-desktop-shell.vapi b/protocol/pantheon-desktop-shell.vapi index 5a6fd47..c5888da 100644 --- a/protocol/pantheon-desktop-shell.vapi +++ b/protocol/pantheon-desktop-shell.vapi @@ -70,5 +70,6 @@ namespace PantheonDesktop { public void set_keep_above (); public void make_centered (); public void focus (); + public void make_monitor_label (int monitor_index); } } diff --git a/src/ExtendedBehavior.vala b/src/ExtendedBehavior.vala index 2ebb717..aa25e8c 100644 --- a/src/ExtendedBehavior.vala +++ b/src/ExtendedBehavior.vala @@ -84,4 +84,22 @@ 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 surface a monitor label. This will cause the surface to be + * positioned in the top left corner of the given monitor. The surface will also be kept + * above other surfaces. + * Should only be called after {@link connect_to_shell}. + * + * @param monitor_index the index of the monitor this surface will label + */ + public void make_monitor_label (int monitor_index) { + unowned PantheonDesktop.ExtendedBehavior? extended_behavior = get_data ("-pantheon-wayland-extended-behavior"); + if (extended_behavior == null) { + warning ("Couldn't make monitor label: ExtendedBehavior surface was null. Did you forget to call connect_to_shell?"); + return; + } + + extended_behavior.make_monitor_label (monitor_index); + } }