tony / oxwm

cursor test Browse files
tonybtw committed 2025-10-12 parent b407c91 commit 820f2c6c1a8c59f2880688496c7f438121c391ca
Showing 3 changed files with 25 additions and 11 deletions. UnifiedSplit
+8 −1 Cargo.lock
@@ -213,7 +213,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
213 213
214 214 [[package]]
215 215 name = "oxwm"
216 -version = "0.1.0"
216 +version = "0.1.1"
217 217 dependencies = [
218 218 "anyhow",
219 219 "chrono",
@@ -601,6 +601,7 @@ dependencies = [
601 601 "gethostname",
602 602 "rustix",
603 603 "x11rb-protocol",
604 + "xcursor",
604 605 ]
605 606
606 607 [[package]]
@@ -608,3 +609,9 @@ name = "x11rb-protocol"
608 609 version = "0.13.2"
609 610 source = "registry+https://github.com/rust-lang/crates.io-index"
610 611 checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
612 +
613 +[[package]]
614 +name = "xcursor"
615 +version = "0.3.10"
616 +source = "registry+https://github.com/rust-lang/crates.io-index"
617 +checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b"
+3 −2 Cargo.toml
@@ -1,6 +1,6 @@
1 1 [package]
2 2 name = "oxwm"
3 -version = "0.1.0"
3 +version = "0.1.1"
4 4 edition = "2024"
5 5
6 6 [lib]
@@ -13,7 +13,8 @@ path = "src/bin/main.rs"
13 13
14 14 [dependencies]
15 15 x11 = { version = "2.21", features = ["xlib", "xft"] }
16 -x11rb = "0.13"
16 +x11rb = { version = "0.13", features = ["cursor"] }
17 17 anyhow = "1"
18 18 chrono = "0.4"
19 19 dirs = "5.0"
20 +# xcursor-rs = "0.1"
+14 −8 src/window_manager.rs
@@ -4,10 +4,10 @@ use crate::keyboard::{self, Arg, KeyAction};
4 4 use crate::layout::GapConfig;
5 5 use crate::layout::Layout;
6 6 use crate::layout::tiling::TilingLayout;
7 -
8 7 use anyhow::Result;
9 8 use std::collections::HashSet;
10 9 use std::path::PathBuf;
10 +use x11rb::cursor::Handle as CursorHandle;
11 11
12 12 use x11rb::connection::Connection;
13 13 use x11rb::protocol::Event;
@@ -42,16 +42,22 @@ impl WindowManager {
42 42 let root = connection.setup().roots[screen_number].root;
43 43 let screen = connection.setup().roots[screen_number].clone();
44 44
45 + let cursor_handle =
46 + CursorHandle::new(&connection, screen_number, &Default::default())?.reply()?;
47 + let normal_cursor = cursor_handle.load_cursor(&connection, "left_ptr")?;
48 +
45 49 connection
46 50 .change_window_attributes(
47 51 root,
48 - &ChangeWindowAttributesAux::new().event_mask(
49 - EventMask::SUBSTRUCTURE_REDIRECT
50 - | EventMask::SUBSTRUCTURE_NOTIFY
51 - | EventMask::PROPERTY_CHANGE
52 - | EventMask::KEY_PRESS
53 - | EventMask::BUTTON_PRESS,
54 - ),
52 + &ChangeWindowAttributesAux::new()
53 + .cursor(normal_cursor)
54 + .event_mask(
55 + EventMask::SUBSTRUCTURE_REDIRECT
56 + | EventMask::SUBSTRUCTURE_NOTIFY
57 + | EventMask::PROPERTY_CHANGE
58 + | EventMask::KEY_PRESS
59 + | EventMask::BUTTON_PRESS,
60 + ),
55 61 )?
56 62 .check()?;
57 63