Fix again tablets with linux!

Yes, for me tablets (both wacom and no-name) were again broken - curse X11!
So now, we want ButtonPress, Button1Motion does not work anymore...

Anyway, this patch makes things much cleaner, storing each event type
in its own variable!

Patch by cedricp (Cédric PAILLE) from T43367, thanks a bunch!
This commit is contained in:
Bastien Montagne 2015-02-13 10:52:30 +01:00
parent 46151a6a69
commit e63594a6e5
3 changed files with 18 additions and 8 deletions

View File

@ -1181,7 +1181,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
default:
{
#ifdef WITH_X11_XINPUT
if (xe->type == m_xtablet.MotionEvent) {
if (xe->type == m_xtablet.MotionEvent ||
xe->type == m_xtablet.MotionEventEraser ||
xe->type == m_xtablet.PressEvent ||
xe->type == m_xtablet.PressEventEraser)
{
XDeviceMotionEvent *data = (XDeviceMotionEvent *)xe;
const unsigned char axis_first = data->first_axis;
const unsigned char axes_end = axis_first + data->axes_count; /* after the last */

View File

@ -286,6 +286,12 @@ public:
int MotionEvent;
int ProxInEvent;
int ProxOutEvent;
int PressEvent;
int MotionEventEraser;
int ProxInEventEraser;
int ProxOutEventEraser;
int PressEventEraser;
int PressureLevels;
int XtiltLevels, YtiltLevels;

View File

@ -570,18 +570,18 @@ void GHOST_WindowX11::initXInputDevices()
if (version && (version != (XExtensionVersion *)NoSuchExtension)) {
if (version->present) {
GHOST_SystemX11::GHOST_TabletX11 &xtablet = m_system->GetXTablet();
XEventClass xevents[10], ev;
XEventClass xevents[8], ev;
int dcount = 0;
/* With modern XInput (xlib 1.6.2 at least and/or evdev 2.9.0) and some 'no-name' tablets
* like 'UC-LOGIC Tablet WP5540U', we also need to 'select' Button1 for motion event,
* like 'UC-LOGIC Tablet WP5540U', we also need to 'select' ButtonPress for motion event,
* otherwise we do not get any tablet motion event once pen is pressed... See T43367.
*/
if (xtablet.StylusDevice) {
DeviceMotionNotify(xtablet.StylusDevice, xtablet.MotionEvent, ev);
if (ev) xevents[dcount++] = ev;
DeviceButton1Motion(xtablet.StylusDevice, xtablet.MotionEvent, ev);
DeviceButtonPress(xtablet.StylusDevice, xtablet.PressEvent, ev);
if (ev) xevents[dcount++] = ev;
ProximityIn(xtablet.StylusDevice, xtablet.ProxInEvent, ev);
if (ev) xevents[dcount++] = ev;
@ -589,13 +589,13 @@ void GHOST_WindowX11::initXInputDevices()
if (ev) xevents[dcount++] = ev;
}
if (xtablet.EraserDevice) {
DeviceMotionNotify(xtablet.EraserDevice, xtablet.MotionEvent, ev);
DeviceMotionNotify(xtablet.EraserDevice, xtablet.MotionEventEraser, ev);
if (ev) xevents[dcount++] = ev;
DeviceButton1Motion(xtablet.EraserDevice, xtablet.MotionEvent, ev);
DeviceButtonPress(xtablet.EraserDevice, xtablet.PressEventEraser, ev);
if (ev) xevents[dcount++] = ev;
ProximityIn(xtablet.EraserDevice, xtablet.ProxInEvent, ev);
ProximityIn(xtablet.EraserDevice, xtablet.ProxInEventEraser, ev);
if (ev) xevents[dcount++] = ev;
ProximityOut(xtablet.EraserDevice, xtablet.ProxOutEvent, ev);
ProximityOut(xtablet.EraserDevice, xtablet.ProxOutEventEraser, ev);
if (ev) xevents[dcount++] = ev;
}