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

Two SDL_ACTIVEEVENT SDL_APPMOUSEFOCUS events precede each SDL_MOUSEBUTTONDOWN #544

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Labels
invalid This doesn't seem right

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 1.2.14
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2010-01-17 07:37:10 +0000, Kalle Olavi Niemitalo wrote:

Bos Wars 2.5.1 in windowed mode seems to be getting too many SDL_ACTIVEEVENT events from SDL 1.2.14. There is no such problem with SDL 1.2.14 in full-screen mode, nor with SDL 1.2.13. Reverting SDL r4872 solves the problem. That change was intended to fix SDL bug # 716.

Before each SDL_MOUSEBUTTONDOWN event, SDL is reporting two SDL_ACTIVEEVENT events:

  1. type=SDL_ACTIVEEVENT, gain=0, state=SDL_APPMOUSEFOCUS
  2. type=SDL_ACTIVEEVENT, gain=1, state=SDL_APPMOUSEFOCUS

xtrace shows the X server is reporting EnterNotify and LeaveNotify events, which also look spurious; so perhaps the problem is at a lower level than SDL. Anyway, upgrading SDL from 1.2.13 to 1.2.14 (the "last planned release for SDL 1.2") seems harmful to Bos Wars.

On 2010-01-17 08:25:40 +0000, Kalle Olavi Niemitalo wrote:

Created attachment 479
event trace with xtrace --relative-timestamps and Bos Wars patched to display SDL events

On 2010-01-17 09:32:51 +0000, Kalle Olavi Niemitalo wrote:

It seems this is caused by the Metacity 2.28.0 window manager grabbing mouse events. Metacity then calls XAllowEvents with ReplayPointer, letting the event through to SDL in Bos Wars; but the grab has already caused the X server to report LeaveNotify and EnterNotify, which then cause SDL to report to Bos Wars that it lost and regained the mouse focus. The Openbox 3.4.10 window manager causes the same problem; IceWm 1.3.6 however doesn't.

Because the LeaveNotify events received by SDL do indicate that the application isn't going to receive mouse events, I suppose SDL is right to report loss of mouse focus to the application. The EnterNotify then soon follows but I suppose that can be arbitrarily delayed, in particular if the window manager is not running on the same host as the X server. (In which case, the mouse events to the application will also be delayed, so having a window manager grab the mouse like that seems a bad idea.) So I don't how to change SDL not to report those events while remaining correct. I'm thus resolving my own bug report as INVALID.

On 2010-01-18 06:23:55 +0000, Sam Lantinga wrote:

Thanks for the info!

@SDLBugzilla SDLBugzilla added bug invalid This doesn't seem right labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant