MacOS Trackpad fixes in SDL demos
Fix lost Trackpad events in the SDL demos, caused by compressing key/button events which shouldn't be compressed.
This commit is contained in:
parent
821cdf3c15
commit
7844277871
@ -201,6 +201,11 @@ int main(int argc, char **argv)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* We don't want to compress key up/down nor mouse button up/down buttons,
|
||||
because MacOS generates two events per Trackpad tap, and they could be lost. */
|
||||
if((event.type==SDL_MOUSEBUTTONUP)||(event.type==SDL_MOUSEBUTTONDOWN)||
|
||||
(event.type==SDL_KEYUP)||(event.type==SDL_KEYDOWN)) break;
|
||||
}
|
||||
nk_input_end(&(context->ctx));
|
||||
|
||||
|
@ -138,6 +138,11 @@ main(int argc, char *argv[])
|
||||
while (SDL_PollEvent(&evt)) {
|
||||
if (evt.type == SDL_QUIT) goto cleanup;
|
||||
nk_sdl_handle_event(&evt);
|
||||
|
||||
/* We don't want to compress key up/down nor mouse button up/down buttons,
|
||||
because MacOS generates two events per Trackpad tap, and they could be lost. */
|
||||
if((evt.type==SDL_MOUSEBUTTONUP)||(evt.type==SDL_MOUSEBUTTONDOWN)||
|
||||
(evt.type==SDL_KEYUP)||(evt.type==SDL_KEYDOWN)) break;
|
||||
}
|
||||
nk_input_end(ctx);
|
||||
|
||||
|
@ -149,6 +149,11 @@ int main(int argc, char *argv[])
|
||||
while (SDL_PollEvent(&evt)) {
|
||||
if (evt.type == SDL_QUIT) goto cleanup;
|
||||
nk_sdl_handle_event(&evt);
|
||||
|
||||
/* We don't want to compress key up/down nor mouse button up/down buttons,
|
||||
because MacOS generates two events per Trackpad tap, and they could be lost. */
|
||||
if((evt.type==SDL_MOUSEBUTTONUP)||(evt.type==SDL_MOUSEBUTTONDOWN)||
|
||||
(evt.type==SDL_KEYUP)||(evt.type==SDL_KEYDOWN)) break;
|
||||
} nk_input_end(ctx);
|
||||
|
||||
/* GUI */
|
||||
|
@ -176,6 +176,11 @@ main(int argc, char *argv[])
|
||||
while (SDL_PollEvent(&evt)) {
|
||||
if (evt.type == SDL_QUIT) goto cleanup;
|
||||
nk_sdl_handle_event(&evt);
|
||||
|
||||
/* We don't want to compress key up/down nor mouse button up/down buttons,
|
||||
because MacOS generates two events per Trackpad tap, and they could be lost. */
|
||||
if((evt.type==SDL_MOUSEBUTTONUP)||(evt.type==SDL_MOUSEBUTTONDOWN)||
|
||||
(evt.type==SDL_KEYUP)||(evt.type==SDL_KEYDOWN)) break;
|
||||
}
|
||||
nk_input_end(ctx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user