Pen Tablet reacts slowly
Alexandre Martinazzo
alexandremartinazzo at gmail.com
Fri Nov 23 14:59:06 EST 2007
Hi Andre
For Paint, Tablet should work as described in
http://wiki.laptop.org/go/Draw#Tablet_Support
So, we should distinguish if the event comes from Pen Tablet. Right now, if
you use PT on Paint, it will work as the regular touchpad. As you said,
there is a delay; I found no click events here. I have just tested Paint in
a B3 with build 623 and the correct event is motion-notify; sorry for the
mistake.
Also, we were trying to recognize which device was associated with the
gtk.gdk.Event object passed to the callback. The problem is that we found no
difference between the pen tablet and the touchpad. We tried
event.device.name and event.device.source, they have the same value for both
devices. Did you do something else to detect a pen tablet event?
BTW, we tested things in Paint, your code structure is very similar to ours
:)
Regards,
Alexandre
2007/11/23, Andre Schmeißer <schmeisser at iupr.org>:
>
> Maybe I'm mistaken and it does produce click events by now, but when I
> tested it
> the first time it didn't. But if it did, the paint activity would
> automatically work with
> the pen tablet, as it doesn't need to distinguish it from regular
> touchpad input, imo. If
> there's click and drag just draw a line (or whatever).
>
> The app I'm working on however (see my original post) only reacts on PT
> input so
> that the user is able to use the regular touchpad seperately from this.
> It uses
> gtk.Widget.set_extension_events(gtk.gdk.EXTENSION_EVENTS_ALL)
> to receive events from the PT and checks the source device by comparing
> | gtk.gdk.MOTION_NOTIFY.|device.name
> with the name of the PT device.
>
> The behavior I get is not ideal, though. As described there is a
> noticeable delay
> to the reaction. Also, the input seems to be jagged. The later is not
> really a
> problem, but just seems weird.
>
> It would be nice if you could verify that behavior on your machine.
> I attached a small python sample which simply draws lines between event
> coordinates. I get smooth lines using the regular touchpad and jagged ones
> with the PT. The inital delay is noticeable without any further tools,
> just press
> shortly on the tablet to let the mouse jump.
>
> Thanks,
> Andre Schmeisser
>
>
> ----------------- 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()
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20071123/7f9ddf17/attachment.html>
More information about the Devel
mailing list