Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some mouse events are lost when using the SDL driver #221

Closed
DorpsGek opened this issue Jun 27, 2006 · 4 comments
Closed

Some mouse events are lost when using the SDL driver #221

DorpsGek opened this issue Jun 27, 2006 · 4 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

init opened the ticket and wrote:

When playing the game using SDL for video and input, some mouse events are lost. This applies to fast clicks with a mouse button, such as when clicking a button. The click is simply not detected by the program, and is quite irritating. I have to apply this patch to play, otherwise the game is nearly unplayable (although that might just be my personal preference).

The problem is that the program does not ensure that mouse button events are received properly by those UI elements that may receive them. A mouse press simply sets a global flag for the corresponding button to true, and clears it when the button is released. In the game main loop, each round the input queue is (completely) processed once. If both the button press and the button release events appears in the event queue while the queue is being processed, the flag will be set and cleared before the rest of the code have any chance of reacting to this information (since this happens outside the processing of the input queue).

I have written a patch that solves this problem. It adds code on the receiving end that flags the input processor when the input events have been seen, and updates the input processor to act accordingly. Thus, the button flags cannot be cleared before the receiving end has seen the new state.

There is also a related drag problem, mostly seen when dragging signals along a track. If you click and drag quickly from the starting point, the game will detect the drag as beginning not where you clicked but one tile along the dragged path. This means that if you click on a one-way signal, the game will think that you clicked on the next tile, that hasn't got any signals, and therefore create two-way signals at the perceived starting point and onwards. This problem is not fixed in the patch though, since I have not yet figured out how dragging works.

The patch works for SVN revision 5388.

Attachments

Reported version: trunk
Operating system: Linux


This issue was imported from FlySpray: https://bugs.openttd.org/task/221
@DorpsGek
Copy link
Member Author

DorpsGek commented Jul 1, 2006

init wrote:

Updated patch to work with rev 5435. Also changed patch indentation to clarify what it actually does. This also reduced the sice of the patch by about 20%.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/221#comment338

@DorpsGek
Copy link
Member Author

KUDr wrote:

This one should solve the problem for both drivers (SDL and Win32) and both inputs (mouse and key).

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/221#comment628

@DorpsGek
Copy link
Member Author

KUDr wrote:

Here are handled also keys for cocoa (dunno if it will work):

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/221#comment629

@DorpsGek
Copy link
Member Author

Darkvater closed the ticket.

Reason for closing: Fixed

r7157


This comment was imported from FlySpray: https://bugs.openttd.org/task/221

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant