Skip to content

Commit 98b1749

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

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
@@ -120,6 +120,15 @@
120120
</description>
121121
</request>
122122

123+
<request name="make_monitor_label">
124+
<description summary="makes the surface a monitor label for the given monitor">
125+
Request to make the surface a monitor label for the given monitor. The surface will be placed
126+
in the top left corner of the monitor and will be kept above other surfaces.
127+
</description>
128+
129+
<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
130+
</request>
131+
123132
<request name="focus">
124133
<description summary="request keyboard focus">
125134
Request keyboard focus, taking it away from any other window.

protocol/pantheon-desktop-shell.vapi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ namespace PantheonDesktop {
6969
public void destroy ();
7070
public void set_keep_above ();
7171
public void make_centered ();
72+
public void make_monitor_label (int monitor_index);
7273
public void focus ();
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)