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 [[package]] 214 [[package]]
215 name = "oxwm" 215 name = "oxwm"
216 -version = "0.1.0" 216 +version = "0.1.1"
217 dependencies = [ 217 dependencies = [
218 "anyhow", 218 "anyhow",
219 "chrono", 219 "chrono",
@@ -601,6 +601,7 @@ dependencies = [
601 "gethostname", 601 "gethostname",
602 "rustix", 602 "rustix",
603 "x11rb-protocol", 603 "x11rb-protocol",
604 + "xcursor",
604 ] 605 ]
605 606
606 [[package]] 607 [[package]]
@@ -608,3 +609,9 @@ name = "x11rb-protocol"
608 version = "0.13.2" 609 version = "0.13.2"
609 source = "registry+https://github.com/rust-lang/crates.io-index" 610 source = "registry+https://github.com/rust-lang/crates.io-index"
610 checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" 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 [package] 1 [package]
2 name = "oxwm" 2 name = "oxwm"
3 -version = "0.1.0" 3 +version = "0.1.1"
4 edition = "2024" 4 edition = "2024"
5 5
6 [lib] 6 [lib]
@@ -13,7 +13,8 @@ path = "src/bin/main.rs"
13 13
14 [dependencies] 14 [dependencies]
15 x11 = { version = "2.21", features = ["xlib", "xft"] } 15 x11 = { version = "2.21", features = ["xlib", "xft"] }
16 -x11rb = "0.13" 16 +x11rb = { version = "0.13", features = ["cursor"] }
17 anyhow = "1" 17 anyhow = "1"
18 chrono = "0.4" 18 chrono = "0.4"
19 dirs = "5.0" 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 use crate::layout::GapConfig; 4 use crate::layout::GapConfig;
5 use crate::layout::Layout; 5 use crate::layout::Layout;
6 use crate::layout::tiling::TilingLayout; 6 use crate::layout::tiling::TilingLayout;
7 -
8 use anyhow::Result; 7 use anyhow::Result;
9 use std::collections::HashSet; 8 use std::collections::HashSet;
10 use std::path::PathBuf; 9 use std::path::PathBuf;
10 +use x11rb::cursor::Handle as CursorHandle;
11 11
12 use x11rb::connection::Connection; 12 use x11rb::connection::Connection;
13 use x11rb::protocol::Event; 13 use x11rb::protocol::Event;
@@ -42,16 +42,22 @@ impl WindowManager {
42 let root = connection.setup().roots[screen_number].root; 42 let root = connection.setup().roots[screen_number].root;
43 let screen = connection.setup().roots[screen_number].clone(); 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 connection 49 connection
46 .change_window_attributes( 50 .change_window_attributes(
47 root, 51 root,
48 - &ChangeWindowAttributesAux::new().event_mask( 52 + &ChangeWindowAttributesAux::new()
49 - EventMask::SUBSTRUCTURE_REDIRECT 53 + .cursor(normal_cursor)
50 - | EventMask::SUBSTRUCTURE_NOTIFY 54 + .event_mask(
51 - | EventMask::PROPERTY_CHANGE 55 + EventMask::SUBSTRUCTURE_REDIRECT
52 - | EventMask::KEY_PRESS 56 + | EventMask::SUBSTRUCTURE_NOTIFY
53 - | EventMask::BUTTON_PRESS, 57 + | EventMask::PROPERTY_CHANGE
54 - ), 58 + | EventMask::KEY_PRESS
59 + | EventMask::BUTTON_PRESS,
60 + ),
55 )? 61 )?
56 .check()?; 62 .check()?;
57 63