2zw

2zw - X11 Windowmanager

Files | Log | Commits | Refs | README


948ab93

Author: erikbackman

Date: 2024-02-22

Subject: handle send_event on unmapNotify, unsure if this makes sense..

Diff

commit 948ab936a3cc16a32776c1efe814758a57d1d604
Author: erikbackman <erikbackman@users.noreply.github.com>
Date:   Thu Feb 22 23:03:03 2024 +0100

    handle send_event on unmapNotify, unsure if this makes sense..

diff --git a/src/main.zig b/src/main.zig
index ed5a86d..0134c69 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -238,7 +238,21 @@ fn onUnmapNotify(allocator: std.mem.Allocator, e: *C.XEvent) void {
     const ev = &e.xunmap;
     if (winToNode(ev.window)) |node| {
         if (ev.send_event == 1) {
-            // TODO: handle this
+            // INVESTIGATE: Is this what we want to do?
+            const data = [_]c_long{ C.WithdrawnState, C.None };
+            // Data Format: Specifies whether the  data should be viewed  as a list
+            // of  8-bit,  16-bit,  or  32-bit  quantities.
+            const data_format = 32;
+            _ = C.XChangeProperty(
+                display,
+                node.data.w,
+                C.XInternAtom(display, "WM_STATE", 0),
+                C.XInternAtom(display, "WM_STATE", 0),
+                data_format,
+                C.PropModeReplace,
+                @ptrCast(&data),
+                data.len,
+            );
         } else {
             unmanage(allocator, node, false);
         }