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->BitmapTextureHandle = Context.PlatformGetGPUTextureHandle(Font->BitmapMemory,
|
||||||
Font->BitmapWidth, Font->BitmapHeight);
|
Font->BitmapWidth, Font->BitmapHeight);
|
||||||
|
|
||||||
} else {}
|
} else {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,6 +378,15 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
||||||
|
|
||||||
Mouse->LeftButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
Mouse->LeftButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
||||||
Mouse->DownPos = Mouse->Pos;
|
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;
|
}break;
|
||||||
|
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
|
@ -389,6 +398,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
||||||
AddInputEventEntry(InputQueue, KeyCode_MouseMiddleButton, false, true,
|
AddInputEventEntry(InputQueue, KeyCode_MouseMiddleButton, false, true,
|
||||||
ShiftDown, AltDown, CtrlDown, false);
|
ShiftDown, AltDown, CtrlDown, false);
|
||||||
Mouse->MiddleButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
Mouse->MiddleButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
||||||
|
|
||||||
|
// :Win32MouseEventCapture
|
||||||
|
SetCapture(Window->Handle);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
|
@ -401,6 +413,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
||||||
ShiftDown, AltDown, CtrlDown, false);
|
ShiftDown, AltDown, CtrlDown, false);
|
||||||
Mouse->RightButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
Mouse->RightButtonState = KeyState_IsDown & ~KeyState_WasDown;
|
||||||
Mouse->DownPos = Mouse->Pos;
|
Mouse->DownPos = Mouse->Pos;
|
||||||
|
|
||||||
|
// :Win32MouseEventCapture
|
||||||
|
SetCapture(Window->Handle);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
|
@ -412,6 +427,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
||||||
AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, true, false,
|
AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, true, false,
|
||||||
ShiftDown, AltDown, CtrlDown, false);
|
ShiftDown, AltDown, CtrlDown, false);
|
||||||
Mouse->LeftButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
Mouse->LeftButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
||||||
|
|
||||||
|
// :Win32MouseEventCapture
|
||||||
|
ReleaseCapture();
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
|
@ -423,6 +441,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
||||||
AddInputEventEntry(InputQueue, KeyCode_MouseMiddleButton, true, false,
|
AddInputEventEntry(InputQueue, KeyCode_MouseMiddleButton, true, false,
|
||||||
ShiftDown, AltDown, CtrlDown, false);
|
ShiftDown, AltDown, CtrlDown, false);
|
||||||
Mouse->MiddleButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
Mouse->MiddleButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
||||||
|
|
||||||
|
// :Win32MouseEventCapture
|
||||||
|
ReleaseCapture();
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
|
@ -434,6 +455,9 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
|
||||||
AddInputEventEntry(InputQueue, KeyCode_MouseRightButton, true, false,
|
AddInputEventEntry(InputQueue, KeyCode_MouseRightButton, true, false,
|
||||||
ShiftDown, AltDown, CtrlDown, false);
|
ShiftDown, AltDown, CtrlDown, false);
|
||||||
Mouse->RightButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
Mouse->RightButtonState = ~KeyState_IsDown & KeyState_WasDown;
|
||||||
|
|
||||||
|
// :Win32MouseEventCapture
|
||||||
|
ReleaseCapture();
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
|
|
4
todo.txt
4
todo.txt
|
@ -15,6 +15,10 @@ x Hot Code Reloading
|
||||||
- math.h: present for trig functions
|
- math.h: present for trig functions
|
||||||
- windows.h: only thing left is InterlockedIncrement and InterlockedAdd
|
- 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
|
- File Loading
|
||||||
- Gracefully handle File Not found
|
- Gracefully handle File Not found
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue