river-status: expose current layout name
This commit is contained in:
parent
8036ae2bd1
commit
b8e2ee2a0c
@ -16,7 +16,7 @@
|
|||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zriver_status_manager_v1" version="3">
|
<interface name="zriver_status_manager_v1" version="4">
|
||||||
<description summary="manage river status objects">
|
<description summary="manage river status objects">
|
||||||
A global factory for objects that receive status information specific
|
A global factory for objects that receive status information specific
|
||||||
to river. It could be used to implement, for example, a status bar.
|
to river. It could be used to implement, for example, a status bar.
|
||||||
@ -47,7 +47,7 @@
|
|||||||
</request>
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zriver_output_status_v1" version="2">
|
<interface name="zriver_output_status_v1" version="4">
|
||||||
<description summary="track output tags and focus">
|
<description summary="track output tags and focus">
|
||||||
This interface allows clients to receive information about the current
|
This interface allows clients to receive information about the current
|
||||||
windowing state of an output.
|
windowing state of an output.
|
||||||
@ -83,6 +83,21 @@
|
|||||||
</description>
|
</description>
|
||||||
<arg name="tags" type="uint" summary="32-bit bitfield"/>
|
<arg name="tags" type="uint" summary="32-bit bitfield"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
<event name="layout_name" since="3">
|
||||||
|
<description summary="name of the layout">
|
||||||
|
Sent once on binding the interface should a layout name exist and again
|
||||||
|
whenever the name changes.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string" summary="layout name"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="layout_name_clear" since="3">
|
||||||
|
<description summary="name of the layout">
|
||||||
|
Sent when the current layout name has been removed without a new one
|
||||||
|
being set, for example whent the active layout generator disconnects.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zriver_seat_status_v1" version="3">
|
<interface name="zriver_seat_status_v1" version="3">
|
||||||
|
@ -161,6 +161,12 @@ fn handleRequest(layout: *river.LayoutV3, request: river.LayoutV3.Request, self:
|
|||||||
// Therefore, simply ignore requests with old/wrong serials.
|
// Therefore, simply ignore requests with old/wrong serials.
|
||||||
if (layout_demand.serial == req.serial) layout_demand.apply(self);
|
if (layout_demand.serial == req.serial) layout_demand.apply(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.output.layout_name) |name| {
|
||||||
|
util.gpa.free(name);
|
||||||
|
}
|
||||||
|
self.output.layout_name = util.gpa.dupeZ(u8, mem.span(req.layout_name)) catch null;
|
||||||
|
self.output.sendLayoutName();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,6 +193,12 @@ pub fn destroy(self: *Self) void {
|
|||||||
self.output.layout_demand = null;
|
self.output.layout_demand = null;
|
||||||
server.root.notifyLayoutDemandDone();
|
server.root.notifyLayoutDemandDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.output.layout_name) |name| {
|
||||||
|
util.gpa.free(name);
|
||||||
|
self.output.layout_name = null;
|
||||||
|
self.output.sendLayoutNameClear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.layout.setHandler(?*anyopaque, handleRequestInert, null, null);
|
self.layout.setHandler(?*anyopaque, handleRequestInert, null, null);
|
||||||
|
@ -88,6 +88,9 @@ layouts: std.TailQueue(Layout) = .{},
|
|||||||
/// Call handleLayoutNamespaceChange() after setting this.
|
/// Call handleLayoutNamespaceChange() after setting this.
|
||||||
layout_namespace: ?[]const u8 = null,
|
layout_namespace: ?[]const u8 = null,
|
||||||
|
|
||||||
|
/// The last set layout name.
|
||||||
|
layout_name: ?[:0]const u8 = null,
|
||||||
|
|
||||||
/// Bitmask that whitelists tags for newly spawned views
|
/// Bitmask that whitelists tags for newly spawned views
|
||||||
spawn_tagmask: u32 = math.maxInt(u32),
|
spawn_tagmask: u32 = math.maxInt(u32),
|
||||||
|
|
||||||
@ -180,6 +183,18 @@ pub fn sendUrgentTags(self: Self) void {
|
|||||||
while (it) |node| : (it = node.next) node.data.sendUrgentTags(urgent_tags);
|
while (it) |node| : (it = node.next) node.data.sendUrgentTags(urgent_tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sendLayoutName(self: Self) void {
|
||||||
|
std.debug.assert(self.layout_name != null);
|
||||||
|
var it = self.status_trackers.first;
|
||||||
|
while (it) |node| : (it = node.next) node.data.sendLayoutName(self.layout_name.?);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sendLayoutNameClear(self: Self) void {
|
||||||
|
std.debug.assert(self.layout_name == null);
|
||||||
|
var it = self.status_trackers.first;
|
||||||
|
while (it) |node| : (it = node.next) node.data.sendLayoutNameClear();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn arrangeFilter(view: *View, filter_tags: u32) bool {
|
pub fn arrangeFilter(view: *View, filter_tags: u32) bool {
|
||||||
return view.surface != null and !view.pending.float and !view.pending.fullscreen and
|
return view.surface != null and !view.pending.float and !view.pending.fullscreen and
|
||||||
view.pending.tags & filter_tags != 0;
|
view.pending.tags & filter_tags != 0;
|
||||||
|
@ -47,6 +47,10 @@ pub fn init(self: *Self, output: *Output, output_status: *zriver.OutputStatusV1)
|
|||||||
if (node.view.current.urgent) urgent_tags |= node.view.current.tags;
|
if (node.view.current.urgent) urgent_tags |= node.view.current.tags;
|
||||||
}
|
}
|
||||||
self.sendUrgentTags(urgent_tags);
|
self.sendUrgentTags(urgent_tags);
|
||||||
|
|
||||||
|
if (output.layout_name) |name| {
|
||||||
|
self.sendLayoutName(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn destroy(self: *Self) void {
|
pub fn destroy(self: *Self) void {
|
||||||
@ -94,3 +98,15 @@ pub fn sendUrgentTags(self: Self, tags: u32) void {
|
|||||||
self.output_status.sendUrgentTags(tags);
|
self.output_status.sendUrgentTags(tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sendLayoutName(self: Self, name: [:0]const u8) void {
|
||||||
|
if (self.output_status.getVersion() >= 4) {
|
||||||
|
self.output_status.sendLayoutName(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sendLayoutNameClear(self: Self) void {
|
||||||
|
if (self.output_status.getVersion() >= 4) {
|
||||||
|
self.output_status.sendLayoutNameClear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user