Setting icon on Ubuntu without .desktop

SDL_SetWindowIcon doesn’t seem to work. I had this problem before and fixed it by setting an icon before mapping the window (this fix is now part of Allegro, a competing library.) I couldn’t find a good way to do it with SDL though. I managed to get an icon set but it required including internal headers (to set SDL_WINDOW_OPENGL) and after I was done (I used SDL_CreateWindowFrom) the window didn’t get any input events.

Is there a way to do this? I don’t want to have to use .desktop files ideally. Or would the SDL developers be open to adding a function to set an icon before window creation, which would then be set just before the window is mapped?