Add tags field to focused_view event
This commit is contained in:
parent
e29d66f1de
commit
16d76ae86c
@ -100,7 +100,7 @@
|
|||||||
</event>
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zriver_seat_status_v1" version="3">
|
<interface name="zriver_seat_status_v1" version="4">
|
||||||
<description summary="track seat focus">
|
<description summary="track seat focus">
|
||||||
This interface allows clients to receive information about the current
|
This interface allows clients to receive information about the current
|
||||||
focus of a seat. Note that (un)focused_output events will only be sent
|
focus of a seat. Note that (un)focused_output events will only be sent
|
||||||
@ -128,13 +128,14 @@
|
|||||||
<arg name="output" type="object" interface="wl_output"/>
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event name="focused_view">
|
<event name="focused_view" since="4">
|
||||||
<description summary="information on the focused view">
|
<description summary="information on the focused view">
|
||||||
Sent once on binding the interface and again whenever the focused
|
Sent once on binding the interface and again whenever the focused
|
||||||
view or a property thereof changes. The title may be an empty string
|
view or a property thereof changes. The title may be an empty string
|
||||||
if no view is focused or the focused view did not set a title.
|
if no view is focused or the focused view did not set a title.
|
||||||
</description>
|
</description>
|
||||||
<arg name="title" type="string" summary="title of the focused view"/>
|
<arg name="title" type="string" summary="title of the focused view"/>
|
||||||
|
<arg name="tags" type="uint" summary="32-bit bitfield"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<event name="mode" since="3">
|
<event name="mode" since="3">
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
const SeatStatus = @This();
|
const SeatStatus = @This();
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
|
|
||||||
const wayland = @import("wayland");
|
const wayland = @import("wayland");
|
||||||
const wl = wayland.server.wl;
|
const wl = wayland.server.wl;
|
||||||
const zriver = wayland.server.zriver;
|
const zriver = wayland.server.zriver;
|
||||||
@ -66,11 +68,15 @@ pub fn sendOutput(seat_status: SeatStatus, output: *Output, state: enum { focuse
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendFocusedView(seat_status: SeatStatus) void {
|
pub fn sendFocusedView(seat_status: SeatStatus) void {
|
||||||
const title: [*:0]const u8 = if (seat_status.seat.focused == .view)
|
if (seat_status.seat_status_v1.getVersion() >= 4) {
|
||||||
seat_status.seat.focused.view.getTitle() orelse ""
|
switch (seat_status.seat.focused) {
|
||||||
else
|
.view => |view| {
|
||||||
"";
|
assert(view.inflight.tags == view.current.tags);
|
||||||
seat_status.seat_status_v1.sendFocusedView(title);
|
seat_status.seat_status_v1.sendFocusedView(view.getTitle() orelse "", view.current.tags);
|
||||||
|
},
|
||||||
|
else => seat_status.seat_status_v1.sendFocusedView("", 0),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendMode(seat_status: SeatStatus, mode: [*:0]const u8) void {
|
pub fn sendMode(seat_status: SeatStatus, mode: [*:0]const u8) void {
|
||||||
|
@ -717,11 +717,11 @@ pub fn unmap(view: *View) void {
|
|||||||
server.root.applyPending();
|
server.root.applyPending();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn notifyTitle(view: *const View) void {
|
pub fn notifyState(view: *const View) void {
|
||||||
if (view.foreign_toplevel_handle.wlr_handle) |wlr_handle| {
|
if (view.foreign_toplevel_handle.wlr_handle) |wlr_handle| {
|
||||||
if (view.getTitle()) |title| wlr_handle.setTitle(title);
|
if (view.getTitle()) |title| wlr_handle.setTitle(title);
|
||||||
}
|
}
|
||||||
// Send title to all status listeners attached to a seat which focuses this view
|
// Send title and tags to all status listeners attached to a seat which focuses this view
|
||||||
var seat_it = server.input_manager.seats.first;
|
var seat_it = server.input_manager.seats.first;
|
||||||
while (seat_it) |seat_node| : (seat_it = seat_node.next) {
|
while (seat_it) |seat_node| : (seat_it = seat_node.next) {
|
||||||
if (seat_node.data.focused == .view and seat_node.data.focused.view == view) {
|
if (seat_node.data.focused == .view and seat_node.data.focused.view == view) {
|
||||||
|
@ -454,7 +454,7 @@ fn handleRequestResize(listener: *wl.Listener(*wlr.XdgToplevel.event.Resize), ev
|
|||||||
/// Called when the client sets / updates its title
|
/// Called when the client sets / updates its title
|
||||||
fn handleSetTitle(listener: *wl.Listener(void)) void {
|
fn handleSetTitle(listener: *wl.Listener(void)) void {
|
||||||
const toplevel = @fieldParentPtr(XdgToplevel, "set_title", listener);
|
const toplevel = @fieldParentPtr(XdgToplevel, "set_title", listener);
|
||||||
toplevel.view.notifyTitle();
|
toplevel.view.notifyState();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when the client sets / updates its app_id
|
/// Called when the client sets / updates its app_id
|
||||||
|
@ -277,7 +277,7 @@ fn handleSetOverrideRedirect(listener: *wl.Listener(void)) void {
|
|||||||
|
|
||||||
fn handleSetTitle(listener: *wl.Listener(void)) void {
|
fn handleSetTitle(listener: *wl.Listener(void)) void {
|
||||||
const xwayland_view = @fieldParentPtr(XwaylandView, "set_title", listener);
|
const xwayland_view = @fieldParentPtr(XwaylandView, "set_title", listener);
|
||||||
xwayland_view.view.notifyTitle();
|
xwayland_view.view.notifyState();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleSetClass(listener: *wl.Listener(void)) void {
|
fn handleSetClass(listener: *wl.Listener(void)) void {
|
||||||
|
Loading…
Reference in New Issue
Block a user