gardesk/gar / 13883c8

Browse files

fix: use double-arrow cursors for tiled edge resize

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
13883c82b14b342b09074e83a42075c3f69e0140
Parents
b00c4be
Tree
611e5f1

2 changed files

StatusFile+-
M gar/src/x11/connection.rs 11 1
M gar/src/x11/events.rs 5 5
gar/src/x11/connection.rsmodified
@@ -94,6 +94,8 @@ pub struct Connection {
9494
     pub cursor_right: u32,
9595
     pub cursor_top: u32,
9696
     pub cursor_bottom: u32,
97
+    pub cursor_h_double: u32,  // sb_h_double_arrow - horizontal resize
98
+    pub cursor_v_double: u32,  // sb_v_double_arrow - vertical resize
9799
 }
98100
 
99101
 impl Connection {
@@ -165,6 +167,8 @@ impl Connection {
165167
             cursor_right,
166168
             cursor_top,
167169
             cursor_bottom,
170
+            cursor_h_double,
171
+            cursor_v_double,
168172
         ) = Self::create_cursors(&conn)?;
169173
 
170174
         tracing::info!(
@@ -220,6 +224,8 @@ impl Connection {
220224
             cursor_right,
221225
             cursor_top,
222226
             cursor_bottom,
227
+            cursor_h_double,
228
+            cursor_v_double,
223229
         })
224230
     }
225231
 
@@ -286,7 +292,7 @@ impl Connection {
286292
     }
287293
 
288294
     /// Create all cursors used by the window manager.
289
-    fn create_cursors(conn: &RustConnection) -> Result<(u32, u32, u32, u32, u32, u32, u32, u32, u32, u32), Error> {
295
+    fn create_cursors(conn: &RustConnection) -> Result<(u32, u32, u32, u32, u32, u32, u32, u32, u32, u32, u32, u32), Error> {
290296
         // Open the cursor font
291297
         let font: Font = conn.generate_id()?;
292298
         conn.open_font(font, b"cursor")?;
@@ -320,6 +326,8 @@ impl Connection {
320326
         let cursor_right = create(96)?;        // right_side
321327
         let cursor_top = create(138)?;         // top_side
322328
         let cursor_bottom = create(16)?;       // bottom_side
329
+        let cursor_h_double = create(108)?;    // sb_h_double_arrow
330
+        let cursor_v_double = create(116)?;    // sb_v_double_arrow
323331
 
324332
         // Close font (cursors keep their own references)
325333
         conn.close_font(font)?;
@@ -335,6 +343,8 @@ impl Connection {
335343
             cursor_right,
336344
             cursor_top,
337345
             cursor_bottom,
346
+            cursor_h_double,
347
+            cursor_v_double,
338348
         ))
339349
     }
340350
 
gar/src/x11/events.rsmodified
@@ -756,8 +756,8 @@ impl WindowManager {
756756
                 });
757757
 
758758
                 let cursor = match direction {
759
-                    Direction::Left | Direction::Right => self.conn.cursor_left,
760
-                    Direction::Up | Direction::Down => self.conn.cursor_top,
759
+                    Direction::Left | Direction::Right => self.conn.cursor_h_double,
760
+                    Direction::Up | Direction::Down => self.conn.cursor_v_double,
761761
                 };
762762
                 self.conn.grab_pointer(Some(cursor))?;
763763
                 return Ok(());
@@ -1121,10 +1121,10 @@ impl WindowManager {
11211121
         }
11221122
 
11231123
         if let Some(dir) = new_direction {
1124
-            // Set resize cursor on root
1124
+            // Set resize cursor on root (double-arrow cursors)
11251125
             let cursor = match dir {
1126
-                Direction::Left | Direction::Right => self.conn.cursor_left,
1127
-                Direction::Up | Direction::Down => self.conn.cursor_top,
1126
+                Direction::Left | Direction::Right => self.conn.cursor_h_double,
1127
+                Direction::Up | Direction::Down => self.conn.cursor_v_double,
11281128
             };
11291129
             self.conn.set_window_cursor(self.conn.root, cursor)?;
11301130
             self.conn.flush()?;