input: Filter allowed_during_screenshot() for non-kb binds
Browse files at this commitcba0454c940ac9a5406c89853649caee9c5a18a2Parent: 5f6f1311 changed file +43 -8
- src/input/mod.rs +43 -8
src/input/mod.rsmodified+43 -8
| @@ -2818,6 +2818,9 @@ impl State { | |||
| 2818 | let bindings = | 2818 | let bindings = |
| 2819 | make_binds_iter(&config, &mut self.niri.window_mru_ui, modifiers); | 2819 | make_binds_iter(&config, &mut self.niri.window_mru_ui, modifiers); |
| 2820 | find_configured_bind(bindings, mod_key, trigger, mods) | 2820 | find_configured_bind(bindings, mod_key, trigger, mods) |
| 2821 | + }) | ||
| 2822 | + .filter(|bind| { | ||
| 2823 | + !self.niri.screenshot_ui.is_open() || allowed_during_screenshot(&bind.action) | ||
| 2821 | }) { | 2824 | }) { |
| 2822 | self.niri.suppressed_buttons.insert(button_code); | 2825 | self.niri.suppressed_buttons.insert(button_code); |
| 2823 | self.handle_bind(bind.clone()); | 2826 | self.handle_bind(bind.clone()); |
| @@ -3173,13 +3176,21 @@ impl State { | |||
| 3173 | mod_key, | 3176 | mod_key, |
| 3174 | Trigger::WheelScrollLeft, | 3177 | Trigger::WheelScrollLeft, |
| 3175 | mods, | 3178 | mods, |
| 3176 | - ); | 3179 | + ) |
| 3180 | + .filter(|bind| { | ||
| 3181 | + !self.niri.screenshot_ui.is_open() | ||
| 3182 | + || allowed_during_screenshot(&bind.action) | ||
| 3183 | + }); | ||
| 3177 | let bind_right = find_configured_bind( | 3184 | let bind_right = find_configured_bind( |
| 3178 | bindings, | 3185 | bindings, |
| 3179 | mod_key, | 3186 | mod_key, |
| 3180 | Trigger::WheelScrollRight, | 3187 | Trigger::WheelScrollRight, |
| 3181 | mods, | 3188 | mods, |
| 3182 | - ); | 3189 | + ) |
| 3190 | + .filter(|bind| { | ||
| 3191 | + !self.niri.screenshot_ui.is_open() | ||
| 3192 | + || allowed_during_screenshot(&bind.action) | ||
| 3193 | + }); | ||
| 3183 | (bind_left, bind_right) | 3194 | (bind_left, bind_right) |
| 3184 | }; | 3195 | }; |
| 3185 | 3196 | ||
| @@ -3260,9 +3271,17 @@ impl State { | |||
| 3260 | mod_key, | 3271 | mod_key, |
| 3261 | Trigger::WheelScrollUp, | 3272 | Trigger::WheelScrollUp, |
| 3262 | mods, | 3273 | mods, |
| 3263 | - ); | 3274 | + ) |
| 3275 | + .filter(|bind| { | ||
| 3276 | + !self.niri.screenshot_ui.is_open() | ||
| 3277 | + || allowed_during_screenshot(&bind.action) | ||
| 3278 | + }); | ||
| 3264 | let bind_down = | 3279 | let bind_down = |
| 3265 | - find_configured_bind(bindings, mod_key, Trigger::WheelScrollDown, mods); | 3280 | + find_configured_bind(bindings, mod_key, Trigger::WheelScrollDown, mods) |
| 3281 | + .filter(|bind| { | ||
| 3282 | + !self.niri.screenshot_ui.is_open() | ||
| 3283 | + || allowed_during_screenshot(&bind.action) | ||
| 3284 | + }); | ||
| 3266 | (bind_up, bind_down) | 3285 | (bind_up, bind_down) |
| 3267 | }; | 3286 | }; |
| 3268 | 3287 | ||
| @@ -3405,9 +3424,17 @@ impl State { | |||
| 3405 | mod_key, | 3424 | mod_key, |
| 3406 | Trigger::TouchpadScrollLeft, | 3425 | Trigger::TouchpadScrollLeft, |
| 3407 | mods, | 3426 | mods, |
| 3408 | - ); | 3427 | + ) |
| 3428 | + .filter(|bind| { | ||
| 3429 | + !self.niri.screenshot_ui.is_open() | ||
| 3430 | + || allowed_during_screenshot(&bind.action) | ||
| 3431 | + }); | ||
| 3409 | let bind_right = | 3432 | let bind_right = |
| 3410 | - find_configured_bind(bindings, mod_key, Trigger::TouchpadScrollRight, mods); | 3433 | + find_configured_bind(bindings, mod_key, Trigger::TouchpadScrollRight, mods) |
| 3434 | + .filter(|bind| { | ||
| 3435 | + !self.niri.screenshot_ui.is_open() | ||
| 3436 | + || allowed_during_screenshot(&bind.action) | ||
| 3437 | + }); | ||
| 3411 | drop(config); | 3438 | drop(config); |
| 3412 | 3439 | ||
| 3413 | if let Some(right) = bind_right { | 3440 | if let Some(right) = bind_right { |
| @@ -3435,9 +3462,17 @@ impl State { | |||
| 3435 | mod_key, | 3462 | mod_key, |
| 3436 | Trigger::TouchpadScrollUp, | 3463 | Trigger::TouchpadScrollUp, |
| 3437 | mods, | 3464 | mods, |
| 3438 | - ); | 3465 | + ) |
| 3466 | + .filter(|bind| { | ||
| 3467 | + !self.niri.screenshot_ui.is_open() | ||
| 3468 | + || allowed_during_screenshot(&bind.action) | ||
| 3469 | + }); | ||
| 3439 | let bind_down = | 3470 | let bind_down = |
| 3440 | - find_configured_bind(bindings, mod_key, Trigger::TouchpadScrollDown, mods); | 3471 | + find_configured_bind(bindings, mod_key, Trigger::TouchpadScrollDown, mods) |
| 3472 | + .filter(|bind| { | ||
| 3473 | + !self.niri.screenshot_ui.is_open() | ||
| 3474 | + || allowed_during_screenshot(&bind.action) | ||
| 3475 | + }); | ||
| 3441 | drop(config); | 3476 | drop(config); |
| 3442 | 3477 | ||
| 3443 | if let Some(down) = bind_down { | 3478 | if let Some(down) = bind_down { |