Skip to content
Permalink
Browse files

[client] override new behaviour in SDL 2.0.15 and disable xinput2

xinput2 is used to get touch interface events with the side effect of
consuming MotionNotify events which we use because of SDL2's inability
to correctly track the window size. Since we are not that intertested in
touch for our usecase, we just turn the events off again.
  • Loading branch information
gnif committed Jan 13, 2020
1 parent 17e05c6 commit 406e22a681635c6229bdc1b1e64291329e7b84f8
Showing with 32 additions and 4 deletions.
  1. +1 −1 VERSION
  2. +7 −3 client/CMakeLists.txt
  3. +24 −0 client/src/main.c
@@ -1 +1 @@
B1-95-g9846762991+1
B1-96-g17e05c6fd5+1
@@ -46,6 +46,10 @@ pkg_check_modules(PKGCONFIG REQUIRED
x11
)

pkg_check_modules(PKGCONFIG_OPT
xi
)

execute_process(
COMMAND cat ../VERSION
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
@@ -63,12 +67,12 @@ get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
include_directories(
${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
${PKGCONFIG_INCLUDE_DIRS}
${PKGCONFIG_INCLUDE_DIRS} ${PKGCONFIG_OPT_INCLUDE_DIRS}
${GMP_INCLUDE_DIR}
)

link_libraries(
${PKGCONFIG_LIBRARIES}
${PKGCONFIG_LIBRARIES} ${PKGCONFIG_OPT_LIBRARIES}
${GMP_LIBRARIES}
${CMAKE_DL_LIBS}
rt
@@ -94,7 +98,7 @@ add_subdirectory(fonts)
add_subdirectory(decoders)

add_executable(looking-glass-client ${SOURCES})
target_compile_options(looking-glass-client PUBLIC ${PKGCONFIG_CFLAGS_OTHER})
target_compile_options(looking-glass-client PUBLIC ${PKGCONFIG_CFLAGS_OTHER} ${PKGCONFIG_OPT_CFLAGS_OTHER})
target_link_libraries(looking-glass-client
${EXE_FLAGS}
lg_common
@@ -35,6 +35,11 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <stdbool.h>
#include <assert.h>

#if SDL_VIDEO_DRIVER_X11_XINPUT2
// because SDL2 sucks and we need to turn it off
#include <X11/extensions/XInput2.h>
#endif

#include "common/debug.h"
#include "common/crash.h"
#include "common/KVMFR.h"
@@ -1331,6 +1336,25 @@ static int lg_run()
// enable X11 events to work around SDL2 bugs
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);

#if SDL_VIDEO_DRIVER_X11_XINPUT2
// SDL2 bug, using xinput2 disables all motion notify events
// we really don't care about touch, so turn it off and go back
// to the default behaiovur.
XIEventMask xinputmask =
{
.deviceid = XIAllMasterDevices,
.mask = 0,
.mask_len = 0
};

XISelectEvents(
state.wminfo.info.x11.display,
state.wminfo.info.x11.window,
&xinputmask,
1
);
#endif

Atom NETWM_BYPASS_COMPOSITOR = XInternAtom(
state.wminfo.info.x11.display,
"NETWM_BYPASS_COMPOSITOR",

0 comments on commit 406e22a

Please sign in to comment.
You can’t perform that action at this time.