forge
Explore
Log in

Don't you dare go Hollow

b956f2775c8e115964f78551a29d26dcced31f45Ivan MolodetskikhParent: 9ff2f83
src/input/mod.rsmodified+41 -40
@@ -3065,56 +3065,57 @@ impl State {
3065 fn on_tablet_tool_tip<I: InputBackend>(&mut self, event: I::TabletToolTipEvent) {3065 fn on_tablet_tool_tip<I: InputBackend>(&mut self, event: I::TabletToolTipEvent) {
3066 let tool = self.niri.seat.tablet_seat().get_tool(&event.tool());3066 let tool = self.niri.seat.tablet_seat().get_tool(&event.tool());
3067 3067
3068- if let Some(tool) = tool {3068+ let Some(tool) = tool else {
3069- let is_overview_open = self.niri.layout.is_overview_open();3069+ return;
3070+ };
3070 3071
3071- match event.tip_state() {3072+ let is_overview_open = self.niri.layout.is_overview_open();
3072- TabletToolTipState::Down => {
3073- let serial = SERIAL_COUNTER.next_serial();
3074- tool.tip_down(serial, event.time_msec());
3075 3073
3076- if let Some(pos) = self.niri.tablet_cursor_location {3074+ match event.tip_state() {
3077- let under = self.niri.contents_under(pos);3075+ TabletToolTipState::Down => {
3078- if let Some((window, _)) = under.window {3076+ let serial = SERIAL_COUNTER.next_serial();
3079- if let Some(output) = is_overview_open.then_some(under.output).flatten()3077+ tool.tip_down(serial, event.time_msec());
3080- {3078+
3081- let mut workspaces = self.niri.layout.workspaces();3079+ if let Some(pos) = self.niri.tablet_cursor_location {
3082- if let Some(ws_idx) = workspaces.find_map(|(_, ws_idx, ws)| {3080+ let under = self.niri.contents_under(pos);
3083- ws.windows().any(|w| w.window == window).then_some(ws_idx)3081+ if let Some((window, _)) = under.window {
3084- }) {3082+ if let Some(output) = is_overview_open.then_some(under.output).flatten() {
3085- drop(workspaces);3083+ let mut workspaces = self.niri.layout.workspaces();
3086- self.niri.layout.focus_output(&output);3084+ if let Some(ws_idx) = workspaces.find_map(|(_, ws_idx, ws)| {
3087- self.niri.layout.toggle_overview_to_workspace(ws_idx);3085+ ws.windows().any(|w| w.window == window).then_some(ws_idx)
3088- }3086+ }) {
3087+ drop(workspaces);
3088+ self.niri.layout.focus_output(&output);
3089+ self.niri.layout.toggle_overview_to_workspace(ws_idx);
3089 }3090 }
3091+ }
3090 3092
3091- self.niri.layout.activate_window(&window);3093+ self.niri.layout.activate_window(&window);
3092 3094
3093- // FIXME: granular.3095+ // FIXME: granular.
3094- self.niri.queue_redraw_all();3096+ self.niri.queue_redraw_all();
3095- } else if let Some((output, ws)) = is_overview_open3097+ } else if let Some((output, ws)) = is_overview_open
3096- .then(|| self.niri.workspace_under(false, pos))3098+ .then(|| self.niri.workspace_under(false, pos))
3097- .flatten()3099+ .flatten()
3098- {3100+ {
3099- let ws_idx = self.niri.layout.find_workspace_by_id(ws.id()).unwrap().0;3101+ let ws_idx = self.niri.layout.find_workspace_by_id(ws.id()).unwrap().0;
3100 3102
3101- self.niri.layout.focus_output(&output);3103+ self.niri.layout.focus_output(&output);
3102- self.niri.layout.toggle_overview_to_workspace(ws_idx);3104+ self.niri.layout.toggle_overview_to_workspace(ws_idx);
3103 3105
3104- // FIXME: granular.3106+ // FIXME: granular.
3105- self.niri.queue_redraw_all();3107+ self.niri.queue_redraw_all();
3106- } else if let Some(output) = under.output {3108+ } else if let Some(output) = under.output {
3107- self.niri.layout.focus_output(&output);3109+ self.niri.layout.focus_output(&output);
3108 3110
3109- // FIXME: granular.3111+ // FIXME: granular.
3110- self.niri.queue_redraw_all();3112+ self.niri.queue_redraw_all();
3111- }
3112- self.niri.focus_layer_surface_if_on_demand(under.layer);
3113 }3113 }
3114+ self.niri.focus_layer_surface_if_on_demand(under.layer);
3114 }3115 }
3115- TabletToolTipState::Up => {3116+ }
3116- tool.tip_up(event.time_msec());3117+ TabletToolTipState::Up => {
3117- }3118+ tool.tip_up(event.time_msec());
3118 }3119 }
3119 }3120 }
3120 }3121 }