tony / oxwm

window_manager: apply clippy lints Browse files
mostly `collapsible_if` and `needless_type_cast`
emzywastaken committed 2025-12-15 parent 3816a44 commit a8b90f50bf5bcb2b6e7753a75fa5b0081b8e493c
Showing 1 changed file with 342 additions and 377 deletions. UnifiedSplit
+342 −377 src/window_manager.rs Large diff collapsed, click to expand
@@ -546,10 +546,10 @@ impl WindowManager {
546 } 546 }
547 let focused = focused.unwrap(); 547 let focused = focused.unwrap();
548 548
549 - if let Some(client) = self.clients.get(&focused) { 549 + if let Some(client) = self.clients.get(&focused)
550 - if client.is_fullscreen { 550 + && client.is_fullscreen
551 - return Ok(()); 551 + {
552 - } 552 + return Ok(());
553 } 553 }
554 554
555 let (is_fixed, x, y, w, h) = if let Some(client) = self.clients.get(&focused) { 555 let (is_fixed, x, y, w, h) = if let Some(client) = self.clients.get(&focused) {
@@ -594,7 +594,7 @@ impl WindowManager {
594 594
595 fn set_master_factor(&mut self, delta: f32) -> WmResult<()> { 595 fn set_master_factor(&mut self, delta: f32) -> WmResult<()> {
596 if let Some(monitor) = self.monitors.get_mut(self.selected_monitor) { 596 if let Some(monitor) = self.monitors.get_mut(self.selected_monitor) {
597 - let new_mfact = (monitor.master_factor + delta).max(0.05).min(0.95); 597 + let new_mfact = (monitor.master_factor + delta).clamp(0.05, 0.95);
598 monitor.master_factor = new_mfact; 598 monitor.master_factor = new_mfact;
599 self.apply_layout()?; 599 self.apply_layout()?;
600 } 600 }
@@ -993,10 +993,10 @@ impl WindowManager {
993 ) -> WmResult<()> { 993 ) -> WmResult<()> {
994 let current_monitor_index = self.clients.get(&window).map(|c| c.monitor_index); 994 let current_monitor_index = self.clients.get(&window).map(|c| c.monitor_index);
995 995
996 - if let Some(current_idx) = current_monitor_index { 996 + if let Some(current_idx) = current_monitor_index
997 - if current_idx == target_monitor_index { 997 + && current_idx == target_monitor_index
998 - return Ok(()); 998 + {
999 - } 999 + return Ok(());
1000 } 1000 }
1001 1001
1002 self.unfocus(window)?; 1002 self.unfocus(window)?;
@@ -1030,12 +1030,10 @@ impl WindowManager {
1030 } else { 1030 } else {
1031 Some(0) 1031 Some(0)
1032 } 1032 }
1033 + } else if self.selected_monitor == 0 {
1034 + Some(self.monitors.len() - 1)
1033 } else { 1035 } else {
1034 - if self.selected_monitor == 0 { 1036 + Some(self.selected_monitor - 1)
1035 - Some(self.monitors.len() - 1)
1036 - } else {
1037 - Some(self.selected_monitor - 1)
1038 - }
1039 } 1037 }
1040 } 1038 }
1041 1039
@@ -1405,34 +1403,34 @@ impl WindowManager {
1405 .get_property(false, window, AtomEnum::WM_HINTS, AtomEnum::WM_HINTS, 0, 9)? 1403 .get_property(false, window, AtomEnum::WM_HINTS, AtomEnum::WM_HINTS, 0, 9)?
1406 .reply(); 1404 .reply();
1407 1405
1408 - if let Ok(hints) = hints_reply { 1406 + if let Ok(hints) = hints_reply
1409 - if hints.value.len() >= 4 { 1407 + && hints.value.len() >= 4
1410 - let mut flags = u32::from_ne_bytes([ 1408 + {
1411 - hints.value[0], 1409 + let mut flags = u32::from_ne_bytes([
1412 - hints.value[1], 1410 + hints.value[0],
1413 - hints.value[2], 1411 + hints.value[1],
1414 - hints.value[3], 1412 + hints.value[2],
1415 - ]); 1413 + hints.value[3],
1416 - 1414 + ]);
1417 - if urgent { 1415 +
1418 - flags |= 256; 1416 + if urgent {
1419 - } else { 1417 + flags |= 256;
1420 - flags &= !256; 1418 + } else {
1421 - } 1419 + flags &= !256;
1420 + }
1422 1421
1423 - let mut new_hints = hints.value.clone(); 1422 + let mut new_hints = hints.value.clone();
1424 - new_hints[0..4].copy_from_slice(&flags.to_ne_bytes()); 1423 + new_hints[0..4].copy_from_slice(&flags.to_ne_bytes());
1425 1424
1426 - self.connection.change_property( 1425 + self.connection.change_property(
1427 - PropMode::REPLACE, 1426 + PropMode::REPLACE,
1428 - window, 1427 + window,
1429 - AtomEnum::WM_HINTS, 1428 + AtomEnum::WM_HINTS,
1430 - AtomEnum::WM_HINTS, 1429 + AtomEnum::WM_HINTS,
1431 - 32, 1430 + 32,
1432 - new_hints.len() as u32 / 4, 1431 + new_hints.len() as u32 / 4,
1433 - &new_hints, 1432 + &new_hints,
1434 - )?; 1433 + )?;
1435 - }
1436 } 1434 }
1437 1435
1438 Ok(()) 1436 Ok(())
@@ -1481,13 +1479,7 @@ impl WindowManager {
1481 if let Ok(geom) = self.connection.get_geometry(*window)?.reply() { 1479 if let Ok(geom) = self.connection.get_geometry(*window)?.reply() {
1482 self.floating_geometry_before_fullscreen.insert( 1480 self.floating_geometry_before_fullscreen.insert(
1483 *window, 1481 *window,
1484 - ( 1482 + (geom.x, geom.y, geom.width, geom.height, geom.border_width),
1485 - geom.x,
1486 - geom.y,
1487 - geom.width,
1488 - geom.height,
1489 - geom.border_width as u16,
1490 - ),
1491 ); 1483 );
1492 } 1484 }
1493 } 1485 }
@@ -1562,10 +1554,10 @@ impl WindowManager {
1562 1554
1563 self.fullscreen_windows.remove(&focused_window); 1555 self.fullscreen_windows.remove(&focused_window);
1564 1556
1565 - if let Some(last) = self.last_layout { 1557 + if let Some(last) = self.last_layout
1566 - if let Ok(layout) = layout_from_str(last) { 1558 + && let Ok(layout) = layout_from_str(last)
1567 - self.layout = layout; 1559 + {
1568 - } 1560 + self.layout = layout;
1569 } 1561 }
1570 1562
1571 let windows_to_restore: Vec<Window> = self 1563 let windows_to_restore: Vec<Window> = self
@@ -1605,15 +1597,13 @@ impl WindowManager {
1605 1597
1606 if self.layout.name() != "normie" { 1598 if self.layout.name() != "normie" {
1607 self.apply_layout()?; 1599 self.apply_layout()?;
1608 - } else { 1600 + } else if let Some(bar) = self.bars.get(self.selected_monitor) {
1609 - if let Some(bar) = self.bars.get(self.selected_monitor) { 1601 + self.connection.configure_window(
1610 - self.connection.configure_window( 1602 + bar.window(),
1611 - bar.window(), 1603 + &x11rb::protocol::xproto::ConfigureWindowAux::new()
1612 - &x11rb::protocol::xproto::ConfigureWindowAux::new() 1604 + .stack_mode(x11rb::protocol::xproto::StackMode::ABOVE),
1613 - .stack_mode(x11rb::protocol::xproto::StackMode::ABOVE), 1605 + )?;
1614 - )?; 1606 + self.connection.flush()?;
1615 - self.connection.flush()?;
1616 - }
1617 } 1607 }
1618 } 1608 }
1619 Ok(()) 1609 Ok(())
@@ -1751,15 +1741,14 @@ impl WindowManager {
1751 .ok() 1741 .ok()
1752 .and_then(|cookie| cookie.reply().ok()); 1742 .and_then(|cookie| cookie.reply().ok());
1753 1743
1754 - if let Some(reply) = reply { 1744 + if let Some(reply) = reply
1755 - if !reply.value.is_empty() { 1745 + && !reply.value.is_empty()
1756 - if let Ok(text) = std::str::from_utf8(&reply.value) { 1746 + && let Ok(text) = std::str::from_utf8(&reply.value)
1757 - let parts: Vec<&str> = text.split('\0').collect(); 1747 + {
1758 - let instance = parts.get(0).unwrap_or(&"").to_string(); 1748 + let parts: Vec<&str> = text.split('\0').collect();
1759 - let class = parts.get(1).unwrap_or(&"").to_string(); 1749 + let instance = parts.first().unwrap_or(&"").to_string();
1760 - return (instance, class); 1750 + let class = parts.get(1).unwrap_or(&"").to_string();
1761 - } 1751 + return (instance, class);
1762 - }
1763 } 1752 }
1764 1753
1765 (String::new(), String::new()) 1754 (String::new(), String::new())
@@ -1801,10 +1790,10 @@ impl WindowManager {
1801 } 1790 }
1802 } 1791 }
1803 1792
1804 - if let Some(monitor_index) = rule_monitor { 1793 + if let Some(monitor_index) = rule_monitor
1805 - if monitor_index < self.monitors.len() { 1794 + && monitor_index < self.monitors.len()
1806 - client.monitor_index = monitor_index; 1795 + {
1807 - } 1796 + client.monitor_index = monitor_index;
1808 } 1797 }
1809 1798
1810 let tags = rule_tags.unwrap_or_else(|| { 1799 let tags = rule_tags.unwrap_or_else(|| {
@@ -1937,11 +1926,11 @@ impl WindowManager {
1937 .get(&window) 1926 .get(&window)
1938 .map(|c| c.is_fixed) 1927 .map(|c| c.is_fixed)
1939 .unwrap_or(false); 1928 .unwrap_or(false);
1940 - if let Some(c) = self.clients.get_mut(&window) { 1929 + if let Some(c) = self.clients.get_mut(&window)
1941 - if !c.is_floating { 1930 + && !c.is_floating
1942 - c.is_floating = is_transient || is_fixed; 1931 + {
1943 - c.old_state = c.is_floating; 1932 + c.is_floating = is_transient || is_fixed;
1944 - } 1933 + c.old_state = c.is_floating;
1945 } 1934 }
1946 1935
1947 if self 1936 if self
@@ -1976,14 +1965,13 @@ impl WindowManager {
1976 let final_tags = self.clients.get(&window).map(|c| c.tags).unwrap_or(tags); 1965 let final_tags = self.clients.get(&window).map(|c| c.tags).unwrap_or(tags);
1977 let _ = self.save_client_tag(window, final_tags); 1966 let _ = self.save_client_tag(window, final_tags);
1978 1967
1979 - if client_monitor == self.selected_monitor { 1968 + if client_monitor == self.selected_monitor
1980 - if let Some(old_sel) = self 1969 + && let Some(old_sel) = self
1981 .monitors 1970 .monitors
1982 .get(self.selected_monitor) 1971 .get(self.selected_monitor)
1983 .and_then(|m| m.selected_client) 1972 .and_then(|m| m.selected_client)
1984 - { 1973 + {
1985 - self.unfocus(old_sel)?; 1974 + self.unfocus(old_sel)?;
1986 - }
1987 } 1975 }
1988 1976
1989 if let Some(m) = self.monitors.get_mut(client_monitor) { 1977 if let Some(m) = self.monitors.get_mut(client_monitor) {
@@ -2036,7 +2024,7 @@ impl WindowManager {
2036 self.connection.grab_button( 2024 self.connection.grab_button(
2037 false, 2025 false,
2038 window, 2026 window,
2039 - EventMask::BUTTON_PRESS.into(), 2027 + EventMask::BUTTON_PRESS,
2040 GrabMode::SYNC, 2028 GrabMode::SYNC,
2041 GrabMode::SYNC, 2029 GrabMode::SYNC,
2042 x11rb::NONE, 2030 x11rb::NONE,
@@ -2052,10 +2040,10 @@ impl WindowManager {
2052 let monitor = self.monitors.get_mut(self.selected_monitor).unwrap(); 2040 let monitor = self.monitors.get_mut(self.selected_monitor).unwrap();
2053 let old_selected = monitor.selected_client; 2041 let old_selected = monitor.selected_client;
2054 2042
2055 - if let Some(old_win) = old_selected { 2043 + if let Some(old_win) = old_selected
2056 - if old_selected != window { 2044 + && old_selected != window
2057 - self.unfocus(old_win)?; 2045 + {
2058 - } 2046 + self.unfocus(old_win)?;
2059 } 2047 }
2060 2048
2061 let mut win = window; 2049 let mut win = window;
@@ -2132,18 +2120,19 @@ impl WindowManager {
2132 2120
2133 let mut windows_to_restack: Vec<Window> = Vec::new(); 2121 let mut windows_to_restack: Vec<Window> = Vec::new();
2134 2122
2135 - if let Some(selected) = monitor.selected_client { 2123 + if let Some(selected) = monitor.selected_client
2136 - if self.floating_windows.contains(&selected) { 2124 + && self.floating_windows.contains(&selected)
2137 - windows_to_restack.push(selected); 2125 + {
2138 - } 2126 + windows_to_restack.push(selected);
2139 } 2127 }
2140 2128
2141 let mut current = monitor.stack_head; 2129 let mut current = monitor.stack_head;
2142 while let Some(win) = current { 2130 while let Some(win) = current {
2143 - if self.windows.contains(&win) && self.floating_windows.contains(&win) { 2131 + if self.windows.contains(&win)
2144 - if Some(win) != monitor.selected_client { 2132 + && self.floating_windows.contains(&win)
2145 - windows_to_restack.push(win); 2133 + && Some(win) != monitor.selected_client
2146 - } 2134 + {
2135 + windows_to_restack.push(win);
2147 } 2136 }
2148 current = self.clients.get(&win).and_then(|c| c.stack_next); 2137 current = self.clients.get(&win).and_then(|c| c.stack_next);
2149 } 2138 }
@@ -2214,12 +2203,10 @@ impl WindowManager {
2214 } else { 2203 } else {
2215 stack_windows[0] 2204 stack_windows[0]
2216 } 2205 }
2206 + } else if idx > 0 {
2207 + stack_windows[idx - 1]
2217 } else { 2208 } else {
2218 - if idx > 0 { 2209 + stack_windows[stack_windows.len() - 1]
2219 - stack_windows[idx - 1]
2220 - } else {
2221 - stack_windows[stack_windows.len() - 1]
2222 - }
2223 } 2210 }
2224 } else { 2211 } else {
2225 return Ok(()); 2212 return Ok(());
@@ -2337,20 +2324,18 @@ impl WindowManager {
2337 client.next = temp; 2324 client.next = temp;
2338 } 2325 }
2339 2326
2340 - if let Some(prev) = prev_selected { 2327 + if let Some(prev) = prev_selected
2341 - if prev != target { 2328 + && prev != target
2342 - if let Some(client) = self.clients.get_mut(&prev) { 2329 + && let Some(client) = self.clients.get_mut(&prev)
2343 - client.next = Some(target); 2330 + {
2344 - } 2331 + client.next = Some(target);
2345 - }
2346 } 2332 }
2347 2333
2348 - if let Some(prev) = prev_target { 2334 + if let Some(prev) = prev_target
2349 - if prev != selected { 2335 + && prev != selected
2350 - if let Some(client) = self.clients.get_mut(&prev) { 2336 + && let Some(client) = self.clients.get_mut(&prev)
2351 - client.next = Some(selected); 2337 + {
2352 - } 2338 + client.next = Some(selected);
2353 - }
2354 } 2339 }
2355 2340
2356 if let Some(monitor) = self.monitors.get_mut(monitor_index) { 2341 if let Some(monitor) = self.monitors.get_mut(monitor_index) {
@@ -2420,18 +2405,18 @@ impl WindowManager {
2420 old_focused: Option<Window>, 2405 old_focused: Option<Window>,
2421 new_focused: Window, 2406 new_focused: Window,
2422 ) -> WmResult<()> { 2407 ) -> WmResult<()> {
2423 - if let Some(old_win) = old_focused { 2408 + if let Some(old_win) = old_focused
2424 - if old_win != new_focused { 2409 + && old_win != new_focused
2425 - self.connection.configure_window( 2410 + {
2426 - old_win, 2411 + self.connection.configure_window(
2427 - &ConfigureWindowAux::new().border_width(self.config.border_width), 2412 + old_win,
2428 - )?; 2413 + &ConfigureWindowAux::new().border_width(self.config.border_width),
2414 + )?;
2429 2415
2430 - self.connection.change_window_attributes( 2416 + self.connection.change_window_attributes(
2431 - old_win, 2417 + old_win,
2432 - &ChangeWindowAttributesAux::new().border_pixel(self.config.border_unfocused), 2418 + &ChangeWindowAttributesAux::new().border_pixel(self.config.border_unfocused),
2433 - )?; 2419 + )?;
2434 - }
2435 } 2420 }
2436 2421
2437 self.connection.configure_window( 2422 self.connection.configure_window(
@@ -2490,8 +2475,7 @@ impl WindowManager {
2490 .grab_pointer( 2475 .grab_pointer(
2491 false, 2476 false,
2492 self.root, 2477 self.root,
2493 - (EventMask::POINTER_MOTION | EventMask::BUTTON_RELEASE | EventMask::BUTTON_PRESS) 2478 + EventMask::POINTER_MOTION | EventMask::BUTTON_RELEASE | EventMask::BUTTON_PRESS,
2494 - .into(),
2495 GrabMode::ASYNC, 2479 GrabMode::ASYNC,
2496 GrabMode::ASYNC, 2480 GrabMode::ASYNC,
2497 x11rb::NONE, 2481 x11rb::NONE,
@@ -2748,8 +2732,7 @@ impl WindowManager {
2748 .grab_pointer( 2732 .grab_pointer(
2749 false, 2733 false,
2750 self.root, 2734 self.root,
2751 - (EventMask::POINTER_MOTION | EventMask::BUTTON_RELEASE | EventMask::BUTTON_PRESS) 2735 + EventMask::POINTER_MOTION | EventMask::BUTTON_RELEASE | EventMask::BUTTON_PRESS,
2752 - .into(),
2753 GrabMode::ASYNC, 2736 GrabMode::ASYNC,
2754 GrabMode::ASYNC, 2737 GrabMode::ASYNC,
2755 x11rb::NONE, 2738 x11rb::NONE,
@@ -2784,29 +2767,27 @@ impl WindowManager {
2784 .map(|c| c.is_floating) 2767 .map(|c| c.is_floating)
2785 .unwrap_or(false); 2768 .unwrap_or(false);
2786 2769
2787 - if should_resize { 2770 + if should_resize && let Some(client) = self.clients.get(&window).cloned() {
2788 - if let Some(client) = self.clients.get(&window).cloned() { 2771 + let (_, _, hint_width, hint_height, _) = self.apply_size_hints(
2789 - let (_, _, hint_width, hint_height, _) = self.apply_size_hints( 2772 + window,
2790 - window, 2773 + client.x_position as i32,
2791 - client.x_position as i32, 2774 + client.y_position as i32,
2792 - client.y_position as i32, 2775 + new_width as i32,
2793 - new_width as i32, 2776 + new_height as i32,
2794 - new_height as i32, 2777 + );
2795 - ); 2778 +
2796 - 2779 + if let Some(client_mut) = self.clients.get_mut(&window) {
2797 - if let Some(client_mut) = self.clients.get_mut(&window) { 2780 + client_mut.width = hint_width as u16;
2798 - client_mut.width = hint_width as u16; 2781 + client_mut.height = hint_height as u16;
2799 - client_mut.height = hint_height as u16;
2800 - }
2801 -
2802 - self.connection.configure_window(
2803 - window,
2804 - &ConfigureWindowAux::new()
2805 - .width(hint_width as u32)
2806 - .height(hint_height as u32),
2807 - )?;
2808 - self.connection.flush()?;
2809 } 2782 }
2783 +
2784 + self.connection.configure_window(
2785 + window,
2786 + &ConfigureWindowAux::new()
2787 + .width(hint_width as u32)
2788 + .height(hint_height as u32),
2789 + )?;
2790 + self.connection.flush()?;
2810 } 2791 }
2811 } 2792 }
2812 Event::ButtonRelease(_) => break, 2793 Event::ButtonRelease(_) => break,
@@ -2861,26 +2842,26 @@ impl WindowManager {
2861 fn handle_event(&mut self, event: Event) -> WmResult<Option<bool>> { 2842 fn handle_event(&mut self, event: Event) -> WmResult<Option<bool>> {
2862 match event { 2843 match event {
2863 Event::KeyPress(ref key_event) if key_event.event == self.overlay.window() => { 2844 Event::KeyPress(ref key_event) if key_event.event == self.overlay.window() => {
2864 - if self.overlay.is_visible() { 2845 + if self.overlay.is_visible()
2865 - if let Err(error) = self.overlay.hide(&self.connection) { 2846 + && let Err(error) = self.overlay.hide(&self.connection)
2866 - eprintln!("Failed to hide overlay: {:?}", error); 2847 + {
2867 - } 2848 + eprintln!("Failed to hide overlay: {:?}", error);
2868 } 2849 }
2869 return Ok(None); 2850 return Ok(None);
2870 } 2851 }
2871 Event::ButtonPress(ref button_event) if button_event.event == self.overlay.window() => { 2852 Event::ButtonPress(ref button_event) if button_event.event == self.overlay.window() => {
2872 - if self.overlay.is_visible() { 2853 + if self.overlay.is_visible()
2873 - if let Err(error) = self.overlay.hide(&self.connection) { 2854 + && let Err(error) = self.overlay.hide(&self.connection)
2874 - eprintln!("Failed to hide overlay: {:?}", error); 2855 + {
2875 - } 2856 + eprintln!("Failed to hide overlay: {:?}", error);
2876 } 2857 }
2877 return Ok(None); 2858 return Ok(None);
2878 } 2859 }
2879 Event::Expose(ref expose_event) if expose_event.window == self.overlay.window() => { 2860 Event::Expose(ref expose_event) if expose_event.window == self.overlay.window() => {
2880 - if self.overlay.is_visible() { 2861 + if self.overlay.is_visible()
2881 - if let Err(error) = self.overlay.draw(&self.connection, &self.font) { 2862 + && let Err(error) = self.overlay.draw(&self.connection, &self.font)
2882 - eprintln!("Failed to draw overlay: {:?}", error); 2863 + {
2883 - } 2864 + eprintln!("Failed to draw overlay: {:?}", error);
2884 } 2865 }
2885 return Ok(None); 2866 return Ok(None);
2886 } 2867 }
@@ -2893,10 +2874,10 @@ impl WindowManager {
2893 let keysym = mapping.keycode_to_keysym(e.detail); 2874 let keysym = mapping.keycode_to_keysym(e.detail);
2894 let is_escape = keysym == keysyms::XK_ESCAPE; 2875 let is_escape = keysym == keysyms::XK_ESCAPE;
2895 let is_q = keysym == keysyms::XK_Q || keysym == 0x0051; 2876 let is_q = keysym == keysyms::XK_Q || keysym == 0x0051;
2896 - if is_escape || is_q { 2877 + if (is_escape || is_q)
2897 - if let Err(error) = self.keybind_overlay.hide(&self.connection) { 2878 + && let Err(error) = self.keybind_overlay.hide(&self.connection)
2898 - eprintln!("Failed to hide keybind overlay: {:?}", error); 2879 + {
2899 - } 2880 + eprintln!("Failed to hide keybind overlay: {:?}", error);
2900 } 2881 }
2901 } 2882 }
2902 } 2883 }
@@ -2910,10 +2891,10 @@ impl WindowManager {
2910 Event::Expose(ref expose_event) 2891 Event::Expose(ref expose_event)
2911 if expose_event.window == self.keybind_overlay.window() => 2892 if expose_event.window == self.keybind_overlay.window() =>
2912 { 2893 {
2913 - if self.keybind_overlay.is_visible() { 2894 + if self.keybind_overlay.is_visible()
2914 - if let Err(error) = self.keybind_overlay.draw(&self.connection, &self.font) { 2895 + && let Err(error) = self.keybind_overlay.draw(&self.connection, &self.font)
2915 - eprintln!("Failed to draw keybind overlay: {:?}", error); 2896 + {
2916 - } 2897 + eprintln!("Failed to draw keybind overlay: {:?}", error);
2917 } 2898 }
2918 return Ok(None); 2899 return Ok(None);
2919 } 2900 }
@@ -2956,16 +2937,15 @@ impl WindowManager {
2956 .get(&event.window) 2937 .get(&event.window)
2957 .map(|c| c.is_floating) 2938 .map(|c| c.is_floating)
2958 .unwrap_or(false); 2939 .unwrap_or(false);
2959 - if !is_floating { 2940 + if !is_floating
2960 - if let Some(parent) = self.get_transient_parent(event.window) { 2941 + && let Some(parent) = self.get_transient_parent(event.window)
2961 - if self.clients.contains_key(&parent) { 2942 + && self.clients.contains_key(&parent)
2962 - if let Some(c) = self.clients.get_mut(&event.window) { 2943 + {
2963 - c.is_floating = true; 2944 + if let Some(c) = self.clients.get_mut(&event.window) {
2964 - } 2945 + c.is_floating = true;
2965 - self.floating_windows.insert(event.window);
2966 - self.apply_layout()?;
2967 - }
2968 } 2946 }
2947 + self.floating_windows.insert(event.window);
2948 + self.apply_layout()?;
2969 } 2949 }
2970 } else if event.atom == AtomEnum::WM_NORMAL_HINTS.into() { 2950 } else if event.atom == AtomEnum::WM_NORMAL_HINTS.into() {
2971 if let Some(c) = self.clients.get_mut(&event.window) { 2951 if let Some(c) = self.clients.get_mut(&event.window) {
@@ -2992,11 +2972,11 @@ impl WindowManager {
2992 return Ok(None); 2972 return Ok(None);
2993 } 2973 }
2994 if self.windows.contains(&event.event) { 2974 if self.windows.contains(&event.event) {
2995 - if let Some(client) = self.clients.get(&event.event) { 2975 + if let Some(client) = self.clients.get(&event.event)
2996 - if client.monitor_index != self.selected_monitor { 2976 + && client.monitor_index != self.selected_monitor
2997 - self.selected_monitor = client.monitor_index; 2977 + {
2998 - self.update_bar()?; 2978 + self.selected_monitor = client.monitor_index;
2999 - } 2979 + self.update_bar()?;
3000 } 2980 }
3001 self.focus(Some(event.event))?; 2981 self.focus(Some(event.event))?;
3002 self.update_tab_bars()?; 2982 self.update_tab_bars()?;
@@ -3009,16 +2989,15 @@ impl WindowManager {
3009 2989
3010 if let Some(monitor_index) = 2990 if let Some(monitor_index) =
3011 self.get_monitor_at_point(event.root_x as i32, event.root_y as i32) 2991 self.get_monitor_at_point(event.root_x as i32, event.root_y as i32)
2992 + && monitor_index != self.selected_monitor
3012 { 2993 {
3013 - if monitor_index != self.selected_monitor { 2994 + self.selected_monitor = monitor_index;
3014 - self.selected_monitor = monitor_index; 2995 + self.update_bar()?;
3015 - self.update_bar()?;
3016 2996
3017 - let visible = self.visible_windows_on_monitor(monitor_index); 2997 + let visible = self.visible_windows_on_monitor(monitor_index);
3018 - if let Some(&win) = visible.first() { 2998 + if let Some(&win) = visible.first() {
3019 - self.focus(Some(win))?; 2999 + self.focus(Some(win))?;
3020 - self.update_tab_bars()?; 3000 + self.update_tab_bars()?;
3021 - }
3022 } 3001 }
3023 } 3002 }
3024 } 3003 }
@@ -3100,11 +3079,11 @@ impl WindowManager {
3100 } 3079 }
3101 } 3080 }
3102 Event::ButtonPress(event) => { 3081 Event::ButtonPress(event) => {
3103 - if self.keybind_overlay.is_visible() && event.event != self.keybind_overlay.window() 3082 + if self.keybind_overlay.is_visible()
3083 + && event.event != self.keybind_overlay.window()
3084 + && let Err(error) = self.keybind_overlay.hide(&self.connection)
3104 { 3085 {
3105 - if let Err(error) = self.keybind_overlay.hide(&self.connection) { 3086 + eprintln!("Failed to hide keybind overlay: {:?}", error);
3106 - eprintln!("Failed to hide keybind overlay: {:?}", error);
3107 - }
3108 } 3087 }
3109 3088
3110 let is_bar_click = self 3089 let is_bar_click = self
@@ -3278,14 +3257,13 @@ impl WindowManager {
3278 let width_with_border = w + 2 * bw; 3257 let width_with_border = w + 2 * bw;
3279 let height_with_border = h + 2 * bw; 3258 let height_with_border = h + 2 * bw;
3280 3259
3281 - if (x + w) > monitor.screen_x + monitor.screen_width as i32 && is_floating { 3260 + if (x + w) > monitor.screen_x + monitor.screen_width && is_floating {
3282 x = monitor.screen_x 3261 x = monitor.screen_x
3283 - + (monitor.screen_width as i32 / 2 - width_with_border / 2); 3262 + + (monitor.screen_width / 2 - width_with_border / 2);
3284 } 3263 }
3285 - if (y + h) > monitor.screen_y + monitor.screen_height as i32 && is_floating 3264 + if (y + h) > monitor.screen_y + monitor.screen_height && is_floating {
3286 - {
3287 y = monitor.screen_y 3265 y = monitor.screen_y
3288 - + (monitor.screen_height as i32 / 2 - height_with_border / 2); 3266 + + (monitor.screen_height / 2 - height_with_border / 2);
3289 } 3267 }
3290 3268
3291 if let Some(c) = self.clients.get_mut(&event.window) { 3269 if let Some(c) = self.clients.get_mut(&event.window) {
@@ -3349,17 +3327,17 @@ impl WindowManager {
3349 } 3327 }
3350 3328
3351 if event.type_ == self.atoms.net_wm_state { 3329 if event.type_ == self.atoms.net_wm_state {
3352 - if let Some(data) = event.data.as_data32().get(1) { 3330 + if let Some(data) = event.data.as_data32().get(1)
3353 - if *data == self.atoms.net_wm_state_fullscreen { 3331 + && *data == self.atoms.net_wm_state_fullscreen
3354 - let action = event.data.as_data32()[0]; 3332 + {
3355 - let fullscreen = match action { 3333 + let action = event.data.as_data32()[0];
3356 - 1 => true, 3334 + let fullscreen = match action {
3357 - 0 => false, 3335 + 1 => true,
3358 - 2 => !self.fullscreen_windows.contains(&event.window), 3336 + 0 => false,
3359 - _ => return Ok(None), 3337 + 2 => !self.fullscreen_windows.contains(&event.window),
3360 - }; 3338 + _ => return Ok(None),
3361 - self.set_window_fullscreen(event.window, fullscreen)?; 3339 + };
3362 - } 3340 + self.set_window_fullscreen(event.window, fullscreen)?;
3363 } 3341 }
3364 } else if event.type_ == self.atoms.net_active_window { 3342 } else if event.type_ == self.atoms.net_active_window {
3365 let selected_window = self 3343 let selected_window = self
@@ -3384,10 +3362,10 @@ impl WindowManager {
3384 .get(self.selected_monitor) 3362 .get(self.selected_monitor)
3385 .and_then(|m| m.selected_client); 3363 .and_then(|m| m.selected_client);
3386 3364
3387 - if let Some(sel_win) = selected_window { 3365 + if let Some(sel_win) = selected_window
3388 - if event.event != sel_win { 3366 + && event.event != sel_win
3389 - self.set_focus(sel_win)?; 3367 + {
3390 - } 3368 + self.set_focus(sel_win)?;
3391 } 3369 }
3392 } 3370 }
3393 Event::MappingNotify(event) => { 3371 Event::MappingNotify(event) => {
@@ -3484,18 +3462,18 @@ impl WindowManager {
3484 let mut adjusted_width = geometry.width.saturating_sub(2 * border_width); 3462 let mut adjusted_width = geometry.width.saturating_sub(2 * border_width);
3485 let mut adjusted_height = geometry.height.saturating_sub(2 * border_width); 3463 let mut adjusted_height = geometry.height.saturating_sub(2 * border_width);
3486 3464
3487 - if let Some(client) = self.clients.get(window).cloned() { 3465 + if let Some(client) = self.clients.get(window).cloned()
3488 - if !client.is_floating { 3466 + && !client.is_floating
3489 - let (_, _, hint_width, hint_height, _) = self.apply_size_hints( 3467 + {
3490 - *window, 3468 + let (_, _, hint_width, hint_height, _) = self.apply_size_hints(
3491 - geometry.x_coordinate as i32, 3469 + *window,
3492 - geometry.y_coordinate as i32, 3470 + geometry.x_coordinate,
3493 - adjusted_width as i32, 3471 + geometry.y_coordinate,
3494 - adjusted_height as i32, 3472 + adjusted_width as i32,
3495 - ); 3473 + adjusted_height as i32,
3496 - adjusted_width = hint_width as u32; 3474 + );
3497 - adjusted_height = hint_height as u32; 3475 + adjusted_width = hint_width as u32;
3498 - } 3476 + adjusted_height = hint_height as u32;
3499 } 3477 }
3500 3478
3501 let adjusted_x = geometry.x_coordinate + monitor_x; 3479 let adjusted_x = geometry.x_coordinate + monitor_x;
@@ -3601,10 +3579,8 @@ impl WindowManager {
3601 if let Err(e) = self.tab_bars[monitor_index].show(&self.connection) { 3579 if let Err(e) = self.tab_bars[monitor_index].show(&self.connection) {
3602 eprintln!("Failed to show tab bar: {:?}", e); 3580 eprintln!("Failed to show tab bar: {:?}", e);
3603 } 3581 }
3604 - } else { 3582 + } else if let Err(e) = self.tab_bars[monitor_index].hide(&self.connection) {
3605 - if let Err(e) = self.tab_bars[monitor_index].hide(&self.connection) { 3583 + eprintln!("Failed to hide tab bar: {:?}", e);
3606 - eprintln!("Failed to hide tab bar: {:?}", e);
3607 - }
3608 } 3584 }
3609 } 3585 }
3610 3586
@@ -3765,15 +3741,13 @@ impl WindowManager {
3765 .ok() 3741 .ok()
3766 .and_then(|cookie| cookie.reply().ok()); 3742 .and_then(|cookie| cookie.reply().ok());
3767 3743
3768 - if let Some(name) = net_name { 3744 + if let Some(name) = net_name
3769 - if !name.value.is_empty() { 3745 + && !name.value.is_empty()
3770 - if let Ok(title) = String::from_utf8(name.value.clone()) { 3746 + && let Ok(title) = String::from_utf8(name.value.clone())
3771 - if let Some(client) = self.clients.get_mut(&window) { 3747 + && let Some(client) = self.clients.get_mut(&window)
3772 - client.name = title; 3748 + {
3773 - return Ok(()); 3749 + client.name = title;
3774 - } 3750 + return Ok(());
3775 - }
3776 - }
3777 } 3751 }
3778 3752
3779 let wm_name = self 3753 let wm_name = self
@@ -3788,12 +3762,11 @@ impl WindowManager {
3788 )? 3762 )?
3789 .reply()?; 3763 .reply()?;
3790 3764
3791 - if !wm_name.value.is_empty() { 3765 + if !wm_name.value.is_empty()
3792 - if let Ok(title) = String::from_utf8(wm_name.value.clone()) { 3766 + && let Ok(title) = String::from_utf8(wm_name.value.clone())
3793 - if let Some(client) = self.clients.get_mut(&window) { 3767 + && let Some(client) = self.clients.get_mut(&window)
3794 - client.name = title; 3768 + {
3795 - } 3769 + client.name = title;
3796 - }
3797 } 3770 }
3798 3771
3799 Ok(()) 3772 Ok(())
@@ -3805,56 +3778,52 @@ impl WindowManager {
3805 .get_property(false, window, AtomEnum::WM_HINTS, AtomEnum::WM_HINTS, 0, 9)? 3778 .get_property(false, window, AtomEnum::WM_HINTS, AtomEnum::WM_HINTS, 0, 9)?
3806 .reply(); 3779 .reply();
3807 3780
3808 - if let Ok(hints) = hints_reply { 3781 + if let Ok(hints) = hints_reply
3809 - if hints.value.len() >= 4 { 3782 + && hints.value.len() >= 4
3810 - let flags = u32::from_ne_bytes([ 3783 + {
3811 - hints.value[0], 3784 + let flags = u32::from_ne_bytes([
3812 - hints.value[1], 3785 + hints.value[0],
3813 - hints.value[2], 3786 + hints.value[1],
3814 - hints.value[3], 3787 + hints.value[2],
3815 - ]); 3788 + hints.value[3],
3816 - 3789 + ]);
3817 - let selected_window = self 3790 +
3818 - .monitors 3791 + let selected_window = self
3819 - .get(self.selected_monitor) 3792 + .monitors
3820 - .and_then(|m| m.selected_client); 3793 + .get(self.selected_monitor)
3794 + .and_then(|m| m.selected_client);
3821 3795
3822 - if Some(window) == selected_window && (flags & 256) != 0 { 3796 + if Some(window) == selected_window && (flags & 256) != 0 {
3823 - let new_flags = flags & !256; 3797 + let new_flags = flags & !256;
3824 - let mut new_hints = hints.value.clone(); 3798 + let mut new_hints = hints.value.clone();
3825 - new_hints[0..4].copy_from_slice(&new_flags.to_ne_bytes()); 3799 + new_hints[0..4].copy_from_slice(&new_flags.to_ne_bytes());
3826 3800
3827 - self.connection.change_property( 3801 + self.connection.change_property(
3828 - x11rb::protocol::xproto::PropMode::REPLACE, 3802 + x11rb::protocol::xproto::PropMode::REPLACE,
3829 - window, 3803 + window,
3830 - AtomEnum::WM_HINTS, 3804 + AtomEnum::WM_HINTS,
3831 - AtomEnum::WM_HINTS, 3805 + AtomEnum::WM_HINTS,
3832 - 32, 3806 + 32,
3833 - 9, 3807 + 9,
3834 - &new_hints, 3808 + &new_hints,
3835 - )?; 3809 + )?;
3836 - } else { 3810 + } else if let Some(client) = self.clients.get_mut(&window) {
3837 - if let Some(client) = self.clients.get_mut(&window) { 3811 + client.is_urgent = (flags & 256) != 0;
3838 - client.is_urgent = (flags & 256) != 0; 3812 + }
3839 - }
3840 - }
3841 3813
3842 - if hints.value.len() >= 8 && (flags & 1) != 0 { 3814 + if hints.value.len() >= 8 && (flags & 1) != 0 {
3843 - let input = i32::from_ne_bytes([ 3815 + let input = i32::from_ne_bytes([
3844 - hints.value[4], 3816 + hints.value[4],
3845 - hints.value[5], 3817 + hints.value[5],
3846 - hints.value[6], 3818 + hints.value[6],
3847 - hints.value[7], 3819 + hints.value[7],
3848 - ]); 3820 + ]);
3849 3821
3850 - if let Some(client) = self.clients.get_mut(&window) { 3822 + if let Some(client) = self.clients.get_mut(&window) {
3851 - client.never_focus = input == 0; 3823 + client.never_focus = input == 0;
3852 - }
3853 - } else {
3854 - if let Some(client) = self.clients.get_mut(&window) {
3855 - client.never_focus = false;
3856 - }
3857 } 3824 }
3825 + } else if let Some(client) = self.clients.get_mut(&window) {
3826 + client.never_focus = false;
3858 } 3827 }
3859 } 3828 }
3860 3829
@@ -3863,21 +3832,19 @@ impl WindowManager {
3863 3832
3864 fn update_window_type(&mut self, window: Window) -> WmResult<()> { 3833 fn update_window_type(&mut self, window: Window) -> WmResult<()> {
3865 if let Ok(Some(state_atom)) = self.get_window_atom_property(window, self.atoms.net_wm_state) 3834 if let Ok(Some(state_atom)) = self.get_window_atom_property(window, self.atoms.net_wm_state)
3835 + && state_atom == self.atoms.net_wm_state_fullscreen
3866 { 3836 {
3867 - if state_atom == self.atoms.net_wm_state_fullscreen { 3837 + self.set_window_fullscreen(window, true)?;
3868 - self.set_window_fullscreen(window, true)?;
3869 - }
3870 } 3838 }
3871 3839
3872 if let Ok(Some(type_atom)) = 3840 if let Ok(Some(type_atom)) =
3873 self.get_window_atom_property(window, self.atoms.net_wm_window_type) 3841 self.get_window_atom_property(window, self.atoms.net_wm_window_type)
3842 + && type_atom == self.atoms.net_wm_window_type_dialog
3874 { 3843 {
3875 - if type_atom == self.atoms.net_wm_window_type_dialog { 3844 + if let Some(client) = self.clients.get_mut(&window) {
3876 - if let Some(client) = self.clients.get_mut(&window) { 3845 + client.is_floating = true;
3877 - client.is_floating = true;
3878 - }
3879 - self.floating_windows.insert(window);
3880 } 3846 }
3847 + self.floating_windows.insert(window);
3881 } 3848 }
3882 3849
3883 Ok(()) 3850 Ok(())
@@ -4060,11 +4027,11 @@ impl WindowManager {
4060 } 4027 }
4061 4028
4062 fn attach(&mut self, window: Window, monitor_index: usize) { 4029 fn attach(&mut self, window: Window, monitor_index: usize) {
4063 - if let Some(monitor) = self.monitors.get_mut(monitor_index) { 4030 + if let Some(monitor) = self.monitors.get_mut(monitor_index)
4064 - if let Some(client) = self.clients.get_mut(&window) { 4031 + && let Some(client) = self.clients.get_mut(&window)
4065 - client.next = monitor.clients_head; 4032 + {
4066 - monitor.clients_head = Some(window); 4033 + client.next = monitor.clients_head;
4067 - } 4034 + monitor.clients_head = Some(window);
4068 } 4035 }
4069 } 4036 }
4070 4037
@@ -4082,44 +4049,43 @@ impl WindowManager {
4082 return; 4049 return;
4083 } 4050 }
4084 4051
4085 - if let Some(insert_after_window) = first_tagged { 4052 + if let Some(insert_after_window) = first_tagged
4086 - if let Some(after_client) = self.clients.get(&insert_after_window) { 4053 + && let Some(after_client) = self.clients.get(&insert_after_window)
4087 - let old_next = after_client.next; 4054 + {
4088 - if let Some(new_client) = self.clients.get_mut(&window) { 4055 + let old_next = after_client.next;
4089 - new_client.next = old_next; 4056 + if let Some(new_client) = self.clients.get_mut(&window) {
4090 - } 4057 + new_client.next = old_next;
4091 - if let Some(after_client_mut) = self.clients.get_mut(&insert_after_window) { 4058 + }
4092 - after_client_mut.next = Some(window); 4059 + if let Some(after_client_mut) = self.clients.get_mut(&insert_after_window) {
4093 - } 4060 + after_client_mut.next = Some(window);
4094 } 4061 }
4095 } 4062 }
4096 } 4063 }
4097 4064
4098 fn detach(&mut self, window: Window) { 4065 fn detach(&mut self, window: Window) {
4099 let monitor_index = self.clients.get(&window).map(|c| c.monitor_index); 4066 let monitor_index = self.clients.get(&window).map(|c| c.monitor_index);
4100 - if let Some(monitor_index) = monitor_index { 4067 + if let Some(monitor_index) = monitor_index
4101 - if let Some(monitor) = self.monitors.get_mut(monitor_index) { 4068 + && let Some(monitor) = self.monitors.get_mut(monitor_index)
4102 - if monitor.clients_head == Some(window) { 4069 + {
4103 - if let Some(client) = self.clients.get(&window) { 4070 + if monitor.clients_head == Some(window) {
4104 - monitor.clients_head = client.next; 4071 + if let Some(client) = self.clients.get(&window) {
4105 - } 4072 + monitor.clients_head = client.next;
4106 - } else { 4073 + }
4107 - let mut current = monitor.clients_head; 4074 + } else {
4108 - while let Some(current_window) = current { 4075 + let mut current = monitor.clients_head;
4109 - if let Some(current_client) = self.clients.get(&current_window) { 4076 + while let Some(current_window) = current {
4110 - if current_client.next == Some(window) { 4077 + if let Some(current_client) = self.clients.get(&current_window) {
4111 - let new_next = self.clients.get(&window).and_then(|c| c.next); 4078 + if current_client.next == Some(window) {
4112 - if let Some(current_client_mut) = 4079 + let new_next = self.clients.get(&window).and_then(|c| c.next);
4113 - self.clients.get_mut(&current_window) 4080 + if let Some(current_client_mut) = self.clients.get_mut(&current_window)
4114 - { 4081 + {
4115 - current_client_mut.next = new_next; 4082 + current_client_mut.next = new_next;
4116 - }
4117 - break;
4118 } 4083 }
4119 - current = current_client.next;
4120 - } else {
4121 break; 4084 break;
4122 } 4085 }
4086 + current = current_client.next;
4087 + } else {
4088 + break;
4123 } 4089 }
4124 } 4090 }
4125 } 4091 }
@@ -4127,61 +4093,60 @@ impl WindowManager {
4127 } 4093 }
4128 4094
4129 fn attach_stack(&mut self, window: Window, monitor_index: usize) { 4095 fn attach_stack(&mut self, window: Window, monitor_index: usize) {
4130 - if let Some(monitor) = self.monitors.get_mut(monitor_index) { 4096 + if let Some(monitor) = self.monitors.get_mut(monitor_index)
4131 - if let Some(client) = self.clients.get_mut(&window) { 4097 + && let Some(client) = self.clients.get_mut(&window)
4132 - client.stack_next = monitor.stack_head; 4098 + {
4133 - monitor.stack_head = Some(window); 4099 + client.stack_next = monitor.stack_head;
4134 - } 4100 + monitor.stack_head = Some(window);
4135 } 4101 }
4136 } 4102 }
4137 4103
4138 fn detach_stack(&mut self, window: Window) { 4104 fn detach_stack(&mut self, window: Window) {
4139 let monitor_index = self.clients.get(&window).map(|c| c.monitor_index); 4105 let monitor_index = self.clients.get(&window).map(|c| c.monitor_index);
4140 - if let Some(monitor_index) = monitor_index { 4106 + if let Some(monitor_index) = monitor_index
4141 - if let Some(monitor) = self.monitors.get_mut(monitor_index) { 4107 + && let Some(monitor) = self.monitors.get_mut(monitor_index)
4142 - if monitor.stack_head == Some(window) { 4108 + {
4143 - if let Some(client) = self.clients.get(&window) { 4109 + if monitor.stack_head == Some(window) {
4144 - monitor.stack_head = client.stack_next; 4110 + if let Some(client) = self.clients.get(&window) {
4145 - } 4111 + monitor.stack_head = client.stack_next;
4146 - let should_update_selected = monitor.selected_client == Some(window); 4112 + }
4147 - let mut new_selected: Option<Window> = None; 4113 + let should_update_selected = monitor.selected_client == Some(window);
4148 - if should_update_selected { 4114 + let mut new_selected: Option<Window> = None;
4149 - let mut stack_current = monitor.stack_head; 4115 + if should_update_selected {
4150 - while let Some(stack_window) = stack_current { 4116 + let mut stack_current = monitor.stack_head;
4151 - if let Some(stack_client) = self.clients.get(&stack_window) { 4117 + while let Some(stack_window) = stack_current {
4152 - if self.is_window_visible(stack_window) { 4118 + if let Some(stack_client) = self.clients.get(&stack_window) {
4153 - new_selected = Some(stack_window); 4119 + if self.is_window_visible(stack_window) {
4154 - break; 4120 + new_selected = Some(stack_window);
4155 - }
4156 - stack_current = stack_client.stack_next;
4157 - } else {
4158 break; 4121 break;
4159 } 4122 }
4123 + stack_current = stack_client.stack_next;
4124 + } else {
4125 + break;
4160 } 4126 }
4161 } 4127 }
4162 - if should_update_selected { 4128 + }
4163 - if let Some(monitor) = self.monitors.get_mut(monitor_index) { 4129 + if should_update_selected
4164 - monitor.selected_client = new_selected; 4130 + && let Some(monitor) = self.monitors.get_mut(monitor_index)
4165 - } 4131 + {
4166 - } 4132 + monitor.selected_client = new_selected;
4167 - } else { 4133 + }
4168 - let mut current = monitor.stack_head; 4134 + } else {
4169 - while let Some(current_window) = current { 4135 + let mut current = monitor.stack_head;
4170 - if let Some(current_client) = self.clients.get(&current_window) { 4136 + while let Some(current_window) = current {
4171 - if current_client.stack_next == Some(window) { 4137 + if let Some(current_client) = self.clients.get(&current_window) {
4172 - let new_stack_next = 4138 + if current_client.stack_next == Some(window) {
4173 - self.clients.get(&window).and_then(|c| c.stack_next); 4139 + let new_stack_next =
4174 - if let Some(current_client_mut) = 4140 + self.clients.get(&window).and_then(|c| c.stack_next);
4175 - self.clients.get_mut(&current_window) 4141 + if let Some(current_client_mut) = self.clients.get_mut(&current_window)
4176 - { 4142 + {
4177 - current_client_mut.stack_next = new_stack_next; 4143 + current_client_mut.stack_next = new_stack_next;
4178 - }
4179 - break;
4180 } 4144 }
4181 - current = current_client.stack_next;
4182 - } else {
4183 break; 4145 break;
4184 } 4146 }
4147 + current = current_client.stack_next;
4148 + } else {
4149 + break;
4185 } 4150 }
4186 } 4151 }
4187 } 4152 }