We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5427

Summary: X_setInputfocus BadMatch 42
Product: SDL Reporter: ghen_arcanum <n.spichty>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: blocker    
Priority: P2 CC: icculus
Version: 2.0.12Keywords: target-2.0.16
Hardware: x86_64   
OS: Linux   

Description ghen_arcanum 2020-12-30 23:20:08 UTC
Operating System: Void Linux

When starting the program, the new window blinks for a second then crashes with:

Pioneer:
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  42 (X_SetInputFocus)
  Serial number of failed request:  220
  Current serial number in output stream:  221

Grafx-sdl2 version:
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  42 (X_SetInputFocus)
  Serial number of failed request:  214
  Current serial number in output stream:  215

I came across this while compiling grafx2 for void linux. You can do three versions with it: normaly it uses sdl 1.2.x for compiling, which works fine. The X-version without sdl works fine too, just the sdl2 version doesn't work.

likewise every program using sdl2 crashes on my system.

I have quite a niche windowmanager, which is amiwm. But Gimp and Krita works totally fine with it. 

It seems that your competition had a similar problem:
https://github.com/SFML/SFML/issues/991
and there it was even linked to a bug here
https://bugzilla.libsdl.org/show_bug.cgi?id=2997
and it even says it is patched! Which is confusing.

What is going on? :) thx in advance
Comment 1 Ryan C. Gordon 2021-01-12 17:21:11 UTC
Going to guess it's this code in X11_ShowWindow...

    if (!data->videodata->net_wm) {
        /* no WM means no FocusIn event, which confuses us. Force it. */
        X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
        X11_XFlush(display);
    }

I'll try to reproduce over here.

--ryan.