add cmake option to build without xinput (tablet support)

This commit is contained in:
Campbell Barton 2011-03-25 04:56:48 +00:00
parent 2c04bab116
commit 5f8fa29755
4 changed files with 26 additions and 5 deletions

View File

@ -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)

View File

@ -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

View File

@ -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:

View File

@ -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);
}