Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Commit

Permalink
Mouse grab fixes, OSD notify on mouse waiting, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgblgblgb committed Jun 21, 2015
1 parent 9a1ee4b commit 2eae7af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion input.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
static int _mouse_dx, _mouse_dy, _mouse_grab = 0;
static Uint8 _mouse_data_byte, _mouse_data_half, _mouse_last_shift, _mouse_read_state, _mouse_button_state;
static int _mouse_pulse = 0; // try to detect SymbOS or other simllar tests
static int _mouse_wait_warn = 1;


int mouse_is_enabled ( void )
{
if (!_mouse_grab && _mouse_pulse) {
if (_mouse_wait_warn) {
OSD("App may wait for mouse\nClick for grabbing");
_mouse_wait_warn = 0;
warn_for_mouse_grab = 0;
}
}
return _mouse_grab || _mouse_pulse;
}

Expand Down Expand Up @@ -196,9 +204,10 @@ void mouse_check_data_shift(Uint8 val)
void emu_kbd(SDL_Keysym sym, int press)
{
int a = 0;
if (_mouse_grab && sym.scancode == SDL_SCANCODE_ESCAPE) {
if (_mouse_grab && sym.scancode == SDL_SCANCODE_ESCAPE && press) {
_mouse_grab = 0;
screen_grab(SDL_FALSE);
return; // do not forward ESC press, it's only leave mouse grab mode now!
}
printf("KEY: scan=%d sym=%d press=%d\n", sym.scancode, sym.sym, press);
while (keytable[a][0] != -1)
Expand Down
2 changes: 1 addition & 1 deletion screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int is_fullscreen = 0;
SDL_Window *sdl_win = NULL;
static SDL_Renderer *sdl_ren = NULL;
static SDL_Texture *sdl_tex = NULL, *sdl_osdtex = NULL;
static int warn_for_mouse_grab = 1;
int warn_for_mouse_grab = 1;
Uint32 sdl_winid;
static int win_xsize, win_ysize, resize_counter = 0, win_size_changed = 0;
static int screenshot_index = 0;
Expand Down
2 changes: 1 addition & 1 deletion xepem.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,6 @@ extern SDL_Window *sdl_win;
extern int is_fullscreen;
void osd_disable ( void );
void osd_notification ( const char *s );
extern int warn_for_mouse_grab;

#endif

0 comments on commit 2eae7af

Please sign in to comment.