2zw

2zw - X11 Windowmanager

Files | Log | Commits | Refs | README


59524e1

Author: erikbackman

Date: 2024-03-04

Subject: remove focus on click for now, it's not working as intended

Diff

commit 59524e157f80d69bc8daa7321211e54fcf789b61
Author: erikbackman <erikbackman@users.noreply.github.com>
Date:   Mon Mar 4 19:12:47 2024 +0100

    remove focus on click for now, it's not working as intended

diff --git a/src/main.zig b/src/main.zig
index 3d06e5c..3452501 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -47,7 +47,6 @@ fn grabInput(window: C.Window) void {
     for ([_]u8{ 1, 3 }) |btn| {
         _ = C.XGrabButton(display, btn, C.Mod4Mask, root, 0, C.ButtonPressMask | C.ButtonReleaseMask | C.PointerMotionMask, C.GrabModeAsync, C.GrabModeAsync, 0, 0);
     }
-    _ = C.XGrabButton(display, 1, 0, root, 0, C.ButtonPressMask | C.ButtonReleaseMask, C.GrabModeSync, C.GrabModeAsync, 0, 0);
 }
 
 // Application state
@@ -258,16 +257,14 @@ fn onButtonPress(e: *C.XEvent) void {
     win_y = attributes.y;
     mouse = e.xbutton;
 
-    if (winToNode(e.xbutton.subwindow)) |node| if (node != cursor) focus(node);
-    _ = C.XAllowEvents(display, C.ReplayPointer, e.xbutton.time);
-    _ = C.XSync(display, 0);
+    if (winToNode(e.xbutton.subwindow)) |node| if (node != cursor) {
+        focus(node);
+    };
 }
 
 fn onNotifyMotion(e: *C.XEvent) void {
     if (mouse.subwindow == 0) return;
 
-    while (C.XCheckTypedEvent(display, C.MotionNotify, e) == @as(c_int, @intCast(1))) {}
-
     const dx: i32 = @intCast(e.xbutton.x_root - mouse.x_root);
     const dy: i32 = @intCast(e.xbutton.y_root - mouse.y_root);