🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

  1. Relative mode testing
  2. =====================
  3. See test program at the bottom of this file.
  4. Initial tests:
  5. - When in relative mode, the mouse shouldn't be moveable outside of the window.
  6. - When the cursor is outside the window when relative mode is enabled, mouse
  7. clicks should not go to whatever app was under the cursor previously.
  8. - When alt/cmd-tabbing between a relative mode app and another app, clicks when
  9. in the relative mode app should also not go to whatever app was under the
  10. cursor previously.
  11. Code
  12. ====
  13. #include <SDL.h>
  14. int PollEvents()
  15. {
  16. SDL_Event event;
  17. while (SDL_PollEvent(&event))
  18. {
  19. switch (event.type)
  20. {
  21. case SDL_QUIT:
  22. return 1;
  23. default:
  24. break;
  25. }
  26. }
  27. return 0;
  28. }
  29. int main(int argc, char *argv[])
  30. {
  31. SDL_Window *win;
  32. SDL_Init(SDL_INIT_VIDEO);
  33. win = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0);
  34. SDL_SetRelativeMouseMode(SDL_TRUE);
  35. while (1)
  36. {
  37. if (PollEvents())
  38. break;
  39. }
  40. SDL_DestroyWindow(win);
  41. SDL_Quit();
  42. return 0;
  43. }