-
Notifications
You must be signed in to change notification settings - Fork 836
Mouse mux per window isolation #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
MouseMux
wants to merge
20
commits into
mozilla-firefox:main
from
MouseMux:MouseMux-per-window-isolation
Closed
Mouse mux per window isolation #30
MouseMux
wants to merge
20
commits into
mozilla-firefox:main
from
MouseMux:MouseMux-per-window-isolation
+3,878
−939
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Simple boolean flag to enable/disable blocking of native mouse input.
Connects to MouseMux server and injects input via PostMessage directly to HWNDs. - No SendInput, no GetKeyState - only PostMessage with MouseMux data - Tracks button state internally from MouseMux events - Uses MOUSEMUX_MARKER (0x80000000) in wParam to identify injected messages - SDK v2.2.32 button event flags support
Win32 dialog with Connect/Disconnect and Block/Unblock buttons. Auto-opens on Firefox startup, always on top with taskbar entry.
- Register/unregister windows with MouseMuxService - Filter native mouse when blocking enabled, allow MOUSEMUX_MARKER messages - Strip marker before processing - F12 emergency exit when blocking enabled
- Block WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_CHAR, WM_SYSCHAR - Allow F12 through for emergency exit - Add MOUSEMUX_MARKER to keyboard messages from MouseMux
- Click on Firefox window sets that hwid as owner - Owner's mouse input always goes to owned window (even outside bounds) - Ownership transfers when different hwid clicks on window - Debug dialog shows current owner hwid in status bar
- Add MOUSEMUX_VERSION (3.0) to track builds - Add timestamps to log messages for debugging - Show version in dialog title
- Each Firefox window now has its own MouseMuxClient instance - Each window manages its own WebSocket connection to MouseMux server - Each window has its own debug dialog (auto-opens, F11 to toggle) - Connect and Block Input are separate, independent actions - Fixed SDK message parsing to use correct v2.2.33 format: - pointer.motion.notify.M2A (not pointer_motion) - pointer.button.notify.M2A (not pointer_button) - pointer.scroll.notify.M2A (not pointer_scroll) - keyboard.notify.M2A (not keyboard) - x/y coordinates (not screen_x/screen_y) - data field for button info (not event_flags) - Fixed disconnect hang by using shutdown() + detach() - Added detailed logging with build timestamp
- Reverted keyboard from SendInput to PostMessage (rules compliant) - Fixed keyboard message type: keyboard.key.notify.M2A - Fixed keyboard field name: scan (not scan_code) - Simplified keyboard ownership check - Removed Log() from Disconnect to prevent crash - Added MouseMux-rules.md documenting prohibited APIs: - NO SendInput, keybd_event, mouse_event - NO GetKeyState, GetAsyncKeyState, SetCursorPos - ONLY PostMessage/SendMessage to target HWND
- Only log button, keyboard, and other non-motion events - Reduces log noise significantly for debugging
- In nsWindow's WM_KEYDOWN/WM_KEYUP handlers, check if this is a top-level window with MouseMux connected - Use IMEHandler::GetFocusedWindow() to get Firefox's internally focused window - Forward keyboard messages to focused window instead of processing at top-level (fixes keyboard not reaching content) - Add PostMessage debug logging in MouseMuxClient This fixes the issue where PostMessage to the top-level window didn't route to the focused content area because Firefox's keyboard processing relies on GetFocus() which returns the system focus state.
Reverts the v4.9 change that required connection before enabling block. Block Input now works independently of connecting to MouseMux service.
Documents the current structure, components, and known issues. Notes: MouseMuxService and MouseMuxDebugDialog appear unused (legacy).
The keyboard events from MouseMux were being blocked by InputFilter because they didn't have MOUSEMUX_MARKER set in wParam. Fixes: 1. MouseMuxClient::HandleKeyboard now adds MOUSEMUX_MARKER to vkey 2. nsWindow keyboard forwarding now re-adds MOUSEMUX_MARKER when forwarding to focused child window (marker is stripped by InputFilter) This allows keyboard events to pass through InputFilter when blocking is enabled, same as mouse events.
The WebSocket thread was calling UpdateDebugStatus() and AppendLog() directly, which modified UI elements from a background thread. This caused deadlocks when opening multiple Firefox windows. Fix: - AppendLog now queues log text and posts WM_MOUSEMUX_LOG to UI thread - Added FlushLogToUI() called only from UI thread - Replaced direct UpdateDebugStatus() calls from WebSocket thread with PostMessage(WM_MOUSEMUX_UPDATE) - Added WM_MOUSEMUX_UPDATE and WM_MOUSEMUX_LOG message handlers This ensures all UI updates happen on the main thread, preventing cross-thread deadlocks.
- Per-window MouseMuxClient: each Firefox window owns its own client instance - Per-window InputFilter: use map<HWND, bool> instead of global static - Thread safety: non-blocking Disconnect() (detach instead of join), mThreadRunning flag with timeout wait in destructor - Multi-window fix: release ownership when mouse clicks outside window, allowing correct window to take ownership - UI improvements: show window title in dialog, left click logging, 800x400 dialog size, HWND in status bar - Removed old MouseMuxService and MouseMuxDebugDialog from build
When a window has an owner (mouse that clicked), only that owner's motion/button/wheel events are processed. Other mice moving into the window bounds are now ignored, preventing coordinate interference when multiple users are active in different windows.
…king - Motion events only processed from window owner - Button events only processed from owner (no takeover on click) - First click on unowned window claims ownership - Wheel events only processed from owner - Added per-window input filter enable/disable
- Fixed keyboard rejection logic to require positive identification - Request user list from server on connect (user.list.request.A2M) - Parse user.list.notify.M2A with devices[] array structure - Handle user.changed.notify.M2A for dynamic user updates - Block native keyboard input, only accept MouseMux events - Track per-window keyboard and mouse button state in InputFilter - KeyboardLayout uses InputFilter state instead of GetKeyState()
Contributor
|
(Automated Close) Please do not file pull requests here, see https://firefox-source-docs.mozilla.org/contributing/how_to_submit_a_patch.html |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.