gardesk/gar / 8925c56

Browse files

Add debug logging for monitor navigation

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
8925c5694f8e565664ea55bfec3d9edd5f2d159b
Parents
11160b2
Tree
a332633

1 changed file

StatusFile+-
M gar/src/x11/events.rs 26 2
gar/src/x11/events.rsmodified
@@ -1700,18 +1700,30 @@ impl WindowManager {
17001700
     }
17011701
 
17021702
     fn focus_direction(&mut self, direction: Direction) -> Result<()> {
1703
+        tracing::debug!(
1704
+            "focus_direction({:?}): focused_monitor={}, monitors={:?}",
1705
+            direction,
1706
+            self.focused_monitor,
1707
+            self.monitors.iter().map(|m| (&m.name, m.geometry.x)).collect::<Vec<_>>()
1708
+        );
1709
+
17031710
         let Some(focused) = self.focused_window else {
17041711
             // No focused window - try to focus adjacent monitor
1712
+            tracing::debug!("No focused window, trying adjacent monitor");
17051713
             return self.focus_adjacent_monitor(direction);
17061714
         };
17071715
 
17081716
         let screen = self.screen_rect();
17091717
         let geometries = self.current_workspace().tree.calculate_geometries(screen);
1718
+        tracing::debug!("Window geometries on workspace: {:?}", geometries);
17101719
 
17111720
         // Look up remembered window for this direction (window memory)
17121721
         let preferred = self.directional_focus_memory.get(&(focused, direction)).copied();
17131722
 
1714
-        if let Some(target) = Node::find_adjacent(&geometries, focused, direction, preferred) {
1723
+        let adjacent = Node::find_adjacent(&geometries, focused, direction, preferred);
1724
+        tracing::debug!("find_adjacent result: {:?}", adjacent);
1725
+
1726
+        if let Some(target) = adjacent {
17151727
             // Check if memory was used (preferred matched target) or default algorithm was used
17161728
             let used_memory = preferred == Some(target);
17171729
 
@@ -1763,6 +1775,7 @@ impl WindowManager {
17631775
             tracing::debug!("Focused {:?} to window {} (preferred: {:?})", direction, target, preferred);
17641776
         } else {
17651777
             // No adjacent window on this workspace - try adjacent monitor
1778
+            tracing::debug!("No adjacent window found, trying adjacent monitor");
17661779
             self.focus_adjacent_monitor(direction)?;
17671780
         }
17681781
 
@@ -1771,7 +1784,13 @@ impl WindowManager {
17711784
 
17721785
     /// Focus the adjacent monitor in the given direction (does NOT wrap at edges)
17731786
     fn focus_adjacent_monitor(&mut self, direction: Direction) -> Result<()> {
1787
+        tracing::debug!(
1788
+            "focus_adjacent_monitor({:?}): focused_monitor={}, num_monitors={}",
1789
+            direction, self.focused_monitor, self.monitors.len()
1790
+        );
1791
+
17741792
         if self.monitors.len() <= 1 {
1793
+            tracing::debug!("Only one monitor, nothing to do");
17751794
             return Ok(());
17761795
         }
17771796
 
@@ -1780,6 +1799,7 @@ impl WindowManager {
17801799
             Direction::Left => {
17811800
                 if self.focused_monitor == 0 {
17821801
                     // At leftmost monitor - do nothing
1802
+                    tracing::debug!("Already at leftmost monitor (index 0), not navigating left");
17831803
                     return Ok(());
17841804
                 }
17851805
                 self.focused_monitor - 1
@@ -1787,12 +1807,16 @@ impl WindowManager {
17871807
             Direction::Right => {
17881808
                 if self.focused_monitor >= self.monitors.len() - 1 {
17891809
                     // At rightmost monitor - do nothing
1810
+                    tracing::debug!("Already at rightmost monitor, not navigating right");
17901811
                     return Ok(());
17911812
                 }
17921813
                 self.focused_monitor + 1
17931814
             }
17941815
             // Up/Down could navigate if monitors are stacked vertically
1795
-            Direction::Up | Direction::Down => return Ok(()),
1816
+            Direction::Up | Direction::Down => {
1817
+                tracing::debug!("Up/Down navigation not supported for horizontal monitor layout");
1818
+                return Ok(());
1819
+            }
17961820
         };
17971821
 
17981822
         tracing::info!("Moving focus from monitor {} to {}", self.focused_monitor, target_idx);