[client,X11] fix rails modal windows

xf_XSetTransientForHint of windows of type
(WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME)
and parent window set
This commit is contained in:
akallabeth 2024-09-16 09:23:35 +02:00
parent c8e6b1b71f
commit fd3c7633d6
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
1 changed files with 26 additions and 0 deletions

View File

@ -112,6 +112,8 @@ typedef struct
unsigned long status;
} PropMotifWmHints;
static void xf_XSetTransientForHint(xfContext* xfc, xfAppWindow* window);
static const char* window_style_to_string(UINT32 style)
{
switch (style)
@ -866,6 +868,9 @@ void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style, UIN
LogTagAndXChangeProperty(TAG, xfc->display, appWindow->handle, xfc->_NET_WM_WINDOW_TYPE,
XA_ATOM, 32, PropModeReplace, (BYTE*)&window_type, 1);
if (ex_style & (WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME))
xf_XSetTransientForHint(xfc, appWindow);
}
void xf_SetWindowActions(xfContext* xfc, xfAppWindow* appWindow)
@ -1474,3 +1479,24 @@ BOOL xf_AppWindowResize(xfContext* xfc, xfAppWindow* appWindow)
return appWindow->pixmap != 0;
}
void xf_XSetTransientForHint(xfContext* xfc, xfAppWindow* window)
{
WINPR_ASSERT(xfc);
WINPR_ASSERT(window);
if (window->ownerWindowId == 0)
return;
xfAppWindow* parent = xf_rail_get_window(xfc, window->ownerWindowId);
if (!parent)
return;
const int rc = XSetTransientForHint(xfc->display, window->handle, parent->handle);
if (rc)
{
char buffer[128] = { 0 };
WLog_WARN(TAG, "XSetTransientForHint [%d]{%s}", rc,
x11_error_to_string(xfc, rc, buffer, sizeof(buffer)));
}
}