Shift key InputSlot behaves strangely under Linux

Have jReality programming problems or questions? Post them here.
Post Reply
STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Shift key InputSlot behaves strangely under Linux

Post by STRESS » Wed 22. Jul 2009, 18:45

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

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Shift key InputSlot behaves strangely under Linux

Post by steffen » Wed 22. Jul 2009, 19:11

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.

STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Re: Shift key InputSlot behaves strangely under Linux

Post by STRESS » Thu 23. Jul 2009, 11:02

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?

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Shift key InputSlot behaves strangely under Linux

Post by steffen » Thu 23. Jul 2009, 14:45

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.

STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Re: Shift key InputSlot behaves strangely under Linux

Post by STRESS » Fri 24. Jul 2009, 12:09

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.

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Shift key InputSlot behaves strangely under Linux

Post by steffen » Fri 24. Jul 2009, 12:28

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.

STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Re: Shift key InputSlot behaves strangely under Linux

Post by STRESS » Fri 24. Jul 2009, 12:44

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

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Shift key InputSlot behaves strangely under Linux

Post by steffen » Fri 24. Jul 2009, 12:46

Ok, good. Thanks for checking that.

Post Reply