diff --git a/CMakeLists.txt b/CMakeLists.txt index afb3d71a0ec..73437c63635 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,10 @@ else() option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF) endif() +if(UNIX AND NOT APPLE) + option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support)" ON) +endif() + # Modifiers option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON) option(WITH_MOD_DECIMATE "Enable Decimate Modifier" ON) @@ -384,7 +388,11 @@ if(UNIX AND NOT APPLE) mark_as_advanced(X11_XF86keysym_INCLUDE_PATH) # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed - set(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}") + set(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB}") + + if(WITH_X11_XINPUT) + list(APPEND LLIBS ${X11_Xinput_LIB}) + endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux") if(NOT WITH_PYTHON_MODULE) diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 33185a63d5b..d629b44a106 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -118,6 +118,11 @@ if(APPLE) endif() elseif(UNIX) + + if(WITH_X11_XINPUT) + add_definitions(-DWITH_X11_XINPUT) + endif() + list(APPEND INC ${X11_X11_INCLUDE_PATH}) list(APPEND SRC diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript index 7aedc08ce96..b67545f216a 100644 --- a/intern/ghost/SConscript +++ b/intern/ghost/SConscript @@ -21,7 +21,8 @@ if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'fr sources.remove('intern' + os.sep + f + 'Carbon.cpp') except ValueError: pass - defs += ['PREFIX=\\"/usr/local/\\"'] + defs += ['PREFIX=\\"/usr/local/\\"'] # XXX, make an option + defs += ['WITH_X11_XINPUT'] # XXX, make an option elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'): for f in pf: diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 890c40f6f11..3578ae8619f 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -439,7 +439,9 @@ GHOST_WindowX11( setTitle(title); +#ifdef WITH_X11_XINPUT initXInputDevices(); +#endif // now set up the rendering context. if (installDrawingContext(type) == GHOST_kSuccess) { @@ -493,6 +495,8 @@ static bool match_token(const char *haystack, const char *needle) return FALSE; } +#ifdef WITH_X11_XINPUT + /* Determining if an X device is a Tablet style device is an imperfect science. ** We rely on common conventions around device names as well as the type reported ** by Wacom tablets. This code will likely need to be expanded for alternate tablet types @@ -652,8 +656,9 @@ void GHOST_WindowX11::initXInputDevices() } XFree(version); } -} +} +#endif /* WITH_X11_XINPUT */ Window GHOST_WindowX11:: @@ -1275,14 +1280,16 @@ GHOST_WindowX11:: if (m_custom_cursor) { XFreeCursor(m_display, m_custom_cursor); } - + +#ifdef WITH_X11_XINPUT /* close tablet devices */ if(m_xtablet.StylusDevice) XCloseDevice(m_display, m_xtablet.StylusDevice); if(m_xtablet.EraserDevice) XCloseDevice(m_display, m_xtablet.EraserDevice); - +#endif /* WITH_X11_XINPUT */ + if (m_context != s_firstContext) { glXDestroyContext(m_display, m_context); }