Skip to content

Commit

Permalink
Fix input focus issue on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Dec 31, 2023
1 parent 01a676e commit 0f4df75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/media/media.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,6 @@ ctr_object* ctr_media_screen(ctr_object* myself, ctr_argument* argumentList) {
return myself;
}
while (SDL_PollEvent(&event)) {

player = NULL;
focusImage = NULL;
if (controllableObject) {
Expand Down Expand Up @@ -1228,6 +1227,11 @@ ctr_object* ctr_media_screen(ctr_object* myself, ctr_argument* argumentList) {
}
break;
case SDL_MOUSEBUTTONDOWN:
//If we have lost the focus, regain upon click
if (!SDL_GetKeyboardFocus()) {
SDL_RaiseWindow(CtrMediaWindow);
SDL_SetWindowInputFocus(CtrMediaWindow); //might return an error, but what can we do?
}
if (ctr_internal_media_mouse_down(event)) return CtrStdFlow;
break;
case SDL_CONTROLLERBUTTONDOWN:
Expand Down

0 comments on commit 0f4df75

Please sign in to comment.