Handle releasing the mouse button outside the window when the button was pressed over top of the window.
This commit is contained in:
parent
43534ac86d
commit
759b5f6906
|
@ -140,7 +140,6 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
|||
|
||||
Font->BitmapTextureHandle = Context.PlatformGetGPUTextureHandle(Font->BitmapMemory,
|
||||
Font->BitmapWidth, Font->BitmapHeight);
|
||||
|
||||
} else {}
|
||||
}
|
||||
|
||||
|
|
|
@ -378,6 +378,15 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
|||
|
||||
Mouse->LeftButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
||||
Mouse->DownPos = Mouse->Pos;
|
||||
|
||||
// :Win32MouseEventCapture
|
||||
// NOTE(Peter): We capture events when the mouse goes down so that
|
||||
// if the user drags outside the window, we still get the mouse up
|
||||
// event and can process it. Otherwise, we can get into cases where
|
||||
// an event was started, didn't end, but the user can click again and
|
||||
// try to start the event again.
|
||||
// We relase event capture on mouse up.
|
||||
SetCapture(Window->Handle);
|
||||
}break;
|
||||
|
||||
case WM_MBUTTONDOWN:
|
||||
|
@ -389,6 +398,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
|||
AddInputEventEntry(InputQueue, KeyCode_MouseMiddleButton, false, true,
|
||||
ShiftDown, AltDown, CtrlDown, false);
|
||||
Mouse->MiddleButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
||||
|
||||
// :Win32MouseEventCapture
|
||||
SetCapture(Window->Handle);
|
||||
}break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
|
@ -401,6 +413,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
|||
ShiftDown, AltDown, CtrlDown, false);
|
||||
Mouse->RightButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
||||
Mouse->DownPos = Mouse->Pos;
|
||||
|
||||
// :Win32MouseEventCapture
|
||||
SetCapture(Window->Handle);
|
||||
}break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
|
@ -412,6 +427,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
|||
AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, true, false,
|
||||
ShiftDown, AltDown, CtrlDown, false);
|
||||
Mouse->LeftButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
||||
|
||||
// :Win32MouseEventCapture
|
||||
ReleaseCapture();
|
||||
}break;
|
||||
|
||||
case WM_MBUTTONUP:
|
||||
|
@ -423,6 +441,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
|||
AddInputEventEntry(InputQueue, KeyCode_MouseMiddleButton, true, false,
|
||||
ShiftDown, AltDown, CtrlDown, false);
|
||||
Mouse->MiddleButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
||||
|
||||
// :Win32MouseEventCapture
|
||||
ReleaseCapture();
|
||||
}break;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
|
@ -434,6 +455,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
|||
AddInputEventEntry(InputQueue, KeyCode_MouseRightButton, true, false,
|
||||
ShiftDown, AltDown, CtrlDown, false);
|
||||
Mouse->RightButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
||||
|
||||
// :Win32MouseEventCapture
|
||||
ReleaseCapture();
|
||||
}break;
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
|
|
4
todo.txt
4
todo.txt
|
@ -15,6 +15,10 @@ x Hot Code Reloading
|
|||
- math.h: present for trig functions
|
||||
- windows.h: only thing left is InterlockedIncrement and InterlockedAdd
|
||||
|
||||
- Win32 Platform Layer
|
||||
x Capture Mouse Events that start on the window but end outside
|
||||
x Mouse up when mouse down was in the window
|
||||
|
||||
- File Loading
|
||||
- Gracefully handle File Not found
|
||||
|
||||
|
|
Loading…
Reference in New Issue