left and right bug

News and discussion of the PC port of Oolite.

Moderators: winston, another_commander

Post Reply
3DH
Competent
Competent
Posts: 57
Joined: Wed May 15, 2013 11:45 am

left and right bug

Post by 3DH »

Translator:
It will be hard to describe, especially with a translator. When I'm on the galaxy map, I have to use the directions on the keyboard because for some reason I can't do it on the joystick. Maybe you can fix it someday, but I mean something else. I play full screen and sometimes go to the desktop (Alt+Tab). And sometimes when I go back to the galaxy map, the left and right keys stop working. But only on the galaxy map. Then I have to use the mouse, especially for that one thing. It's a bit annoying.

Please do something with this.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5381
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: left and right bug

Post by Cholmondely »

3DH wrote: Fri Oct 08, 2021 2:32 pm
Please do something about this.
I presume that whoever tries to answer might need some of the following information:

*Do you have the same effect when you play the "Strict" game or with no oxp's loaded?

*If the effect exists without oxp's, is it one of the various Linux operating systems? Or something else?

*Also: is it the regular Oolite v.1.90 - or one of the others (Developer Release or Nightly Build)
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: left and right bug

Post by Cody »

3DH wrote: Fri Oct 08, 2021 2:32 pm
I play full screen and sometimes go to the desktop (Alt+Tab). And sometimes when I go back to the galaxy map, the left and right keys stop working.
No problem here (tested on 1.90 and 1.91).
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
3DH
Competent
Competent
Posts: 57
Joined: Wed May 15, 2013 11:45 am

Re: left and right bug

Post by 3DH »

I'm using Windows 10 and Oolite 1.90. I have one add-on modified by me, but these are just minor changes to the HUD. This error also occurred without this add-on. I remind you that the error occurs sometimes.

I do something like this:
- load the game, set up the galaxy map
- alt+tab and enter the Edge browser, click, mark text, etc.
- I am coming back alt+tab to Oolite
- I go alt+tab back to Edge, I'm doing something there again
- I'm going back to Oolite and usually this is where I get this bug. I always have it sooner or later.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: left and right bug

Post by phkb »

Can I get you to try something? When you next encounter the issue, press and release each of the shift, control and alt keys, one at a time (not altogether). Then see if the issue has cleared up.
3DH
Competent
Competent
Posts: 57
Joined: Wed May 15, 2013 11:45 am

Re: left and right bug

Post by 3DH »

Pressing Alt unlocked the left and right keys. Thanks. But what exactly happened here? 🤔
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: left and right bug

Post by phkb »

I think it’s a bug in the Oolite code which I came across while working on the new keyboard config setup. I need to do some more analysis on how to correct it, though.
User avatar
hiran
Theorethicist
Posts: 2410
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: left and right bug

Post by hiran »

phkb wrote: Sat Oct 09, 2021 11:02 am
I think it’s a bug in the Oolite code which I came across while working on the new keyboard config setup. I need to do some more analysis on how to correct it, though.
I do not think it is a bug in Oolite.

What happens is that Oolite notices all keypress and keyrelease events. So pressing Alt is definitely something that Oolite will notice.
However at the moment that Tab is pressed and the fact that Alt is already pressed, the comination Alt-Tab is intercepted by the OS, which reacts and switches the focus to some other application. After the switch all keyboard events are sent to the now focued application, which is no longer Oolite. So far everything worked as designed.

The only unexpected thing that comes up is: Oolite never received a keyrelease event for Alt. So when you return focus to Oolite, it sill believes that Alt is pressed even though it may have been released in the meantime. All further keypresses are executed as Alt-<keypress>, and obviously these do not trigger the same actions that the simple keypress would.

The solution to press the Alt key and release it means you synchronize keyboard status with what Oolite believes to be the keyboard status and the problem is gone.

This is by no means specific to Oolite - I have experienced it with various other games. And I am not sure how one would resolve it within Oolite.

Edit: While thinking again, I suspect the situaton would only arise if you Alt-Tab away from Oolite and then use the mouse to return. If you were to Alt-Tab back to Oolite, the first keyboard event that Oolite might notice could be the release of the Alt key which would not lead to any problem.

Edit2: Would the Oolite window notice that focus went away or came back? Then that event could be used to clear all the modifier values...
Sunshine - Moonlight - Good Times - Oolite
3DH
Competent
Competent
Posts: 57
Joined: Wed May 15, 2013 11:45 am

Re: left and right bug

Post by 3DH »

hiran wrote: Sat Oct 09, 2021 8:25 pm
Edit: While thinking again, I suspect the situaton would only arise if you Alt-Tab away from Oolite and then use the mouse to return. If you were to Alt-Tab back to Oolite, the first keyboard event that Oolite might notice could be the release of the Alt key which would not lead to any problem.
Alt+Tab and the mouse used to return can cause this bug.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6696
Joined: Wed Feb 28, 2007 7:54 am

Re: left and right bug

Post by another_commander »

hiran wrote: Sat Oct 09, 2021 8:25 pm
Edit2: Would the Oolite window notice that focus went away or came back? Then that event could be used to clear all the modifier values...
Yes, Oolite reacts to receiving focus (WM_SETFOCUS message) and clears all modifier key values already.
User avatar
hiran
Theorethicist
Posts: 2410
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: left and right bug

Post by hiran »

another_commander wrote: Sun Oct 10, 2021 12:25 pm
hiran wrote: Sat Oct 09, 2021 8:25 pm
Edit2: Would the Oolite window notice that focus went away or came back? Then that event could be used to clear all the modifier values...
Yes, Oolite reacts to receiving focus (WM_SETFOCUS message) and clears all modifier key values already.
Rats.

There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable. There is another theory which states that this has already happened. - Douglas Adams
Sunshine - Moonlight - Good Times - Oolite
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 678
Joined: Sat Aug 09, 2014 4:16 pm

Re: left and right bug

Post by Commander_X »

<tosses 0.02 credits on the table>
Did anybody look into localization/OS kicking in? I.e. Oolite runs (say) English US, but OS is set to English UK? ... Shortcuts to switch keyboards and the such (maybe Alt/AltGr involved)?
... just saying!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: left and right bug

Post by phkb »

In my tests, I can confirm the issue only seems to occur if you alt-tab to a window on the same screen as Oolite, regardless of the maximised state of that window or Oolite. If I alt-tab to a window on another monitor, then alt-tab back to Oolite, the issue doesn't occur. Also, it only appears to impact the left/right arrow keys, not the up/down arrow keys.
Post Reply