Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,22 @@ private IntPtr InputFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lP
IntPtr result = IntPtr.Zero ;
WindowMessage message = (WindowMessage)msg;

if (message == WindowMessage.WM_DESTROY)
{
// shut down the stylus stack on WM_DESTROY. This is normally done
// in PublicHooksFilterMessage (see remarks there), but that won't
// get called if no public hooks have ever been installed. Do it
// here as a backup for that case.
// For maintenance, there are three workflows to consider:
// 1. The normal case - public hooks are present, none of them
// handle WM_DESTROY. DisposeStylusInputProvider gets
// called twice, but the second call is a no-op.
// 2. No public hooks present. Only this call happens.
// 3. Public hooks are present, one of them handles WM_DESTROY.
// Only the call in PublicHooksFilterMessage happens.
DisposeStylusInputProvider();
}

// NOTE (alexz): invoke _stylus.FilterMessage before _mouse.FilterMessage
// to give _stylus a chance to eat mouse message generated by stylus
if (!_isDisposed && _stylus != null && !handled)
Expand Down