Aight, now before you get your pitchforks and torches out, all I'm trying to do, right now, is unblock the program.
This is basically how my program is setup:
main() -> Lobby (GTK) -> Login (GTK)
\/
Closes and returns to main()
\/
main() -> Main game window (SFML) -> Control panel (GTK) -> Tool window (GTK) + Pallet Window (SFML)
Now, I have not been able to get the control panel to open without blocking the SFML window, so I called the GTK window in a new thread. I can also get the secondary GTK window to open, as well as the SFML pallet window.
At this point, all events in the secondary windows are all working fine. The issue comes in when clicking back on the main window. I get crashes and random errors.
The real killer for me is that I thought I had this issue resolved, completely, because it was working flawlessly on all windows, no matter what I tested.
Gdk-Message: Fatal IO error 0 (Success) on X server :1.
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
xcb_io.c:260: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Failed to get the window attributes
Failed to query GLX version, limited to legacy context creation
[xcb] Extra reply data still left in queue
[xcb] This is most likely caused by a broken X extension library
[xcb] Aborting, sorry about that.
: xcb_io.c:580: _XReply: Assertion `!xcb_xlib_extra_reply_data_left' failed.
/.../codelite-exec.sh: line 3: 8166 Aborted (core dumped) ${command}
I've done some searching and people have suggested adding a call to XInitThreads() in the main() function, but that didn't do any good.
I've done experimentation with various things, such as using GTK's .show() instead of app->run(), I've used .setActive(true/false), I've used std::thread.detach(), but none of the combinations yielded any results other than crashing the program sooner, blocking the other windows, or causing everything to hang.
Any idea why it randomly works one time, but then I get four different outcomes of errors?
All I want is to be able to use all of my windows without any blocking.