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

Use last event time when calling XSetInputFocus #1136

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

rbernon
Copy link
Contributor

@rbernon rbernon commented Dec 8, 2024

This fixes a race condition when WM_TAKE_FOCUS message is sent to
client windows, with the last event time as time parameter. The
client might react to the WM_TAKE_FOCUS message with a XSetInputFocus
call, and is expected to pass the message time as time parameter.

As fvwm concurrently calls XSetInputFocus with CurrentTime, it causes
a race condition and sometimes the X server gives focus to fvwm
window, stealing the focus from the client window.

This causes rare and random test failures with Wine non-regression test suite, as we run it on fvwm by default. The workarounds are piling up on our side, in the tests but it would probably be better to fix it here. Fwiw I also opened fvwmorg/fvwm#101 on fvwm2 some time ago.

  This fixes a race condition when WM_TAKE_FOCUS message is sent to
  client windows, with the last event time as time parameter. The
  client might react to the WM_TAKE_FOCUS message with a XSetInputFocus
  call, and is expected to pass the message time as time parameter.

  As fvwm concurrently calls XSetInputFocus with CurrentTime, it causes
  a race condition and sometimes the X server gives focus to fvwm
  window, stealing the focus from the client window.
@ThomasAdam ThomasAdam merged commit 27fd3ca into fvwmorg:main Dec 9, 2024
12 checks passed
@ThomasAdam ThomasAdam added the type:bug Something's broken! label Dec 9, 2024
@ThomasAdam ThomasAdam added this to the 1.1.2 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something's broken!
Projects
Status: PRs
Development

Successfully merging this pull request may close these issues.

2 participants