Pen / tablet support and Xquartz



I'm trying to add support for tablet events into Xquartz, the Mac OS DDX part of the X.org Xserver. I've had trouble finding any real documentation about this, so I've mostly been trying to read the gdk source to see what it's looking for, and looking at the events sent by the Wacom driver on Linux.

I now have events coming in that look valid, but gsumi does still reports that I have "no input devices", and the Gimp doesn't recognize my taps with the pen on the tablet.

Here's what xinput reports:
$ xinput list
"Virtual core keyboard" id=0    [XKeyboard]
        Num_keys is 248
        Min_keycode is 8
        Max_keycode is 255
"Virtual core pointer"  id=1    [XPointer]
        Num_buttons is 32
        Num_axes is 2
        Mode is Relative
        Motion_buffer is 256
        Axis 0 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 1 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
"Quartz Pointing Device"        id=2    [XExtensionPointer]
        Num_buttons is 7
        Num_axes is 2
        Mode is Relative
        Motion_buffer is 256
        Axis 0 :
                Min_value is 0
                Max_value is -1
                Resolution is 0

       Axis 1 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
"pen"   id=3    [XExtensionPointer]
        Num_buttons is 3
        Num_axes is 7
        Mode is Relative
        Motion_buffer is 256
        Axis 0 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 1 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 2 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 3 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 4 :
               Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 5 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
        Axis 6 :
                Min_value is 0
                Max_value is -1
                Resolution is 0
"Quartz Keyboard"       id=4    [XExtensionKeyboard]
        Num_keys is 248
        Min_keycode is 8
        Max_keycode is 255

$ xinput test 3
[...]
otion a[0]=535 a[1]=541 a[2]=137 a[3]=0 a[4]=0
motion a[0]=534 a[1]=541 a[2]=90 a[3]=0 a[4]=0
motion a[0]=534 a[1]=541 a[2]=74 a[3]=0 a[4]=0
motion a[0]=533 a[1]=542 a[2]=58 a[3]=0 a[4]=0
motion a[0]=524 a[1]=707 a[2]=337 a[3]=0 a[4]=0
[...]
motion a[0]=514 a[1]=535 a[2]=447 a[3]=0 a[4]=1
motion a[0]=514 a[1]=535 a[2]=447 a[3]=0 a[4]=5
motion a[0]=514 a[1]=535 a[2]=443 a[3]=0 a[4]=9
motion a[0]=514 a[1]=535 a[2]=443 a[3]=0 a[4]=9
motion a[0]=505 a[1]=535 a[2]=592 a[3]=8 a[4]=0
motion a[0]=505 a[1]=535 a[2]=592 a[3]=9 a[4]=0
[...]

The code on the Quartz side is pretty simple:

http://cgit.freedesktop.org/xorg/xserver/tree/hw/xquartz/darwinEvents.c#n363 (but edited here for clarity)

/* These values were chosen to match the output of xinput under Linux */
#define SCALEFACTOR_TILT        64.0
#define SCALEFACTOR_PRESSURE    1000.0

void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y, float pressure, float tilt_x, float tilt_y) {
        int i, num_events;
        DeviceIntPtr dev;

int valuators[5] = {pointer_x, pointer_y, pressure * SCALEFACTOR_PRESSURE, tilt_x * SCALEFACTOR_TILT, tilt_y * SCALEFACTOR_TILT};

if (pressure == 0 && tilt_x == 0 && tilt_y == 0) dev = darwinPointer;
        else dev = darwinTablet;

    mieqEnqueue_lock(); {
num_events = GetPointerEvents(darwinEvents, dev, ev_type, ev_button, POINTER_ABSOLUTE, 0, dev==darwinTablet?5:2, valuators);
        for(i=0; i<num_events; i++) mieqEnqueue (dev,&darwinEvents[i]);
        DarwinPokeEQ();

    } mieqEnqueue_unlock();
}

Elsewhere, the devices are set up like this:

           InitPointerDeviceStruct((DevicePtr)pPointer, map, 7,
                                    GetMotionHistory,
                                    (PtrCtrlProcPtr)NoopDDA,
                                    GetMotionHistorySize(), 2);
pPointer->name = strdup("Quartz Pointing Device");

            InitPointerDeviceStruct((DevicePtr)pPointer, map, 3,
                                    GetMotionHistory,
                                    (PtrCtrlProcPtr)NoopDDA,
                                    GetMotionHistorySize(), 7);
            InitProximityClassDeviceStruct(pPointer);
            pPointer->name = strdup("pen");


Can anyone give me some advice on what I need to do to get gtk to recognize my input devices?
Thanks!
Ben



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]