Skip to content

[Bug]: Opening Touchpad/Keyboard Settings momentarily collapses overlay and flashes MacroPad Home screen #127

Description

@yangyws

[Bug]: Opening Touchpad/Keyboard Settings momentarily collapses overlay and flashes MacroPad Home screen

Description

When the user is in Fullscreen Touchpad (_uiMode = TOUCHPAD) or Fullscreen Keyboard (_uiMode = KEYBOARD) mode and taps the top-right Settings gear icon, the overlay unexpectedly begins a ~250ms slide-down exit animation (slideOutVertically). This momentarily exposes the underlying MacroPad Home screen before the Settings modal overlay appears.

When closing the Settings dialog, the reverse transition occurs (the overlay slides back in), creating a noticeable and distracting visual glitch where the home screen flashes in and out.


Steps to Reproduce

  1. Launch Megingiard and open the Fullscreen Touchpad overlay or Virtual Keyboard.
  2. Tap the Settings (gear) icon on the top toolbar.
  3. Observe the bottom screen during the transition:
    • The touchpad/keyboard overlay slides down and exits.
    • The MacroPad home screen / default canvas is briefly visible.
    • The settings screen / dialog fades in.
  4. Close the settings screen:
    • The overlay slides back in from the bottom.

Root Cause Analysis

In AppStateManager.kt:

  1. _isFullscreenMouseActive and _isFullscreenKeyboardActive state flows were historically coupled to _uiMode.value == UiMode.TOUCHPAD and _uiMode.value == UiMode.KEYBOARD.
  2. When the user taps the settings icon, _uiMode transitions to TOUCHPAD_SETTINGS or KEYBOARD_SETTINGS.
  3. Because _uiMode was no longer strictly equal to TOUCHPAD or KEYBOARD, isFullscreenMouseActive / isFullscreenKeyboardActive immediately flipped to false.
  4. In MultiCutoutContainer.kt / KeyboardScreen.kt, the AnimatedVisibility wrapper observing isFullscreenMouseActive / isFullscreenKeyboardActive triggered its exit transition, dropping the overlay and revealing the base layer (MacroPad).

Expected Behavior

Opening or closing the Touchpad / Keyboard settings should be treated as an in-place modal overlay over the active touchpad/keyboard. The underlying overlay container should remain persistent in the background rather than collapsing and exposing the home screen.


Proposed Fix / Resolution

  1. Update isFullscreenMouseActive and isFullscreenKeyboardActive in AppStateManager.kt to preserve their active state when _uiMode is TOUCHPAD_SETTINGS or KEYBOARD_SETTINGS:
    val isFullscreenMouseActive: StateFlow<Boolean>
    // Persists true when entering TOUCHPAD_SETTINGS from active fullscreen mouse
    
    val isFullscreenKeyboardActive: StateFlow<Boolean>
    // Persists true when entering KEYBOARD_SETTINGS from active fullscreen keyboard
  2. When returning from settings, restore _uiMode smoothly without tearing down or re-animating the overlay container.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions