feat: Integrate window manager for desktop windowing support and enhance input handling

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-20 11:25:05 +01:00
parent 10eaef9690
commit c81eb6750d
6 changed files with 128 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ class Wolf3dFlutterInput extends Wolf3dInput {
double _mouseDeltaY = 0.0;
bool _previousMouseRightDown = false;
bool _queuedBack = false;
final Set<WolfInputAction> _suppressedActionsOnce = <WolfInputAction>{};
// Mouse-look is optional so touch or keyboard-only hosts can keep the same
// adapter without incurring accidental pointer-driven movement.
@@ -153,8 +154,21 @@ class Wolf3dFlutterInput extends Wolf3dInput {
_queuedBack = true;
}
/// Suppresses [action] for the next [update] tick only.
void suppressActionOnce(WolfInputAction action) {
_suppressedActionsOnce.add(action);
}
/// Convenience helper for host shortcuts that consume Enter/Interact.
void suppressInteractOnce() {
suppressActionOnce(WolfInputAction.interact);
}
/// Returns whether any bound key for [action] is currently pressed.
bool _isActive(WolfInputAction action, Set<LogicalKeyboardKey> pressedKeys) {
if (_suppressedActionsOnce.contains(action)) {
return false;
}
return bindings[action]!.any((key) => pressedKeys.contains(key));
}
@@ -163,6 +177,9 @@ class Wolf3dFlutterInput extends Wolf3dInput {
WolfInputAction action,
Set<LogicalKeyboardKey> newlyPressed,
) {
if (_suppressedActionsOnce.contains(action)) {
return false;
}
return bindings[action]!.any((key) => newlyPressed.contains(key));
}
@@ -223,5 +240,6 @@ class Wolf3dFlutterInput extends Wolf3dInput {
_previousKeys = Set.from(pressedKeys);
_previousMouseRightDown = isMouseRightDown;
_queuedBack = false;
_suppressedActionsOnce.clear();
}
}