-
Notifications
You must be signed in to change notification settings - Fork 10
Mouse capture implementation question #5
Copy link
Copy link
Open
Description
Something else that I noticed...
UngrabWindow in XplatUICocoa.cs includes these lines
if (LastEnteredHwnd != IntPtr.Zero && LastEnteredHwnd != grabbed)
{
var lparam = IntPtr.Zero; // TODO: should contain mouse coords? See WindowsEventResponder.TranslateMouseEvent()
var wparam = (IntPtr)(NSEvent.CurrentModifierFlags.ToWParam() | Mac.Extensions.ButtonMaskToWParam(NSEvent.CurrentPressedMouseButtons));
SendMessage(grabbed, Msg.WM_MOUSELEAVE, wparam, lparam);
SendMessage(LastEnteredHwnd, Msg.WM_MOUSE_ENTER, wparam, lparam);
}
This leads to a nested call of WndProc with WM_MOUSELEAVE when the mouse button is released (WM_LBUTTONUP) while captured.
My code was not prepared to deal with this. I'm not daring to suggest this is a bug in XplatUICocoa.cs that needs to be fixed. Only wondering if it should be PostMessage instead of SendMessage so that the button up message handling is completed before WM_MOUSELEAVE. I figured out this is what System.Windows.Forms.CarbonInternal.MouseHandler does in TranslateMessage.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels