Extract cancel_pointing_grabs()
Browse files at this commit4ad2037997d466ffbd5ab7d690917ac64f08f137Parent: 64404051 changed file +17 -12
- src/niri.rs +17 -12
src/niri.rsmodified+17 -12
| @@ -2114,7 +2114,23 @@ impl State { | |||
| 2114 | return; | 2114 | return; |
| 2115 | }; | 2115 | }; |
| 2116 | 2116 | ||
| 2117 | - // Now that we captured the screenshots, clear grabs like drag-and-drop, etc. | 2117 | + // Now that we captured the screenshots, clear grabs. |
| 2118 | + self.cancel_pointing_grabs(); | ||
| 2119 | + | ||
| 2120 | + self.backend.with_primary_renderer(|renderer| { | ||
| 2121 | + self.niri | ||
| 2122 | + .screenshot_ui | ||
| 2123 | + .open(renderer, screenshots, default_output, show_pointer, path) | ||
| 2124 | + }); | ||
| 2125 | + | ||
| 2126 | + self.niri | ||
| 2127 | + .cursor_manager | ||
| 2128 | + .set_cursor_image(CursorImageStatus::Named(CursorIcon::Crosshair)); | ||
| 2129 | + self.niri.queue_redraw_all(); | ||
| 2130 | + } | ||
| 2131 | + | ||
| 2132 | + /// Cancel pointing device grabs like drag-and-drop, etc. | ||
| 2133 | + pub fn cancel_pointing_grabs(&mut self) { | ||
| 2118 | let time = InputTime::now(); | 2134 | let time = InputTime::now(); |
| 2119 | self.niri | 2135 | self.niri |
| 2120 | .seat | 2136 | .seat |
| @@ -2128,17 +2144,6 @@ impl State { | |||
| 2128 | for tool in self.niri.seat.tablet_seat().get_tools().into_values() { | 2144 | for tool in self.niri.seat.tablet_seat().get_tools().into_values() { |
| 2129 | tool.unset_grab(self, SERIAL_COUNTER.next_serial(), time); | 2145 | tool.unset_grab(self, SERIAL_COUNTER.next_serial(), time); |
| 2130 | } | 2146 | } |
| 2131 | - | ||
| 2132 | - self.backend.with_primary_renderer(|renderer| { | ||
| 2133 | - self.niri | ||
| 2134 | - .screenshot_ui | ||
| 2135 | - .open(renderer, screenshots, default_output, show_pointer, path) | ||
| 2136 | - }); | ||
| 2137 | - | ||
| 2138 | - self.niri | ||
| 2139 | - .cursor_manager | ||
| 2140 | - .set_cursor_image(CursorImageStatus::Named(CursorIcon::Crosshair)); | ||
| 2141 | - self.niri.queue_redraw_all(); | ||
| 2142 | } | 2147 | } |
| 2143 | 2148 | ||
| 2144 | pub fn handle_pick_color(&mut self, tx: async_channel::Sender<Option<niri_ipc::PickedColor>>) { | 2149 | pub fn handle_pick_color(&mut self, tx: async_channel::Sender<Option<niri_ipc::PickedColor>>) { |