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
9 changes: 9 additions & 0 deletions protocol/pantheon-desktop-shell-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,14 @@
by the compositor.
</description>
</request>

<request name="make_monitor_label">
<description summary="makes the surface a monitor label for the given monitor">
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.
</description>

<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
</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_monitor_label (int monitor_index);
}
}
18 changes: 18 additions & 0 deletions src/ExtendedBehavior.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}