Page 1 of 1

Shift key InputSlot behaves strangely under Linux

Posted: Wed 22. Jul 2009, 18:45
by STRESS
I've written a tool that uses the shift key as one of its InputSlot besides mouse left button and mouse position (Devicename "Secondary"). It all works perfectly fine under windows, I'll get the shift key events when I use
ToolContext.getAxisState(..).isPressed() however under Linux (RedHat Enterprise Linux 5) I get strange effects. Sometimes shift key is not recognized at all and other times when I hold the shift key the mouse events are not propergated correctly anymore they seem to vanish especially the mouse button ones.

I had a go with xev to check if something is wrong with my X but it reports all normally.

Strangely enough I don't see any problems with CTRL

Re: Shift key InputSlot behaves strangely under Linux

Posted: Wed 22. Jul 2009, 19:11
by steffen
As a starter, remove the Virtual devices that use Secondary, like SecondaryAction etc. These devices consume the corresponding event if they are affected, i.e. when the mouse button is already pressed (as far as i remember). But it is strange that there is such a difference between win and linux.
Then you maybe have to dig through the code step by step with a debugger to see what goes wrong, look into KeyboardDevice. This class is however a terrible hack, mostly because it has to hide the keyboard auto repeat, which produces different kinds of key events under linux and windows.

Re: Shift key InputSlot behaves strangely under Linux

Posted: Thu 23. Jul 2009, 11:02
by STRESS
steffen wrote:As a starter, remove the Virtual devices that use Secondary, like SecondaryAction etc. These devices consume the corresponding event if they are affected, i.e. when the mouse button is already pressed (as far as i remember). But it is strange that there is such a difference between win and linux.
Then you maybe have to dig through the code step by step with a debugger to see what goes wrong, look into KeyboardDevice. This class is however a terrible hack, mostly because it has to hide the keyboard auto repeat, which produces different kinds of key events under linux and windows.
Hmm thanks that doesn't sound too promising but I will have a look at this. I was wondering has anyone experienced similar behaviour under Linux?

Re: Shift key InputSlot behaves strangely under Linux

Posted: Thu 23. Jul 2009, 14:45
by steffen
I have not heard about this problem, but our my tools do not use Shift extensively... If you can provide some simple example that reproduces the problem I can see what it does under ubuntu.

Re: Shift key InputSlot behaves strangely under Linux

Posted: Fri 24. Jul 2009, 12:09
by STRESS
Hmm now I managed to reproduce the same behaviour under windows as well. It seems when you first mouse left click or right click and then press shift afterwards it works. However, if you press shift first and then use left or right mouse button it doesn't. Only very rarely it does I guess that's only because of my bad human internal timing and left mouse button is registered first by the OS.

I removed all virtual devices connected to Seconday out of toolconfig.xml it didn't make any change in behaviour.

But I think there is a simple workaround to the problem if I change shift key to act as one of the activator slots it seems to work.

Re: Shift key InputSlot behaves strangely under Linux

Posted: Fri 24. Jul 2009, 12:28
by steffen
Sound interesting. The behavior you describe would be correct without changes to the tool config: when shift is pressed the mouse button press will result in SecondaryAction (left mouse), PrimaryAction should not have state pressed in this case. But when you remove the corresponding virtual devices it should not behave like this... I will look into this, but maybe that takes some days.

Re: Shift key InputSlot behaves strangely under Linux

Posted: Fri 24. Jul 2009, 12:44
by STRESS
Aha, my fault :cry: I edit the wrong toolconfig.xml file (ahh there are so many :shock: ). Now it works when I remove all VirtualDevices

Re: Shift key InputSlot behaves strangely under Linux

Posted: Fri 24. Jul 2009, 12:46
by steffen
Ok, good. Thanks for checking that.