https://bugs.kde.org/show_bug.cgi?id=283130

Boudewijn Rempt boud at valdyas.org
Wed Nov 9 12:03:10 UTC 2011


On Tuesday 08 November 2011 Nov, Cyrille Berger Skott wrote:
> On Tuesday 08 November 2011, Boudewijn Rempt wrote:
> > > going to do switcheroo from mouse to pen stylus  (id:  0 )  
> > > going to do switcheroo from pen stylus  (id:  0 )  to eraser
> > > stylus  (id:  0 )   going to do switcheroo from eraser stylus  (id:  0
> > > )  to pen stylus  (id:  0 ) going to do switcheroo from pen
> > > stylus  (id:  0 )  to eraser stylus  (id:  0 )
> > >
> > > 
> > >
> > > This is the same on Ubuntu:
> > > 
> > >
> > > going to do switcheroo from  to  
> > > going to do switcheroo from  to  
> Hum...
> 
> We are either facing a but in xinput2, in qt/xinput2 or in the wacom driver. 
> If it were not for the report of a problem in gimp/painter, I would have 
> blamed qt/xinput2...
> 
> It might be tricky to know exactly where it is. There is a utility called 
> "xinput" (in the xinput package on ubuntu/debian, not sure for opensuse), if 
> you run "xinput list" you should get something like:
> 
> ⎡ Virtual core pointer                          id=2    [master pointer  (3)]
> ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
> ⎜   ↳ SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
> ⎜   ↳ TPPS/2 IBM TrackPoint                     id=11   [slave  pointer  (2)]
> ⎜   ↳ Serial Wacom Tablet eraser                id=13   [slave  pointer  (2)]
> ⎜   ↳ Serial Wacom Tablet touch                 id=14   [slave  pointer  (2)]
> ⎜   ↳ Serial Wacom Tablet stylus                id=15   [slave  pointer  (2)]
> ⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
>     ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
>     ↳ Power Button                              id=6    [slave  keyboard (3)]
>     ↳ Video Bus                                 id=7    [slave  keyboard (3)]
>     ↳ Sleep Button                              id=8    [slave  keyboard (3)]
>     ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
>     ↳ ThinkPad Extra Buttons                    id=12   [slave  keyboard (3)]
>     ↳ ACPI Virtual Keyboard Device              id=16   [slave  keyboard (3)]
> 
> If it does not, then it is either a bug xinput or the driver.
> 
> Then to know if the problem is in Qt/xinput2, an other possibility is to 
> compile a clean/unpatched qt, and check if it works or not.


This patch fixes the issue on Ubuntu, by assuming that any unknown pointer/device is going to be a mouse:


-- diff --git a/libs/flake/KoInputDevice.cpp b/libs/flake/KoInputDevice.cpp
index bd1b235..a38eb04 100644
--- a/libs/flake/KoInputDevice.cpp
+++ b/libs/flake/KoInputDevice.cpp
@@ -72,9 +72,9 @@ qint64 KoInputDevice::uniqueTabletId() const
 
 bool KoInputDevice::isMouse() const
 {
-    return d->mouse;
+    return d->mouse || d->device == QTabletEvent::NoDevice || d->pointer == QTabletEvent::UnknownPointer;
 }
- 
+
 
 bool KoInputDevice::operator==(const KoInputDevice &other) const
 {
diff --git a/libs/flake/KoToolManager.cpp b/libs/flake/KoToolManager.cpp
index b3a9120..7cc5371 100644
--- a/libs/flake/KoToolManager.cpp
+++ b/libs/flake/KoToolManager.cpp
@@ -655,13 +655,14 @@ void KoToolManager::Private::switchInputDevice(const KoInputDevice &device)
         tabletEventTimer.start(MSECS_TO_IGNORE_SWITCH_TO_MOUSE_AFTER_TABLET_EVENT_RECEIVED);
     }
     if (inputDevice == device) return;
-    if (device.isMouse() && tabletEventTimer.isActive()) {
+    if (device.isMouse() && !inputDevice.isMouse()) { // tabletEventTimertisActive()) {
         // Ignore switch to mouse for a short time after a tablet event
         // is received, as this is likely to be either the mouse event sent
         // to a widget that doesn't accept the tablet event, or, on X11,
         // a core event sent after the tablet event.
         return;
     }
+    qDebug() << "going to do switcheroo from" << inputDevice << "to" << device;
     inputDevice = device;
     QList<CanvasData*> items = canvasses[canvasData->canvas];
 
lines 1-36/36 (END) 


Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl


More information about the kimageshop mailing list