Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
xfwm4
xfwm4
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 278
    • Issues 278
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Custom Issue Tracker
    • Custom Issue Tracker
  • Merge Requests 3
    • Merge Requests 3
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Xfce
  • xfwm4xfwm4
  • Issues
  • #514

Closed
Open
Opened Feb 14, 2021 by Ralf Hoffmann@ralf

window focus lost when closing two windows at the same time

I noticed a keyboard focus issue with one of my own X applications. The problem happens with three windows involved. Window A is the main window. Window B is opened as a regular window and window C is opened as a dialog window for window B (transient_for hint set to B). When the dialog C is closed and due to program logic the window B is closed immediately afterwards, the keyboard focus is not returned to window A but instead no (user visible) window gets the focus at all, probably the root window instead.

If there is a XSync between closing C and B, or B is transient for A as well, it works as expected.

I have created a small program to demonstrate the issue (quick'n'dirty with no error handling).

Makefile xprog.c

The program opens 3 windows and has a simple button press event loop:

How to reproduce:

  1. compile with make
  2. run without arguments: ./xprog
  3. click into the dialog window
  4. the dialog window and secondary window closes
  5. Expected behavior: the primary window gets the focus again
  6. Actual behavior: no window has the focus
  7. Click in the primary window to end the application.

If the program is started with the number "1" as argument, it uses a XSync call between closing the dialog and the secondary window. In this case the behavior is as expected. With argument "2", the secondary window B is set transient for A, and that case it also behaves as expected.

If there is a large enough delay between closing window C and B, it also works so I think it might be some race when processing the unmap events within xfwm. Maybe, when the unmap event for window C is processed in xfwm, it tries to give focus to window B which is already destroyed.

It may not have anything to do with the transient status. If none of the windows is transient, the bug occurs as well, but if the secondary and dialog is transient, the behavior is as expected.

Affected version: xfwm4 version 4.16.1 (revision 5f61a84a) on openSUSE Tumbleweed xfwm4 version 4.14.1 (revision 44809c49) on ubuntu 20.04.2 lts I can't tell for sure but I did not experienced that problem with older versions, probably <=4.12.

The focus related window manager options are as follows:

  • Focus model: Click to focus
  • New window focus: automatically
  • Raise on focus: no
  • Raise on click yes
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: xfce/xfwm4#514