Skip to content

Commit

Permalink
Make sure we grab the mouse always on startup, not just when using Fu…
Browse files Browse the repository at this point in the history
…llscreen
  • Loading branch information
midwan committed Feb 7, 2021
1 parent e03f375 commit e906a52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/osdep/amiberry_gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,8 @@ static void open_screen(struct uae_prefs* p)

picasso_refresh(mon->monitor_id);

if (isfullscreen() != 0)
// We want to grab the mouse always, not just in Fullscreen mode!
//if (isfullscreen() != 0)
setmouseactive(mon->monitor_id, -1);
}

Expand Down
11 changes: 11 additions & 0 deletions src/osdep/amiberry_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "inputdevice.h"
#include "amiberry_input.h"


#include "amiberry_gfx.h"
#include "fsdb.h"
#include "uae.h"
#include "xwin.h"
Expand Down Expand Up @@ -251,7 +253,10 @@ static int acquire_mouse(const int num, int flags)
return 1;
}

struct AmigaMonitor* mon = &AMonitors[0];
struct didata* did = &di_mouse[num];
SDL_SetWindowGrab(mon->sdl_window, SDL_TRUE);
SDL_ShowCursor(SDL_DISABLE);
did->acquired = 1;
return did->acquired > 0 ? 1 : 0;
}
Expand All @@ -263,6 +268,8 @@ static void unacquire_mouse(int num)
}

struct didata* did = &di_mouse[num];
struct AmigaMonitor* mon = &AMonitors[0];
SDL_SetWindowGrab(mon->sdl_window, SDL_FALSE);
did->acquired = 0;
}

Expand Down Expand Up @@ -516,14 +523,18 @@ static void release_keys(void)

static int acquire_kb(int num, int flags)
{
struct AmigaMonitor* mon = &AMonitors[0];
struct didata* did = &di_keyboard[num];
SDL_SetWindowGrab(mon->sdl_window, SDL_TRUE);
did->acquired = 1;
return did->acquired > 0 ? 1 : 0;
}

static void unacquire_kb(int num)
{
struct didata* did = &di_keyboard[num];
struct AmigaMonitor* mon = &AMonitors[0];
SDL_SetWindowGrab(mon->sdl_window, SDL_FALSE);
did->acquired = 0;
}

Expand Down

0 comments on commit e906a52

Please # to comment.