Opened 3 years ago

Closed 3 years ago

#6092 closed defect (fixed)

Alt+F4 triggers closing the game when it shouldn't

Reported by: Imarok Owned by: wraitii
Priority: Should Have Milestone: Alpha 25
Component: Core engine Keywords:
Cc: wraitii Patch:

Description (last modified by Imarok)

The Alt + F4 hotkey gets always triggered when the keys are pressed and not only when someone starts pressing the keys.

This was not broken in A23b.

To reproduce:

  • Open 0ad
  • Open some other application (might be 0ad again)
  • Press Alt+ F4
  • both windows get closed

(You can also close 20 instances of 0ad at once by holding Alt+F4 for some seconds)

Edit: The issue was introduced by Phab:rP24215 / r24215.

Change History (11)

comment:1 by Vladislav Belov, 3 years ago

Please, specify your OS. I can't reproduce it on Windows.

comment:2 by Imarok, 3 years ago

Interesting. I'm on Ubuntu 20.04 with Gnome.

comment:3 by Imarok, 3 years ago

Maybe caused by the same issue as #6064.

comment:4 by wraitii, 3 years ago

I guess the problem here is more that hotkeys are sent to all applications (for some reason, this seems perhaps a bit broken) on Ubuntu/Gnome, and 0 A.D. processes it even in the background?

comment:5 by Imarok, 3 years ago

Might be. But it works correctly with A23b. So the bug was introduced by changes in 0ad.

comment:6 by Stan, 3 years ago

Can reproduce on Lubuntu 20:04

comment:7 by Imarok, 3 years ago

Freagarach could reproduce the issue on Lubuntu 18.04.
JCWasmx86 could reproduce the issue with GNOME, Debian Sid, amd64

Last edited 3 years ago by Imarok (previous) (diff)

comment:8 by Imarok, 3 years ago

I could reproduce the issue with GNOME Manjaro (Arch Linux) with SDL 2.0.14

comment:9 by Imarok, 3 years ago

Description: modified (diff)

comment:10 by Imarok, 3 years ago

On Fedora with Wayland the issue does not occur.

wraitii opened an upstream issue for this: https://github.com/libsdl-org/SDL/issues/4432

comment:11 by wraitii, 3 years ago

Owner: set to wraitii
Resolution: fixed
Status: newclosed

In 25762:

Fix 0 A.D. quitting 'too fast' when it gains focus after alt+F4

There appears to be an SDL issue with linux and X11 that causes Keydown events to be sent immediately when 0 A.D. gains focus. This can loead to Alt-F4 quitting 0 A.D. immediately upon focus gain, such as when another application was quit via Alt-F4.

The typical bug case was:

  • Open 0 A.D.
  • Open another app
  • Alt-F4 other app
  • 0 A.D. immediately receives alt-F4 as well and exits.

Since SLD handles this hotkey natively via SDL_QUIT, it seems easier to default to "no hotkey", as that fixes the problem.

Reported by: Imarok

Fixes #6092

Differential Revision: https://code.wildfiregames.com/D4132

Note: See TracTickets for help on using tickets.