Skip to content

Commit a00135a

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

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,22 @@ public interface PantheonWayland.ExtendedBehavior : Gtk.Widget, Gtk.Native {
8484
warning ("Couldn't focus: ExtendedBehavior surface was null. Did you forget to call connect_to_shell?");
8585
}
8686
}
87+
88+
/**
89+
* Tells the wm to make this surface a monitor label. This will cause the surface to be
90+
* positioned in the top left corner of the given monitor. The surface will also be kept
91+
* above other surfaces.
92+
* Should only be called after {@link connect_to_shell}.
93+
*
94+
* @param monitor_index the index of the monitor this surface will label
95+
*/
96+
public void make_monitor_label (int monitor_index) {
97+
unowned PantheonDesktop.ExtendedBehavior? extended_behavior = get_data ("-pantheon-wayland-extended-behavior");
98+
if (extended_behavior == null) {
99+
warning ("Couldn't make monitor label: ExtendedBehavior surface was null. Did you forget to call connect_to_shell?");
100+
return;
101+
}
102+
103+
extended_behavior.make_monitor_label (monitor_index);
104+
}
87105
}

0 commit comments

Comments
 (0)