Bug 245854 - x11-servers/xorg-server: Do not send spurious FocusOut+FocusIn events
Summary: x11-servers/xorg-server: Do not send spurious FocusOut+FocusIn events
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-23 15:20 UTC by Christian Weisgerber
Modified: 2020-05-04 16:10 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (x11)
zeising: merge-quarterly?


Attachments
Patch for x11-servers/xorg-server (2.12 KB, patch)
2020-04-23 15:20 UTC, Christian Weisgerber
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Weisgerber freebsd_committer freebsd_triage 2020-04-23 15:20:53 UTC
Created attachment 213727 [details]
Patch for x11-servers/xorg-server

I would like to commit the attached patch to x11-servers/xorg-server.

This is an upstream fix for a problem in xorg-server 1.20 that causes spurious FocusIn+FocusOut events to be sent.
https://gitlab.freedesktop.org/xorg/xserver/-/commit/364d64981549544213e2bca8de6ff8a5b2b5a69e

The problem is easily seen with games/burgerspace. If burgerspace is started in fullscreen mode (burgerspace --full-screen), the game keeps getting paused every few seconds. You don't need to start any gameplay, it already happens in attract mode. Press P to continue and it soon pauses again. The game purposely pauses when its window loses focus, i.e. it receives a FocusOut event. The bug in xserver 1.20 spams the game with spurious events.

Here is the upstream description:

----
dix: do not send focus event when grab actually does not change

c67f2eac ("dix: always send focus event on grab change") made dix
always sent events when it's a NotifyGrab or NotifyUngrab, even if
from == to, because 'from' can just come from a previous XSetInputFocus
call.

However, when an application calls XGrabKeyboard several times on
the same window, we are now sending spurious FocusOut+FocusIn with
NotifyGrab, even if the grab does not actually change. This makes screen
readers for blind people spuriously emit activity events which disturb
screen reading workflow when e.g. switching between menus.

This commit avoids calling DoFocusEvents in that precise case, i.e. when
oldWin is a previous grab and the new grab is the same window.
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-05-03 20:23:17 UTC
A commit references this bug:

Author: zeising
Date: Sun May  3 20:22:31 UTC 2020
New revision: 533807
URL: https://svnweb.freebsd.org/changeset/ports/533807

Log:
  xorg-server: Do not send spurious focus events

  Apply an upstream patch to avoid sending focus evens when grab actually does
  not change.  This fixes certain full screen applications. [1]

  Ensure that we actually don't try to find and link against HAL even if it's
  around on the system we're compiling on [2]

  Add CPE information [3]

  PR:		245854 [1] (with changes), 245604 [2], 197712 [3]
  Submitted by:	naddy@ [1], mi@ [2], arrowd [3]
  Reported by:	shun [3]
  MFH:		2020Q2

Changes:
  head/x11-servers/xorg-server/Makefile
  head/x11-servers/xorg-server/distinfo
Comment 2 Niclas Zeising freebsd_committer freebsd_triage 2020-05-03 20:32:25 UTC
Committed, awaiting MFH.
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-05-04 16:09:02 UTC
A commit references this bug:

Author: zeising
Date: Mon May  4 16:08:17 UTC 2020
New revision: 533929
URL: https://svnweb.freebsd.org/changeset/ports/533929

Log:
  MFH: r533807

  xorg-server: Do not send spurious focus events

  Apply an upstream patch to avoid sending focus evens when grab actually does
  not change.  This fixes certain full screen applications. [1]

  Ensure that we actually don't try to find and link against HAL even if it's
  around on the system we're compiling on [2]

  Add CPE information [3]

  PR:		245854 [1] (with changes), 245604 [2], 197712 [3]
  Submitted by:	naddy@ [1], mi@ [2], arrowd [3]
  Reported by:	shun [3]

  Approved by:	ports-secteam (joenum)

Changes:
_U  branches/2020Q2/
  branches/2020Q2/x11-servers/xorg-server/Makefile
  branches/2020Q2/x11-servers/xorg-server/distinfo
Comment 4 Niclas Zeising freebsd_committer freebsd_triage 2020-05-04 16:10:04 UTC
Merged, thanks!