mirror of
https://github.com/encounter/SDL.git
synced 2025-12-18 09:25:29 +00:00
Expose separate keyboard and mouse grab support
This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(), SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise this functionality and makes a minor fix to X11 that I missed in https://hg.libsdl.org/SDL/rev/02a2d609369b To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards compatibility with older code.
This commit is contained in:
@@ -183,7 +183,7 @@ static VOID _mouseCheck(WINDATA *pWinData)
|
||||
{
|
||||
SDL_Mouse *pSDLMouse = SDL_GetMouse();
|
||||
|
||||
if ((pSDLMouse->relative_mode || (pWinData->window->flags & SDL_WINDOW_INPUT_GRABBED) != 0) &&
|
||||
if ((pSDLMouse->relative_mode || (pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) &&
|
||||
((pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0)) {
|
||||
/* We will make a real capture in _wmMouseButton() */
|
||||
} else {
|
||||
@@ -232,7 +232,7 @@ static VOID _wmMouseMove(WINDATA *pWinData, SHORT lX, SHORT lY)
|
||||
|
||||
if (!pSDLMouse->relative_mode || pSDLMouse->relative_mode_warp) {
|
||||
if (!pSDLMouse->relative_mode && fWinActive &&
|
||||
((pWinData->window->flags & SDL_WINDOW_INPUT_GRABBED) != 0) &&
|
||||
((pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) &&
|
||||
(WinQueryCapture(HWND_DESKTOP) == pWinData->hwnd)) {
|
||||
|
||||
pointl.x = lX;
|
||||
@@ -281,7 +281,7 @@ static VOID _wmMouseButton(WINDATA *pWinData, ULONG ulButton, BOOL fDown)
|
||||
SDL_BUTTON_MIDDLE };
|
||||
SDL_Mouse *pSDLMouse = SDL_GetMouse();
|
||||
|
||||
if ((pSDLMouse->relative_mode || ((pWinData->window->flags & SDL_WINDOW_INPUT_GRABBED) != 0)) &&
|
||||
if ((pSDLMouse->relative_mode || ((pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0)) &&
|
||||
((pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) &&
|
||||
(WinQueryCapture(HWND_DESKTOP) != pWinData->hwnd)) {
|
||||
/* Mouse should be captured. */
|
||||
|
||||
Reference in New Issue
Block a user