per-window option to disable grabbing

This commit is contained in:
galister
2025-12-13 21:44:15 +09:00
parent 6793a163af
commit ff4b39069c
11 changed files with 26 additions and 8 deletions

View File

@@ -251,6 +251,17 @@ fn make_edit_panel(app: &mut AppState) -> anyhow::Result<EditModeWrapPanel> {
.enqueue(TaskType::Overlay(OverlayTask::Modify(sel, task)));
Ok(EventResult::Consumed)
}),
"::EditModeToggleGrab" => Box::new(move |_common, _data, app, state| {
let sel = OverlaySelector::Id(*state.id.borrow());
app.tasks.enqueue(TaskType::Overlay(OverlayTask::Modify(
sel,
Box::new(|_app, owc| {
let state = owc.active_state.as_mut().unwrap(); //want panic
state.grabbable = !state.grabbable;
}),
)));
Ok(EventResult::Consumed)
}),
"::EditModeTab" => {
let tab_name = args.next().unwrap().to_owned();
Box::new(move |common, _data, _app, state| {

View File

@@ -1,6 +1,6 @@
use std::{collections::HashMap, rc::Rc};
use glam::{vec2, vec3, Affine3A, FloatExt, Mat4, Quat, Vec2, Vec3};
use glam::{Affine3A, FloatExt, Mat4, Quat, Vec2, Vec3, vec2, vec3};
use wgui::{
animation::{Animation, AnimationEasing},
assets::AssetPath,
@@ -11,10 +11,10 @@ use wgui::{
renderer_vk::util,
taffy::{self, prelude::length},
widget::{
EventResult,
div::WidgetDiv,
rectangle::{WidgetRectangle, WidgetRectangleParams},
util::WLength,
EventResult,
},
};
use wlx_common::windowing::{OverlayWindowState, Positioning};
@@ -22,14 +22,14 @@ use wlx_common::windowing::{OverlayWindowState, Positioning};
use crate::{
gui::panel::GuiPanel,
state::AppState,
subsystem::hid::{XkbKeymap, ALT, CTRL, META, SHIFT, SUPER},
subsystem::hid::{ALT, CTRL, META, SHIFT, SUPER, XkbKeymap},
windowing::window::OverlayWindowConfig,
};
use super::{
handle_press, handle_release,
KEYBOARD_NAME, KeyButtonData, KeyState, KeyboardBackend, KeyboardState, handle_press,
handle_release,
layout::{self, AltModifier, KeyCapType},
KeyButtonData, KeyState, KeyboardBackend, KeyboardState, KEYBOARD_NAME,
};
const BACKGROUND_PADDING: f32 = 16.0;

View File

@@ -1,6 +1,6 @@
use std::{f32::consts::PI, sync::Arc};
use glam::{vec3, Affine3A, Quat, Vec3};
use glam::{Affine3A, Quat, Vec3, vec3};
use wlx_capture::frame::Transform;
use wlx_common::windowing::{OverlayWindowState, Positioning};