From 8a3530b8a3d75aaa294d5cca718fc955d409f598 Mon Sep 17 00:00:00 2001
From: Hugo Machet <mail@hmachet.com>
Date: Thu, 12 Jan 2023 16:29:02 +0100
Subject: [PATCH] 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.
---
 river/View.zig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/river/View.zig b/river/View.zig
index 56740f8..e666265 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -551,14 +551,14 @@ pub fn unmap(self: *Self) void {
     server.root.startTransaction();
 }
 
-pub fn notifyTitle(self: Self) void {
+pub fn notifyTitle(self: *const Self) void {
     if (self.foreign_toplevel_handle) |handle| {
         if (self.getTitle()) |s| handle.setTitle(s);
     }
     // Send title to all status listeners attached to a seat which focuses this view
     var seat_it = server.input_manager.seats.first;
     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;
             while (client_it) |client_node| : (client_it = client_node.next) {
                 client_node.data.sendFocusedView();