Skip to content

Commit

Permalink
Define and use BE_ST_MouseTouchID as the touch device id representing…
Browse files Browse the repository at this point in the history
… the mouse
  • Loading branch information
NY00123 committed Jul 18, 2021
1 parent 9f1c5d0 commit 6b22768
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/backend/video/be_video_sdl.h
Expand Up @@ -9,4 +9,7 @@
typedef SDL_TouchID BE_ST_TouchID;
typedef SDL_FingerID BE_ST_FingerID;

// One exception: It's assumed the following touch id may represent the mouse
enum { BE_ST_MouseTouchID = 0 };

#endif
6 changes: 3 additions & 3 deletions src/be_st_sdl.c
Expand Up @@ -613,7 +613,7 @@ void BE_ST_PollEvents(void)

BEL_ST_CheckForHidingTouchUI();

if (BEL_ST_CheckCommonPointerPressCases(0, 0, event.button.x, event.button.y))
if (BEL_ST_CheckCommonPointerPressCases(BE_ST_MouseTouchID, 0, event.button.x, event.button.y))
break;

if (event.button.button == SDL_BUTTON_LEFT)
Expand All @@ -634,7 +634,7 @@ void BE_ST_PollEvents(void)
g_sdlMouseButtonsStates[event.button.button-1] = false;
}

if (BEL_ST_CheckCommonPointerReleaseCases(0, 0, event.button.x, event.button.y))
if (BEL_ST_CheckCommonPointerReleaseCases(BE_ST_MouseTouchID, 0, event.button.x, event.button.y))
break;

if (event.button.button == SDL_BUTTON_LEFT)
Expand All @@ -648,7 +648,7 @@ void BE_ST_PollEvents(void)
if (event.button.which == SDL_TOUCH_MOUSEID)
break;

if (BEL_ST_CheckCommonPointerMoveCases(0, 0, event.motion.x, event.motion.y))
if (BEL_ST_CheckCommonPointerMoveCases(BE_ST_MouseTouchID, 0, event.motion.x, event.motion.y))
break;

#ifdef BE_ST_SDL_ENABLE_ABSMOUSEMOTION_SETTING
Expand Down
6 changes: 3 additions & 3 deletions src/be_st_sdl_launcher.c
Expand Up @@ -2570,19 +2570,19 @@ void BE_ST_Launcher_RunEventLoop(void)
if (event.button.which == SDL_TOUCH_MOUSEID)
break;

BEL_ST_Launcher_CheckCommonPointerPressCases(0, 0, event.button.x, event.button.y, ticksBeforePoll);
BEL_ST_Launcher_CheckCommonPointerPressCases(BE_ST_MouseTouchID, 0, event.button.x, event.button.y, ticksBeforePoll);
break;
case SDL_MOUSEBUTTONUP:
if (event.button.which == SDL_TOUCH_MOUSEID)
break;

BEL_ST_Launcher_CheckCommonPointerReleaseCases(0, 0, event.button.x, event.button.y, ticksBeforePoll);
BEL_ST_Launcher_CheckCommonPointerReleaseCases(BE_ST_MouseTouchID, 0, event.button.x, event.button.y, ticksBeforePoll);
break;
case SDL_MOUSEMOTION:
if (event.button.which == SDL_TOUCH_MOUSEID)
break;

BEL_ST_Launcher_CheckCommonPointerMoveCases(0, 0, event.motion.x, event.motion.y, ticksBeforePoll);
BEL_ST_Launcher_CheckCommonPointerMoveCases(BE_ST_MouseTouchID, 0, event.motion.x, event.motion.y, ticksBeforePoll);
break;
case SDL_MOUSEWHEEL:
BE_Launcher_HandleInput_PointerVScroll(-10*event.wheel.y, ticksBeforePoll);
Expand Down

0 comments on commit 6b22768

Please sign in to comment.