Skip to content

Commit c85bf6e

Browse files
committed
Add the make_monitor_label method
1 parent 6d112be commit c85bf6e

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

protocol/pantheon-desktop-shell-v1.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,14 @@
128128
by the compositor.
129129
</description>
130130
</request>
131+
132+
<request name="make_monitor_label">
133+
<description summary="makes the surface a monitor label for the given monitor">
134+
Request to make the surface a monitor label for the given monitor. The surface will be placed
135+
in the top left corner of the monitor and will be kept above other surfaces.
136+
</description>
137+
138+
<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
139+
</request>
131140
</interface>
132141
</protocol>

protocol/pantheon-desktop-shell.vapi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@ namespace PantheonDesktop {
7070
public void set_keep_above ();
7171
public void make_centered ();
7272
public void focus ();
73+
public void make_monitor_label (int monitor_index);
7374
}
7475
}

src/ExtendedBehavior.vala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@ public interface PantheonWayland.ExtendedBehavior : Gtk.Widget, Gtk.Native {
7272
}
7373
}
7474

75+
/**
76+
* Tells the wm to make this surface a monitor label. This will cause the surface to be
77+
* positioned in the top left corner of the given monitor. The surface will also be kept
78+
* above other surfaces.
79+
* Should only be called after {@link connect_to_shell}.
80+
*
81+
* @param monitor_index the index of the monitor this surface will label
82+
*/
83+
public void make_monitor_label (int monitor_index) {
84+
unowned PantheonDesktop.ExtendedBehavior? extended_behavior = get_data ("-pantheon-wayland-extended-behavior");
85+
if (extended_behavior != null) {
86+
extended_behavior.make_monitor_label (monitor_index);
87+
} else {
88+
warning ("Couldn't make monitor label: ExtendedBehavior surface was null. Did you forget to call connect_to_shell?");
89+
}
90+
}
91+
7592
/**
7693
* Tells the wm to give this surface keyboard focus.
7794
* Should only be called after {@link connect_to_shell}.

0 commit comments

Comments
 (0)