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 {
94
     pub cursor_right: u32,
94
     pub cursor_right: u32,
95
     pub cursor_top: u32,
95
     pub cursor_top: u32,
96
     pub cursor_bottom: u32,
96
     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
97
 }
99
 }
98
 
100
 
99
 impl Connection {
101
 impl Connection {
@@ -165,6 +167,8 @@ impl Connection {
165
             cursor_right,
167
             cursor_right,
166
             cursor_top,
168
             cursor_top,
167
             cursor_bottom,
169
             cursor_bottom,
170
+            cursor_h_double,
171
+            cursor_v_double,
168
         ) = Self::create_cursors(&conn)?;
172
         ) = Self::create_cursors(&conn)?;
169
 
173
 
170
         tracing::info!(
174
         tracing::info!(
@@ -220,6 +224,8 @@ impl Connection {
220
             cursor_right,
224
             cursor_right,
221
             cursor_top,
225
             cursor_top,
222
             cursor_bottom,
226
             cursor_bottom,
227
+            cursor_h_double,
228
+            cursor_v_double,
223
         })
229
         })
224
     }
230
     }
225
 
231
 
@@ -286,7 +292,7 @@ impl Connection {
286
     }
292
     }
287
 
293
 
288
     /// Create all cursors used by the window manager.
294
     /// 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> {
290
         // Open the cursor font
296
         // Open the cursor font
291
         let font: Font = conn.generate_id()?;
297
         let font: Font = conn.generate_id()?;
292
         conn.open_font(font, b"cursor")?;
298
         conn.open_font(font, b"cursor")?;
@@ -320,6 +326,8 @@ impl Connection {
320
         let cursor_right = create(96)?;        // right_side
326
         let cursor_right = create(96)?;        // right_side
321
         let cursor_top = create(138)?;         // top_side
327
         let cursor_top = create(138)?;         // top_side
322
         let cursor_bottom = create(16)?;       // bottom_side
328
         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
323
 
331
 
324
         // Close font (cursors keep their own references)
332
         // Close font (cursors keep their own references)
325
         conn.close_font(font)?;
333
         conn.close_font(font)?;
@@ -335,6 +343,8 @@ impl Connection {
335
             cursor_right,
343
             cursor_right,
336
             cursor_top,
344
             cursor_top,
337
             cursor_bottom,
345
             cursor_bottom,
346
+            cursor_h_double,
347
+            cursor_v_double,
338
         ))
348
         ))
339
     }
349
     }
340
 
350
 
gar/src/x11/events.rsmodified
@@ -756,8 +756,8 @@ impl WindowManager {
756
                 });
756
                 });
757
 
757
 
758
                 let cursor = match direction {
758
                 let cursor = match direction {
759
-                    Direction::Left | Direction::Right => self.conn.cursor_left,
759
+                    Direction::Left | Direction::Right => self.conn.cursor_h_double,
760
-                    Direction::Up | Direction::Down => self.conn.cursor_top,
760
+                    Direction::Up | Direction::Down => self.conn.cursor_v_double,
761
                 };
761
                 };
762
                 self.conn.grab_pointer(Some(cursor))?;
762
                 self.conn.grab_pointer(Some(cursor))?;
763
                 return Ok(());
763
                 return Ok(());
@@ -1121,10 +1121,10 @@ impl WindowManager {
1121
         }
1121
         }
1122
 
1122
 
1123
         if let Some(dir) = new_direction {
1123
         if let Some(dir) = new_direction {
1124
-            // Set resize cursor on root
1124
+            // Set resize cursor on root (double-arrow cursors)
1125
             let cursor = match dir {
1125
             let cursor = match dir {
1126
-                Direction::Left | Direction::Right => self.conn.cursor_left,
1126
+                Direction::Left | Direction::Right => self.conn.cursor_h_double,
1127
-                Direction::Up | Direction::Down => self.conn.cursor_top,
1127
+                Direction::Up | Direction::Down => self.conn.cursor_v_double,
1128
             };
1128
             };
1129
             self.conn.set_window_cursor(self.conn.root, cursor)?;
1129
             self.conn.set_window_cursor(self.conn.root, cursor)?;
1130
             self.conn.flush()?;
1130
             self.conn.flush()?;