Skip to content

Commit

Permalink
bugfix: keyboard and mouse was not always grabbed (#1351)
Browse files Browse the repository at this point in the history
When going from GUI->Emulation repeatedly, sometimes the input was not grabbed as expected
  • Loading branch information
midwan committed Jun 13, 2024
1 parent 58f495e commit 716b067
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/osdep/amiberry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,18 +615,21 @@ bool ismouseactive (void)
//TODO: maybe implement this
void target_inputdevice_unacquire(bool full)
{
struct AmigaMonitor* mon = &AMonitors[0];
//close_tablet(tablet);
//tablet = NULL;
//if (full) {
// rawinput_release();
//}
if (full) {
//rawinput_release();
SDL_SetWindowGrab(mon->amiga_window, SDL_TRUE);
}
}
void target_inputdevice_acquire(void)
{
struct AmigaMonitor* mon = &AMonitors[0];
target_inputdevice_unacquire(false);
//tablet = open_tablet(mon->hAmigaWnd);
//rawinput_alloc();
SDL_SetWindowGrab(mon->amiga_window, SDL_TRUE);
}

static void setmouseactive2(struct AmigaMonitor* mon, int active, bool allowpause)
Expand Down
2 changes: 2 additions & 0 deletions src/osdep/amiberry_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ void gui_display(int shortcut)
setmouseactive(0, 1);
}
//rawinput_alloc();
struct AmigaMonitor* mon = &AMonitors[0];
SDL_SetWindowGrab(mon->amiga_window, SDL_TRUE);
fpscounter_reset();
//screenshot_free();
//write_disk_history();
Expand Down
3 changes: 2 additions & 1 deletion src/osdep/gui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void amiberry_gui_init()
Uint32 mode;
if (sdl_mode.w >= 800 && sdl_mode.h >= 600 && !kmsdrm_detected)
{
mode = SDL_WINDOW_RESIZABLE;
mode = SDL_WINDOW_RESIZABLE;
if (currprefs.gui_alwaysontop)
mode |= SDL_WINDOW_ALWAYS_ON_TOP;
if (currprefs.start_minimized)
Expand Down Expand Up @@ -372,6 +372,7 @@ void amiberry_gui_init()
SDL_SetRelativeMouseMode(SDL_FALSE);
SDL_ShowCursor(SDL_ENABLE);

SDL_SetWindowGrab(mon->gui_window, SDL_TRUE);
SDL_RaiseWindow(mon->gui_window);

//-------------------------------------------------
Expand Down

0 comments on commit 716b067

Please sign in to comment.