Touchpad: PT behaves strange

Andre Schmeißer schmeisser at iupr.org
Wed Jul 18 16:45:26 EDT 2007


Hi everyone,

I'm experiencing some problems with the PT and would like to ask
if this behavior is intended / a hardware problem or I'm simply
doing sth. wrong. (OFW says it's a B2 machine, btw)

1) There is a delay between when you touch the PT with a pen
and you get events. You can see this by shortly touching the PT
to make the mouse jump, the reaction is not instant.
I think I've read about a 50ms delay between mode switches
somewhere, but this seems to take longer as I probably wouldn't
have noticed 50ms.
The problem with this is that if you start writing and go too fast
about it, the first part of the motion goes unnoticed.

2) The events reported from the PT have jagged coordinates,
i.e. two successive events only differ in either x- or y-position,
never in both. Likewise, if you put the pen down to make the
mouse jump, the first reported Pen event consist of (iirc) the
x-coordinate of the new position and the y-coordinate of the
previous mouse-position.
You can, of course, drop the first event and then average two
events into one, but that halfs the time resolution.

I'm experiencing 2) with a simple X event dump from C as well
as with a Python / GTK. I appended a Python app which simply
draws lines between input events. When you use the GS mouse,
you can draw smoothly, whereas the PT input is jagged.

I'll appreciate any hints on what I'm missing / doing wrong.
Best regards.

----------------- Python code -----------------
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk

class EventWindow:
    def __init__(self):
        self.last_x = self.last_y = -1
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Tablet Event Visualization")
        self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        self.window.connect("destroy", lambda w: gtk.main_quit())
        self.area = gtk.DrawingArea()
        self.area.set_size_request(1200, 800)
        self.window.add(self.area)
        self.area.set_events(gtk.gdk.POINTER_MOTION_MASK )
        #self.area.set_extension_events(gtk.gdk.EXTENSION_EVENTS_ALL)
        self.area.connect("motion-notify-event", self.motion_notify)
        self.area.show()
        self.window.show()
        self.style = self.area.get_style()
        self.gc = self.style.fg_gc[gtk.STATE_NORMAL]
        return
   
    def motion_notify(self, area, event):   
        #print event.device.name + ':', event.x_root, event.y_root
        self.gc.set_rgb_fg_color(gtk.gdk.Color(0,0,0))
        self.area.window.draw_line(self.gc,
                                    int(self.last_x),
                                    int(self.last_y),
                                    int(event.x_root),
                                    int(event.y_root))
        self.last_x, self.last_y = event.x_root, event.y_root
        self.last_event = event.get_time()
        return True

if __name__ == "__main__":
    win = EventWindow()
    gtk.main()





More information about the Devel mailing list