git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit6a61b9cebb3586418fa7d5ac882221e761e329cf
parent65e5766ecf
authorIsaac Freund <[email protected]>
date2021-06-08 02:55
view: get rid of notifyConfiguredOrApplyPending()

This function is only called in one place, just inline the code.

 river/View.zig        | 16 ----------------
 river/XdgToplevel.zig | 14 +++++++++++++-
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/river/View.zig b/river/View.zig
index 3c6f4f2..9329827 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -273,22 +273,6 @@ pub fn saveBuffers(self: *Self) void {
     self.surface.?.forEachSurface(*std.ArrayList(SavedBuffer), saveBuffersIterator, &self.saved_buffers);
 }
 
-/// If this commit is in response to our configure and the
-/// transaction code is tracking this configure, notify it.
-/// Otherwise, apply the pending state immediately.
-pub fn notifyConfiguredOrApplyPending(self: *Self) void {
-    self.pending_serial = null;
-    if (self.shouldTrackConfigure()) {
-        server.root.notifyConfigured();
-    } else {
-        const self_tags_changed = self.pending.tags != self.current.tags;
-        self.current = self.pending;
-        self.commitOpacityTransition();
-        if (self_tags_changed) self.output.sendViewTags();
-        self.output.damage.addWhole();
-    }
-}
-
 fn saveBuffersIterator(
     surface: *wlr.Surface,
     surface_x: c_int,
diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig
index 39b2dc1..e74fcb2 100644
--- a/river/XdgToplevel.zig
+++ b/river/XdgToplevel.zig
@@ -261,7 +261,19 @@ fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) voi
         view.surface_box = new_box;
 
         if (s == self.xdg_surface.configure_serial) {
-            view.notifyConfiguredOrApplyPending();
+            // If this commit is in response to our configure and the
+            // transaction code is tracking this configure, notify it.
+            // Otherwise, apply the pending state immediately.
+            view.pending_serial = null;
+            if (view.shouldTrackConfigure()) {
+                server.root.notifyConfigured();
+            } else {
+                const self_tags_changed = view.pending.tags != view.current.tags;
+                view.current = view.pending;
+                view.commitOpacityTransition();
+                if (self_tags_changed) view.output.sendViewTags();
+                view.output.damage.addWhole();
+            }
         } else {
             // If the client has not yet acked our configure, we need to send a
             // frame done event so that it commits another buffer. These