Skip to content

Commit 81e5714

Browse files
committed
Child windows shouldn't take focus if the parent window is in relative mouse mode
Fixes #11807 on Windows
1 parent 3bea845 commit 81e5714

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/video/windows/SDL_windowsevents.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,16 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
11191119
if (SDL_WINDOW_IS_POPUP(data->window)) {
11201120
return MA_NOACTIVATE;
11211121
}
1122+
1123+
// Check parents to see if they are in relative mouse mode and focused
1124+
SDL_Window *parent = data->window->parent;
1125+
while (parent) {
1126+
if ((parent->flags & SDL_WINDOW_INPUT_FOCUS) &&
1127+
(parent->flags & SDL_WINDOW_MOUSE_RELATIVE_MODE)) {
1128+
return MA_NOACTIVATE;
1129+
}
1130+
parent = parent->parent;
1131+
}
11221132
} break;
11231133

11241134
case WM_SETFOCUS:

0 commit comments

Comments
 (0)