Detecting key down at startup?

I’m in the middle of porting a very large legacy code base from MS Windows to Linux.
After looking at the alternatives, I chose SDL as my cross-platform window manager.

I’m using SDL 2.0.18 as supplied by MSYS2/MinGW64. (Update: the below problems also happen with the latest SDL2 code in the main branch.)

Finally, I got something to draw, although it’s not entirely correct yet. (The apps use OpenGL. The most noticeable artifact appears related to stenciling.)

One barrier was the method I’m using to detect whether a key is being held down at app-startup time.
The existing app behavior is that, if the Control key is held down when the app starts, it allows any command-line specified config file to be overridden by a select-config dialog.

My technique is to create a dummy window with SDL_CreateWindow(), set the input focus with SDL_SetWindowInputFocus(), pump events (to receive any key-down notifications) with SDL_PumpEvents(), then test whether the Control key was detected with SDL_GetModState(). I then call SDL_DestroyWindow().

There are two problems. One is that it doesn’t detect any keys being held down. Am I doing this right? Is this even possible? I could only find this StackOverflow question, which didn’t have an SDL-specific answer.

The other problem is that the creation of my dummy window somehow affects the drawing of the subsequently-created “real” window. My first dummy window was 1x1; I thought drawing was completely broken, until I noticed some flashing in the lower-left corner of my app’s window. I changed the dummy window’s size to 100x100, and now I have a larger scaled-down version of my app drawing in the lower-left corner of my app’s window.

So I guess I have two questions: [1] Can SDL detect a key being held down at startup, and if so, how? [2] How does the size of a dummy window somehow affect the size of a subsequently-created window?

AFAIK all you need to do is something like

SDL_Init(SDL_INIT_EVENTS) /// if you want lazy guarantee then pass SDL_INIT_EVERYTHING
SDL_Event event;
         if (event.key.repeat) printf("Hey I'm pressing down a key!!\n");

now you can just read in that loop whatever particular key press you want or whatever else with the keys, make sure your systems are properly initialized tho, something like

            SDL_Log("SDL_Init failed: %s", SDL_GetError());