oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

cursor test

Commit
820f2c6c1a8c59f2880688496c7f438121c391ca
Parent
b407c91
Author
tonybtw <tonybtw@tonybtw.com>
Date
2025-10-12 08:10:54

Diff

diff --git a/Cargo.lock b/Cargo.lock
index fd7f154..f9e06ef 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -213,7 +213,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
 
 [[package]]
 name = "oxwm"
-version = "0.1.0"
+version = "0.1.1"
 dependencies = [
  "anyhow",
  "chrono",
@@ -601,6 +601,7 @@ dependencies = [
  "gethostname",
  "rustix",
  "x11rb-protocol",
+ "xcursor",
 ]
 
 [[package]]
@@ -608,3 +609,9 @@ name = "x11rb-protocol"
 version = "0.13.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
+
+[[package]]
+name = "xcursor"
+version = "0.3.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b"
diff --git a/Cargo.toml b/Cargo.toml
index bb57ae3..577ea56 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "oxwm"
-version = "0.1.0"
+version = "0.1.1"
 edition = "2024"
 
 [lib]
@@ -13,7 +13,8 @@ path = "src/bin/main.rs"
 
 [dependencies]
 x11 = { version = "2.21", features = ["xlib", "xft"] }
-x11rb = "0.13"
+x11rb = { version = "0.13", features = ["cursor"] }
 anyhow = "1"
 chrono = "0.4"
 dirs = "5.0"
+# xcursor-rs = "0.1"
diff --git a/src/window_manager.rs b/src/window_manager.rs
index 07eda6a..692e017 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -4,10 +4,10 @@ use crate::keyboard::{self, Arg, KeyAction};
 use crate::layout::GapConfig;
 use crate::layout::Layout;
 use crate::layout::tiling::TilingLayout;
-
 use anyhow::Result;
 use std::collections::HashSet;
 use std::path::PathBuf;
+use x11rb::cursor::Handle as CursorHandle;
 
 use x11rb::connection::Connection;
 use x11rb::protocol::Event;
@@ -42,16 +42,22 @@ impl WindowManager {
         let root = connection.setup().roots[screen_number].root;
         let screen = connection.setup().roots[screen_number].clone();
 
+        let cursor_handle =
+            CursorHandle::new(&connection, screen_number, &Default::default())?.reply()?;
+        let normal_cursor = cursor_handle.load_cursor(&connection, "left_ptr")?;
+
         connection
             .change_window_attributes(
                 root,
-                &ChangeWindowAttributesAux::new().event_mask(
-                    EventMask::SUBSTRUCTURE_REDIRECT
-                        | EventMask::SUBSTRUCTURE_NOTIFY
-                        | EventMask::PROPERTY_CHANGE
-                        | EventMask::KEY_PRESS
-                        | EventMask::BUTTON_PRESS,
-                ),
+                &ChangeWindowAttributesAux::new()
+                    .cursor(normal_cursor)
+                    .event_mask(
+                        EventMask::SUBSTRUCTURE_REDIRECT
+                            | EventMask::SUBSTRUCTURE_NOTIFY
+                            | EventMask::PROPERTY_CHANGE
+                            | EventMask::KEY_PRESS
+                            | EventMask::BUTTON_PRESS,
+                    ),
             )?
             .check()?;