View: fix pointer comparison in notifyTitle()

Curently since the struct is semantically passed by value not reference,
there is no guarantee that the `seat_node.data.focused.view == &self`
comparison will work as intended. Since updating to Zig 0.10.0, it seems
this latent bug has now manifested and the focused view title is no
longer sent to the client when it changes.

Fix this by taking the view argument by constant pointer instead.
This commit is contained in:
Hugo Machet 2023-01-12 16:29:02 +01:00 committed by Isaac Freund
parent 6fdfb7134f
commit 8a3530b8a3
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -551,14 +551,14 @@ pub fn unmap(self: *Self) void {
server.root.startTransaction(); server.root.startTransaction();
} }
pub fn notifyTitle(self: Self) void { pub fn notifyTitle(self: *const Self) void {
if (self.foreign_toplevel_handle) |handle| { if (self.foreign_toplevel_handle) |handle| {
if (self.getTitle()) |s| handle.setTitle(s); if (self.getTitle()) |s| handle.setTitle(s);
} }
// Send title to all status listeners attached to a seat which focuses this view // Send title 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 == &self) { if (seat_node.data.focused == .view and seat_node.data.focused.view == self) {
var client_it = seat_node.data.status_trackers.first; var client_it = seat_node.data.status_trackers.first;
while (client_it) |client_node| : (client_it = client_node.next) { while (client_it) |client_node| : (client_it = client_node.next) {
client_node.data.sendFocusedView(); client_node.data.sendFocusedView();