Flush X11 message box on close and set WM_TRANSIENT_FOR hint.

This means the dialog box will immediately close instead of waiting until all initial fonts have been loaded when fontscache.txt doesn't exist. Setting WM_TRANSIENT_FOR marks the message box as a dialog box on the main window, which causes it to have the desired behaviour of not appearing in the taskbar and not having a minimise box.. at least in some WMs
This commit is contained in:
UnknownShadow200 2019-08-28 19:11:10 +10:00
parent 4f7a82356a
commit 5279a6f2a0

View File

@ -1397,6 +1397,11 @@ static void X11_MessageBox(const char* title, const char* text, X11Window* w) {
ok.X = width/2 - ok.Width/2;
ok.Y = height - ok.Height - 10;
/* This marks the window as popup window of the main window */
/* http://tronche.com/gui/x/icccm/sec-4.html#WM_TRANSIENT_FOR */
/* Depending on WM, removes minimise and doesn't show in taskbar */
if (win_handle) XSetTransientForHint(dpy, w->win, win_handle);
XFreeFontInfo(NULL, font, 1);
XUnmapWindow(dpy, w->win); /* Make window non resizeable */
@ -1457,6 +1462,7 @@ void Window_ShowDialog(const char* title, const char* msg) {
X11_MessageBox(title, msg, &w);
X11Window_Free(&w);
XFlush(dpy); /* flush so window disappears immediately */
}
static GC fb_gc;