Events

Adrian Page adrian at pagenet.plus.com
Thu Apr 1 17:52:30 CEST 2004


At the moment we have separate event handlers for mice and tablets which 
leads to some duplication of code and a need to write two lots of code for 
each tool. How about we replace them by a single handler that takes events 
with pressure and tilts, and have the mouse just set these to 
PRESSURE_DEFAULT and 0, 0? We could replace

mousePress(QMouseEvent *)
mouseMove(QMouseEvent *)
mouseRelease(QMouseEvent *)
tabletEvent(QTabletEvent *)

with

buttonPress(KisButtonPressEvent *)
move(KisMoveEvent *)
buttonRelease(KisButtonReleaseEvent *) 

KisxxxEvent can have a member that specifies the input device as mouse, 
stylus, eraser, etc., for things that really need to know, otherwise a mouse 
is effectively a tablet device with fixed pressure and tilt. I've tried this 
with the brush and line tools and it works ok.

These new event classes could also use floating point for coordinates, which 
is needed in order to use the full resolution of the tablets. I would also 
suggest that pressure becomes a floating point value that goes from 0 to 1, 
as this lets us use the resolution of the device without needing to hold its 
range. I've got the code for extracting all of this data from X working 
and pretty much ready to go in.

Adrian




More information about the kimageshop mailing list