Skip to content

Commit 483b8d4

Browse files
committed
x11: Implement precision/pixel scrolling
Manual rebase of #5382 with some changes for SDL3 (thanks @wooosh).
1 parent 23e08f7 commit 483b8d4

File tree

6 files changed

+247
-37
lines changed

6 files changed

+247
-37
lines changed

cmake/sdlchecks.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,17 @@ macro(CheckX11)
416416
endif()
417417
set(SDL_VIDEO_DRIVER_X11_XINPUT2 1)
418418

419+
# Check for scroll info
420+
check_c_source_compiles("
421+
#include <X11/Xlib.h>
422+
#include <X11/Xproto.h>
423+
#include <X11/extensions/XInput2.h>
424+
XIScrollClassInfo *s;
425+
int main(int argc, char **argv) {}" HAVE_XINPUT2_SCROLLINFO)
426+
if(HAVE_XINPUT2_SCROLLINFO)
427+
set(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_SCROLLINFO 1)
428+
endif()
429+
419430
# Check for multitouch
420431
check_c_source_compiles_static("
421432
#include <X11/Xlib.h>

include/build_config/SDL_build_config.h.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@
429429
#cmakedefine SDL_VIDEO_DRIVER_X11_XFIXES 1
430430
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 1
431431
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1
432+
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_SCROLLINFO 1
432433
#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR 1
433434
#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
434435
#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE 1

src/video/x11/SDL_x11video.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ void X11_VideoQuit(SDL_VideoDevice *_this)
468468
}
469469
#endif
470470

471+
X11_QuitXinput2(_this);
471472
X11_QuitModes(_this);
472473
X11_QuitKeyboard(_this);
473474
X11_QuitMouse(_this);

src/video/x11/SDL_x11window.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ static void SetupWindowInput(SDL_VideoDevice *_this, SDL_Window *window)
475475
}
476476
#endif
477477

478-
X11_Xinput2SelectTouch(_this, window);
478+
X11_Xinput2Select(_this, window);
479479

480480
{
481481
unsigned int x11_keyboard_events = KeyPressMask | KeyReleaseMask;

0 commit comments

Comments
 (0)