23#include <freerdp/config.h>
38#include <winpr/assert.h>
39#include <winpr/thread.h>
41#include <winpr/string.h>
43#include <freerdp/rail.h>
44#include <freerdp/log.h>
47#include <X11/extensions/shape.h>
51#include <X11/extensions/XInput2.h>
57#include "xf_keyboard.h"
61#define TAG CLIENT_TAG("x11")
63#include <FreeRDP_Icon_256px.h>
64#define xf_icon_prop FreeRDP_Icon_256px_prop
71#define MWM_HINTS_FUNCTIONS (1L << 0)
72#define MWM_HINTS_DECORATIONS (1L << 1)
77#define MWM_FUNC_ALL (1L << 0)
85#define MWM_DECOR_ALL (1L << 0)
93#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
102 unsigned long functions;
103 unsigned long decorations;
105 unsigned long status;
108static void xf_XSetTransientForHint(xfContext* xfc, xfAppWindow* window);
110static const char* window_style_to_string(UINT32 style)
118 ENTRY(WS_CLIPCHILDREN);
119 ENTRY(WS_CLIPSIBLINGS);
125 ENTRY(WS_MAXIMIZEBOX);
127 ENTRY(WS_OVERLAPPEDWINDOW);
129 ENTRY(WS_POPUPWINDOW);
139const char* window_styles_to_string(UINT32 style,
char* buffer,
size_t length)
141 (void)_snprintf(buffer, length,
"style[0x%08" PRIx32
"] {", style);
142 const char* sep =
"";
143 for (
size_t x = 0; x < 32; x++)
145 const UINT32 val = 1 << x;
146 if ((style & val) != 0)
148 const char* str = window_style_to_string(val);
151 winpr_str_append(str, buffer, length, sep);
156 winpr_str_append(
"}", buffer, length,
"");
161static const char* window_style_ex_to_string(UINT32 styleEx)
165 ENTRY(WS_EX_ACCEPTFILES);
166 ENTRY(WS_EX_APPWINDOW);
167 ENTRY(WS_EX_CLIENTEDGE);
168 ENTRY(WS_EX_COMPOSITED);
169 ENTRY(WS_EX_CONTEXTHELP);
170 ENTRY(WS_EX_CONTROLPARENT);
171 ENTRY(WS_EX_DLGMODALFRAME);
172 ENTRY(WS_EX_LAYERED);
173 ENTRY(WS_EX_LAYOUTRTL);
174 ENTRY(WS_EX_LEFTSCROLLBAR);
175 ENTRY(WS_EX_MDICHILD);
176 ENTRY(WS_EX_NOACTIVATE);
177 ENTRY(WS_EX_NOINHERITLAYOUT);
178 ENTRY(WS_EX_NOPARENTNOTIFY);
179 ENTRY(WS_EX_OVERLAPPEDWINDOW);
180 ENTRY(WS_EX_PALETTEWINDOW);
182 ENTRY(WS_EX_RIGHTSCROLLBAR);
183 ENTRY(WS_EX_RTLREADING);
184 ENTRY(WS_EX_STATICEDGE);
185 ENTRY(WS_EX_TOOLWINDOW);
186 ENTRY(WS_EX_TOPMOST);
187 ENTRY(WS_EX_TRANSPARENT);
188 ENTRY(WS_EX_WINDOWEDGE);
194const char* window_styles_ex_to_string(UINT32 styleEx,
char* buffer,
size_t length)
196 (void)_snprintf(buffer, length,
"styleEx[0x%08" PRIx32
"] {", styleEx);
197 const char* sep =
"";
198 for (
size_t x = 0; x < 32; x++)
200 const UINT32 val = (UINT32)(1UL << x);
201 if ((styleEx & val) != 0)
203 const char* str = window_style_ex_to_string(val);
206 winpr_str_append(str, buffer, length, sep);
211 winpr_str_append(
"}", buffer, length,
"");
216static void xf_SetWindowTitleText(xfContext* xfc, Window window,
const char* name)
221 const size_t i = strnlen(name, MAX_PATH);
222 XStoreName(xfc->display, window, name);
223 Atom wm_Name = xfc->NET_WM_NAME;
224 Atom utf8Str = xfc->UTF8_STRING;
225 LogDynAndXChangeProperty(xfc->log, xfc->display, window, wm_Name, utf8Str, 8, PropModeReplace,
226 (
const unsigned char*)name, (
int)i);
232void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom,
unsigned int numArgs, ...)
234 XEvent xevent = WINPR_C_ARRAY_INIT;
235 va_list argp = WINPR_C_ARRAY_INIT;
236 va_start(argp, numArgs);
238 xevent.xclient.type = ClientMessage;
239 xevent.xclient.serial = 0;
240 xevent.xclient.send_event = False;
241 xevent.xclient.display = xfc->display;
242 xevent.xclient.window = window;
243 xevent.xclient.message_type = atom;
244 xevent.xclient.format = 32;
246 for (
size_t i = 0; i < numArgs; i++)
248 xevent.xclient.data.l[i] = va_arg(argp,
int);
251 DEBUG_X11(
"Send ClientMessage Event: wnd=0x%04lX", (
unsigned long)xevent.xclient.window);
252 LogDynAndXSendEvent(xfc->log, xfc->display, RootWindowOfScreen(xfc->screen), False,
253 SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
254 LogDynAndXSync(xfc->log, xfc->display, False);
258void xf_SetWindowMinimized(xfContext* xfc, xfWindow* window)
260 XIconifyWindow(xfc->display, window->handle, xfc->screen_number);
263void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
265 const rdpSettings* settings =
nullptr;
268 UINT32 width = WINPR_ASSERTING_INT_CAST(uint32_t, window->width);
269 UINT32 height = WINPR_ASSERTING_INT_CAST(uint32_t, window->height);
273 settings = xfc->common.context.settings;
274 WINPR_ASSERT(settings);
278 window->decorations = xfc->decorations;
280 xf_SetWindowDecorations(xfc, window->handle, window->decorations);
281 DEBUG_X11(
"X window decoration set to %d", (
int)window->decorations);
282 xf_floatbar_toggle_fullscreen(xfc->window->floatbar, fullscreen);
286 xfc->savedWidth = xfc->window->width;
287 xfc->savedHeight = xfc->window->height;
288 xfc->savedPosX = xfc->window->left;
289 xfc->savedPosY = xfc->window->top;
292 ? WINPR_ASSERTING_INT_CAST(
296 ? WINPR_ASSERTING_INT_CAST(
302 width = WINPR_ASSERTING_INT_CAST(uint32_t, xfc->savedWidth);
303 height = WINPR_ASSERTING_INT_CAST(uint32_t, xfc->savedHeight);
304 startX = xfc->savedPosX;
305 startY = xfc->savedPosY;
312 freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorDefArray, 0);
314 startX = firstMonitor->x;
315 startY = firstMonitor->y;
321 freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorDefArray, i);
322 startX = MIN(startX, monitor->x);
323 startY = MIN(startY, monitor->y);
339 if (xfc->NET_WM_FULLSCREEN_MONITORS != None ||
342 xf_ResizeDesktopWindow(xfc, window, WINPR_ASSERTING_INT_CAST(
int, width),
343 WINPR_ASSERTING_INT_CAST(
int, height));
348 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle, startX, startY);
352 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4,
353 fullscreen ? NET_WM_STATE_ADD : NET_WM_STATE_REMOVE,
354 xfc->NET_WM_STATE_FULLSCREEN, 0, 0);
362 xf_ResizeDesktopWindow(xfc, window, WINPR_ASSERTING_INT_CAST(
int, width),
363 WINPR_ASSERTING_INT_CAST(
int, height));
364 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle, startX, startY);
370 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_FULLSCREEN_MONITORS, 5,
371 xfc->fullscreenMonitors.top, xfc->fullscreenMonitors.bottom,
372 xfc->fullscreenMonitors.left, xfc->fullscreenMonitors.right, 1);
379 xf_SetWindowDecorations(xfc, window->handle, FALSE);
381 if (xfc->fullscreenMonitors.top)
383 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_ADD,
384 xfc->fullscreenMonitors.top, 0, 0);
388 XSetWindowAttributes xswa = WINPR_C_ARRAY_INIT;
389 xswa.override_redirect = True;
390 LogDynAndXChangeWindowAttributes(xfc->log, xfc->display, window->handle,
391 CWOverrideRedirect, &xswa);
392 LogDynAndXRaiseWindow(xfc->log, xfc->display, window->handle);
393 xswa.override_redirect = False;
394 LogDynAndXChangeWindowAttributes(xfc->log, xfc->display, window->handle,
395 CWOverrideRedirect, &xswa);
399 if (xfc->NET_WM_STATE_MAXIMIZED_VERT != None)
402 unsigned long nitems = 0;
403 unsigned long bytes = 0;
404 BYTE* prop =
nullptr;
406 if (xf_GetWindowProperty(xfc, window->handle, xfc->NET_WM_STATE, 255, &nitems,
409 const Atom* aprop = (
const Atom*)prop;
412 for (
size_t x = 0; x < nitems; x++)
414 if (aprop[x] == xfc->NET_WM_STATE_MAXIMIZED_VERT)
417 if (aprop[x] == xfc->NET_WM_STATE_MAXIMIZED_HORZ)
423 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4,
424 NET_WM_STATE_REMOVE, xfc->NET_WM_STATE_MAXIMIZED_VERT, 0,
426 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4,
427 NET_WM_STATE_REMOVE, xfc->NET_WM_STATE_MAXIMIZED_HORZ, 0,
429 xfc->savedMaximizedState = state;
436 width = xfc->vscreen.area.right - xfc->vscreen.area.left + 1;
437 height = xfc->vscreen.area.bottom - xfc->vscreen.area.top + 1;
438 DEBUG_X11(
"X window move and resize %dx%d@%" PRIu32
"x%" PRIu32
"", startX, startY,
440 xf_ResizeDesktopWindow(xfc, window, WINPR_ASSERTING_INT_CAST(
int, width),
441 WINPR_ASSERTING_INT_CAST(
int, height));
442 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle, startX, startY);
446 xf_SetWindowDecorations(xfc, window->handle, window->decorations);
447 xf_ResizeDesktopWindow(xfc, window, WINPR_ASSERTING_INT_CAST(
int, width),
448 WINPR_ASSERTING_INT_CAST(
int, height));
449 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle, startX, startY);
451 if (xfc->fullscreenMonitors.top)
453 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_REMOVE,
454 xfc->fullscreenMonitors.top, 0, 0);
458 if (xfc->savedMaximizedState & 0x01)
460 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_ADD,
461 xfc->NET_WM_STATE_MAXIMIZED_VERT, 0, 0);
464 if (xfc->savedMaximizedState & 0x02)
466 xf_SendClientEvent(xfc, window->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_ADD,
467 xfc->NET_WM_STATE_MAXIMIZED_HORZ, 0, 0);
470 xfc->savedMaximizedState = 0;
477BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property,
int length,
478 unsigned long* nitems,
unsigned long* bytes, BYTE** prop)
481 Atom actual_type = None;
482 int actual_format = 0;
486 if (property == None)
489 status = LogDynAndXGetWindowProperty(xfc->log, xfc->display, window, property, 0, length, False,
490 AnyPropertyType, &actual_type, &actual_format, nitems,
493 if (status != Success)
496 if (actual_type == None)
498 WLog_DBG(TAG,
"Property %lu does not exist", (
unsigned long)property);
508static BOOL xf_GetNumberOfDesktops(xfContext* xfc, Window root,
unsigned* pval)
510 unsigned long nitems = 0;
511 unsigned long bytes = 0;
512 BYTE* bprop =
nullptr;
518 xf_GetWindowProperty(xfc, root, xfc->NET_NUMBER_OF_DESKTOPS, 1, &nitems, &bytes, &bprop);
520 long* prop = (
long*)bprop;
526 if ((*prop >= 0) && (*prop <= UINT32_MAX))
528 *pval = (UINT32)*prop;
537static BOOL xf_GetCurrentDesktop(xfContext* xfc, Window root)
539 unsigned long nitems = 0;
540 unsigned long bytes = 0;
541 BYTE* bprop =
nullptr;
544 if (!xf_GetNumberOfDesktops(xfc, root, &max))
550 xf_GetWindowProperty(xfc, root, xfc->NET_CURRENT_DESKTOP, 1, &nitems, &bytes, &bprop);
552 long* prop = (
long*)bprop;
553 xfc->current_desktop = 0;
555 xfc->current_desktop = (int)MIN(max - 1, *prop);
561static BOOL xf_GetWorkArea_NET_WORKAREA(xfContext* xfc, Window root)
564 unsigned long nitems = 0;
565 unsigned long bytes = 0;
566 BYTE* bprop =
nullptr;
569 xf_GetWindowProperty(xfc, root, xfc->NET_WORKAREA, INT_MAX, &nitems, &bytes, &bprop);
570 long* prop = (
long*)bprop;
575 if ((xfc->current_desktop * 4 + 3) >= (INT64)nitems)
578 xfc->workArea.x = (INT32)MIN(INT32_MAX, prop[xfc->current_desktop * 4 + 0]);
579 xfc->workArea.y = (INT32)MIN(INT32_MAX, prop[xfc->current_desktop * 4 + 1]);
580 xfc->workArea.width = (UINT32)MIN(UINT32_MAX, prop[xfc->current_desktop * 4 + 2]);
581 xfc->workArea.height = (UINT32)MIN(UINT32_MAX, prop[xfc->current_desktop * 4 + 3]);
589BOOL xf_GetWorkArea(xfContext* xfc)
593 Window root = DefaultRootWindow(xfc->display);
594 (void)xf_GetCurrentDesktop(xfc, root);
595 return xf_GetWorkArea_NET_WORKAREA(xfc, root);
598void xf_SetWindowDecorations(xfContext* xfc, Window window, BOOL show)
600 PropMotifWmHints hints = { .decorations = (show) ? MWM_DECOR_ALL : 0,
601 .functions = MWM_FUNC_ALL,
602 .flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS,
606 LogDynAndXChangeProperty(xfc->log, xfc->display, window, xfc->MOTIF_WM_HINTS,
607 xfc->MOTIF_WM_HINTS, 32, PropModeReplace, (BYTE*)&hints,
608 PROP_MOTIF_WM_HINTS_ELEMENTS);
611void xf_SetWindowUnlisted(xfContext* xfc, Window window)
614 Atom window_state[] = { xfc->NET_WM_STATE_SKIP_PAGER, xfc->NET_WM_STATE_SKIP_TASKBAR };
615 LogDynAndXChangeProperty(xfc->log, xfc->display, window, xfc->NET_WM_STATE, XA_ATOM, 32,
616 PropModeReplace, (BYTE*)window_state, 2);
619static void xf_SetWindowPID(xfContext* xfc, Window window, pid_t pid)
627 am_wm_pid = xfc->NET_WM_PID;
628 LogDynAndXChangeProperty(xfc->log, xfc->display, window, am_wm_pid, XA_CARDINAL, 32,
629 PropModeReplace, (BYTE*)&pid, 1);
632static const char* get_shm_id(
void)
634 static char shm_id[64];
635 (void)sprintf_s(shm_id,
sizeof(shm_id),
"/com.freerdp.xfreerdp.tsmf_%016X",
636 GetCurrentProcessId());
640Window xf_CreateDummyWindow(xfContext* xfc)
642 return LogDynAndXCreateWindow(
643 xfc->log, xfc->display, RootWindowOfScreen(xfc->screen),
644 WINPR_ASSERTING_INT_CAST(
int, xfc->workArea.x),
645 WINPR_ASSERTING_INT_CAST(
int, xfc->workArea.y), 1, 1, 0, xfc->depth, InputOutput,
646 xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->attribs_mask), &xfc->attribs);
649void xf_DestroyDummyWindow(xfContext* xfc, Window window)
652 LogDynAndXDestroyWindow(xfc->log, xfc->display, window);
655xfWindow* xf_CreateDesktopWindow(xfContext* xfc,
char* name,
int width,
int height)
657 XEvent xevent = WINPR_C_ARRAY_INIT;
659 XClassHint* classHints =
nullptr;
660 xfWindow* window = (xfWindow*)calloc(1,
sizeof(xfWindow));
665 rdpSettings* settings = xfc->common.context.settings;
666 WINPR_ASSERT(settings);
669 window->width = width;
670 window->height = height;
671 window->decorations = xfc->decorations;
672 window->is_mapped = FALSE;
673 window->is_transient = FALSE;
675 WINPR_ASSERT(xfc->depth != 0);
676 window->handle = LogDynAndXCreateWindow(
677 xfc->log, xfc->display, RootWindowOfScreen(xfc->screen),
678 WINPR_ASSERTING_INT_CAST(
int, xfc->workArea.x),
679 WINPR_ASSERTING_INT_CAST(
int, xfc->workArea.y), xfc->workArea.width, xfc->workArea.height,
680 0, xfc->depth, InputOutput, xfc->visual,
681 WINPR_ASSERTING_INT_CAST(uint32_t, xfc->attribs_mask), &xfc->attribs);
682 window->shmid = shm_open(get_shm_id(), (O_CREAT | O_RDWR), (S_IREAD | S_IWRITE));
684 if (window->shmid < 0)
686 DEBUG_X11(
"xf_CreateDesktopWindow: failed to get access to shared memory - shmget()\n");
690 int rc = ftruncate(window->shmid,
sizeof(window->handle));
694 char ebuffer[256] = WINPR_C_ARRAY_INIT;
695 DEBUG_X11(
"ftruncate failed with %s [%d]", winpr_strerror(rc, ebuffer,
sizeof(ebuffer)),
701 void* mem = mmap(
nullptr,
sizeof(window->handle), PROT_READ | PROT_WRITE, MAP_SHARED,
704 if (mem == MAP_FAILED)
707 "xf_CreateDesktopWindow: failed to assign pointer to the memory address - "
713 *window->xfwin = window->handle;
718 classHints = XAllocClassHint();
722 classHints->res_name =
"xfreerdp";
724 char* res_class =
nullptr;
727 res_class = _strdup(WmClass);
729 res_class = _strdup(
"xfreerdp");
731 classHints->res_class = res_class;
732 XSetClassHint(xfc->display, window->handle, classHints);
737 xf_ResizeDesktopWindow(xfc, window, width, height);
738 xf_SetWindowDecorations(xfc, window->handle, window->decorations);
739 xf_SetWindowPID(xfc, window->handle, 0);
740 input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
741 VisibilityChangeMask | FocusChangeMask | StructureNotifyMask | PointerMotionMask |
742 ExposureMask | PropertyChangeMask;
744 if (xfc->grab_keyboard)
745 input_mask |= EnterWindowMask | LeaveWindowMask;
747 LogDynAndXChangeProperty(xfc->log, xfc->display, window->handle, xfc->NET_WM_ICON, XA_CARDINAL,
748 32, PropModeReplace, (BYTE*)xf_icon_prop, ARRAYSIZE(xf_icon_prop));
751 LogDynAndXReparentWindow(xfc->log, xfc->display, window->handle, parentWindow, 0, 0);
753 XSelectInput(xfc->display, window->handle, input_mask);
754 LogDynAndXClearWindow(xfc->log, xfc->display, window->handle);
755 xf_SetWindowTitleText(xfc, window->handle, name);
756 LogDynAndXMapWindow(xfc->log, xfc->display, window->handle);
757 xf_input_init(xfc, window->handle);
765 XMaskEvent(xfc->display, VisibilityChangeMask, &xevent);
766 }
while (xevent.type != VisibilityNotify);
775 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle, 0, 0);
780 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle,
781 WINPR_ASSERTING_INT_CAST(
783 WINPR_ASSERTING_INT_CAST(
787 window->floatbar = xf_floatbar_new(xfc, window->handle, name,
790 if (xfc->XWAYLAND_MAY_GRAB_KEYBOARD)
791 xf_SendClientEvent(xfc, window->handle, xfc->XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
796void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window,
int width,
int height)
798 XSizeHints* size_hints =
nullptr;
799 rdpSettings* settings =
nullptr;
804 settings = xfc->common.context.settings;
805 WINPR_ASSERT(settings);
807 if (!(size_hints = XAllocSizeHints()))
810 size_hints->flags = PMinSize | PMaxSize | PWinGravity;
811 size_hints->win_gravity = NorthWestGravity;
812 size_hints->min_width = size_hints->min_height = 1;
813 size_hints->max_width = size_hints->max_height = 16384;
814 LogDynAndXResizeWindow(xfc->log, xfc->display, window->handle,
815 WINPR_ASSERTING_INT_CAST(uint32_t, width),
816 WINPR_ASSERTING_INT_CAST(uint32_t, height));
823 if (!xfc->fullscreen)
827 size_hints->min_width = size_hints->max_width = width;
828 size_hints->min_height = size_hints->max_height = height;
832 XSetWMNormalHints(xfc->display, window->handle, size_hints);
836void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window)
841 if (xfc->window == window)
842 xfc->window =
nullptr;
844 xf_floatbar_free(window->floatbar);
847 LogDynAndXFreeGC(xfc->log, xfc->display, window->gc);
851 LogDynAndXUnmapWindow(xfc->log, xfc->display, window->handle);
852 LogDynAndXDestroyWindow(xfc->log, xfc->display, window->handle);
856 munmap(
nullptr,
sizeof(*window->xfwin));
858 if (window->shmid >= 0)
859 close(window->shmid);
861 shm_unlink(get_shm_id());
862 window->xfwin = (Window*)-1;
867void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style, UINT32 ex_style)
869 Atom window_type = 0;
870 BOOL redirect = FALSE;
872 window_type = xfc->NET_WM_WINDOW_TYPE_NORMAL;
874 if ((ex_style & WS_EX_NOACTIVATE) || (ex_style & WS_EX_TOOLWINDOW))
877 appWindow->is_transient = TRUE;
878 xf_SetWindowUnlisted(xfc, appWindow->handle);
879 window_type = xfc->NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
885 else if (ex_style & WS_EX_TOPMOST)
887 window_type = xfc->NET_WM_WINDOW_TYPE_NORMAL;
890 if (style & WS_POPUP)
892 window_type = xfc->NET_WM_WINDOW_TYPE_DIALOG;
895 if (!((ex_style & WS_EX_DLGMODALFRAME) || (ex_style & WS_EX_LAYERED) ||
896 (style & WS_SYSMENU)))
898 appWindow->is_transient = TRUE;
901 xf_SetWindowUnlisted(xfc, appWindow->handle);
905 if (!(style == 0 && ex_style == 0))
907 xf_SetWindowActions(xfc, appWindow);
920 XSetWindowAttributes attrs = WINPR_C_ARRAY_INIT;
921 attrs.override_redirect = redirect ? True : False;
922 LogDynAndXChangeWindowAttributes(xfc->log, xfc->display, appWindow->handle,
923 CWOverrideRedirect, &attrs);
926 LogDynAndXChangeProperty(xfc->log, xfc->display, appWindow->handle, xfc->NET_WM_WINDOW_TYPE,
927 XA_ATOM, 32, PropModeReplace, (BYTE*)&window_type, 1);
929 const BOOL above = (ex_style & WS_EX_TOPMOST) != 0;
930 const BOOL transient = (style & WS_CHILD) == 0;
933 xf_XSetTransientForHint(
936 xf_SendClientEvent(xfc, appWindow->handle, xfc->NET_WM_STATE, 4,
937 above ? NET_WM_STATE_ADD : NET_WM_STATE_REMOVE, xfc->NET_WM_STATE_ABOVE, 0,
941void xf_SetWindowActions(xfContext* xfc, xfAppWindow* appWindow)
943 Atom allowed_actions[] = {
944 xfc->NET_WM_ACTION_CLOSE, xfc->NET_WM_ACTION_MINIMIZE,
945 xfc->NET_WM_ACTION_MOVE, xfc->NET_WM_ACTION_RESIZE,
946 xfc->NET_WM_ACTION_MAXIMIZE_HORZ, xfc->NET_WM_ACTION_MAXIMIZE_VERT,
947 xfc->NET_WM_ACTION_FULLSCREEN, xfc->NET_WM_ACTION_CHANGE_DESKTOP
950 if (!(appWindow->dwStyle & WS_SYSMENU))
951 allowed_actions[0] = 0;
953 if (!(appWindow->dwStyle & WS_MINIMIZEBOX))
954 allowed_actions[1] = 0;
956 if (!(appWindow->dwStyle & WS_SIZEBOX))
957 allowed_actions[3] = 0;
959 if (!(appWindow->dwStyle & WS_MAXIMIZEBOX))
961 allowed_actions[4] = 0;
962 allowed_actions[5] = 0;
963 allowed_actions[6] = 0;
966 LogDynAndXChangeProperty(xfc->log, xfc->display, appWindow->handle, xfc->NET_WM_ALLOWED_ACTIONS,
967 XA_ATOM, 32, PropModeReplace, (
unsigned char*)&allowed_actions, 8);
970void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow,
const char* name)
972 xf_SetWindowTitleText(xfc, appWindow->handle, name);
975static void xf_FixWindowCoordinates(xfContext* xfc,
int* x,
int* y,
int* width,
int* height)
977 int vscreen_width = 0;
978 int vscreen_height = 0;
979 vscreen_width = xfc->vscreen.area.right - xfc->vscreen.area.left + 1;
980 vscreen_height = xfc->vscreen.area.bottom - xfc->vscreen.area.top + 1;
982 if (*x < xfc->vscreen.area.left)
985 *x = xfc->vscreen.area.left;
988 if (*y < xfc->vscreen.area.top)
991 *y = xfc->vscreen.area.top;
994 if (*width > vscreen_width)
996 *width = vscreen_width;
999 if (*height > vscreen_height)
1001 *height = vscreen_height;
1015int xf_AppWindowInit(xfContext* xfc, xfAppWindow* appWindow)
1017 if (!xfc || !appWindow)
1020 xf_SetWindowDecorations(xfc, appWindow->handle, appWindow->decorations);
1021 xf_SetWindowStyle(xfc, appWindow, appWindow->dwStyle, appWindow->dwExStyle);
1022 xf_SetWindowPID(xfc, appWindow->handle, 0);
1023 xf_ShowWindow(xfc, appWindow, WINDOW_SHOW);
1024 LogDynAndXClearWindow(xfc->log, xfc->display, appWindow->handle);
1025 LogDynAndXMapWindow(xfc->log, xfc->display, appWindow->handle);
1027 xf_MoveWindow(xfc, appWindow, appWindow->x, appWindow->y, appWindow->width, appWindow->height);
1028 xf_SetWindowText(xfc, appWindow, appWindow->title);
1032BOOL xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow)
1034 XGCValues gcv = WINPR_C_ARRAY_INIT;
1036 XWMHints* InputModeHint =
nullptr;
1037 XClassHint* class_hints =
nullptr;
1038 const rdpSettings* settings =
nullptr;
1041 WINPR_ASSERT(appWindow);
1043 settings = xfc->common.context.settings;
1044 WINPR_ASSERT(settings);
1046 xf_FixWindowCoordinates(xfc, &appWindow->x, &appWindow->y, &appWindow->width,
1047 &appWindow->height);
1048 appWindow->shmid = -1;
1049 appWindow->decorations = FALSE;
1050 appWindow->fullscreen = FALSE;
1051 appWindow->local_move.state = LMS_NOT_ACTIVE;
1052 appWindow->is_mapped = FALSE;
1053 appWindow->is_transient = FALSE;
1054 appWindow->rail_state = 0;
1055 appWindow->maxVert = FALSE;
1056 appWindow->maxHorz = FALSE;
1057 appWindow->minimized = FALSE;
1058 appWindow->rail_ignore_configure = FALSE;
1060 WINPR_ASSERT(xfc->depth != 0);
1061 appWindow->handle = LogDynAndXCreateWindow(
1062 xfc->log, xfc->display, RootWindowOfScreen(xfc->screen), appWindow->x, appWindow->y,
1063 WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->width),
1064 WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->height), 0, xfc->depth, InputOutput,
1065 xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->attribs_mask), &xfc->attribs);
1067 if (!appWindow->handle)
1071 LogDynAndXCreateGC(xfc->log, xfc->display, appWindow->handle, GCGraphicsExposures, &gcv);
1073 if (!xf_AppWindowResize(xfc, appWindow))
1076 class_hints = XAllocClassHint();
1080 char* strclass =
nullptr;
1084 strclass = _strdup(WmClass);
1088 winpr_asprintf(&strclass, &size,
"RAIL:%08" PRIX64
"", appWindow->windowId);
1090 class_hints->res_class = strclass;
1091 class_hints->res_name =
"RAIL";
1092 XSetClassHint(xfc->display, appWindow->handle, class_hints);
1098 InputModeHint = XAllocWMHints();
1099 InputModeHint->flags = (1L << 0);
1100 InputModeHint->input = True;
1101 XSetWMHints(xfc->display, appWindow->handle, InputModeHint);
1102 XFree(InputModeHint);
1103 XSetWMProtocols(xfc->display, appWindow->handle, &(xfc->WM_DELETE_WINDOW), 1);
1104 input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
1105 EnterWindowMask | LeaveWindowMask | PointerMotionMask | Button1MotionMask |
1106 Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask |
1107 ButtonMotionMask | KeymapStateMask | ExposureMask | VisibilityChangeMask |
1108 StructureNotifyMask | SubstructureNotifyMask | SubstructureRedirectMask |
1109 FocusChangeMask | PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask;
1110 XSelectInput(xfc->display, appWindow->handle, input_mask);
1112 if (xfc->XWAYLAND_MAY_GRAB_KEYBOARD)
1113 xf_SendClientEvent(xfc, appWindow->handle, xfc->XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
1118void xf_SetWindowMinMaxInfo(xfContext* xfc, xfAppWindow* appWindow, WINPR_ATTR_UNUSED
int maxWidth,
1119 WINPR_ATTR_UNUSED
int maxHeight, WINPR_ATTR_UNUSED
int maxPosX,
1120 WINPR_ATTR_UNUSED
int maxPosY,
int minTrackWidth,
int minTrackHeight,
1121 int maxTrackWidth,
int maxTrackHeight)
1123 XSizeHints* size_hints =
nullptr;
1124 size_hints = XAllocSizeHints();
1128 size_hints->flags = PMinSize | PMaxSize | PResizeInc;
1129 size_hints->min_width = minTrackWidth;
1130 size_hints->min_height = minTrackHeight;
1131 size_hints->max_width = maxTrackWidth;
1132 size_hints->max_height = maxTrackHeight;
1134 size_hints->width_inc = size_hints->height_inc = 1;
1135 XSetWMNormalHints(xfc->display, appWindow->handle, size_hints);
1140void xf_StartLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow,
int direction,
int x,
int y)
1142 if (appWindow->local_move.state != LMS_NOT_ACTIVE)
1149 appWindow->local_move.root_x = x;
1150 appWindow->local_move.root_y = y;
1151 appWindow->local_move.state = LMS_STARTING;
1152 appWindow->local_move.direction = direction;
1157 xfc, appWindow->handle,
1158 xfc->NET_WM_MOVERESIZE,
1167void xf_EndLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow)
1169 if (appWindow->local_move.state == LMS_NOT_ACTIVE)
1172 if (appWindow->local_move.state == LMS_STARTING)
1181 xfc, appWindow->handle,
1182 xfc->NET_WM_MOVERESIZE,
1184 appWindow->local_move.root_x,
1185 appWindow->local_move.root_y,
1186 NET_WM_MOVERESIZE_CANCEL,
1191 appWindow->local_move.state = LMS_NOT_ACTIVE;
1194void xf_MoveWindow(xfContext* xfc, xfAppWindow* appWindow,
int x,
int y,
int width,
int height)
1196 BOOL resize = FALSE;
1198 if ((width * height) < 1)
1201 if ((appWindow->width != width) || (appWindow->height != height))
1204 if (appWindow->local_move.state == LMS_STARTING || appWindow->local_move.state == LMS_ACTIVE)
1209 appWindow->width = width;
1210 appWindow->height = height;
1214 if (!xf_AppWindowResize(xfc, appWindow))
1217 LogDynAndXMoveResizeWindow(xfc->log, xfc->display, appWindow->handle, x, y,
1218 WINPR_ASSERTING_INT_CAST(uint32_t, width),
1219 WINPR_ASSERTING_INT_CAST(uint32_t, height));
1222 LogDynAndXMoveWindow(xfc->log, xfc->display, appWindow->handle, x, y);
1224 xf_UpdateWindowArea(xfc, appWindow, 0, 0, width, height);
1227void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
1230 WINPR_ASSERT(appWindow);
1235 LogDynAndXWithdrawWindow(xfc->log, xfc->display, appWindow->handle, xfc->screen_number);
1238 case WINDOW_SHOW_MINIMIZED:
1239 appWindow->minimized = TRUE;
1240 XIconifyWindow(xfc->display, appWindow->handle, xfc->screen_number);
1243 case WINDOW_SHOW_MAXIMIZED:
1245 appWindow->maxHorz = TRUE;
1246 appWindow->maxVert = TRUE;
1247 xf_SendClientEvent(xfc, appWindow->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_ADD,
1248 xfc->NET_WM_STATE_MAXIMIZED_VERT, xfc->NET_WM_STATE_MAXIMIZED_HORZ,
1259 if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED)
1261 xf_UpdateWindowArea(xfc, appWindow, 0, 0,
1262 WINPR_ASSERTING_INT_CAST(
int, appWindow->windowWidth),
1263 WINPR_ASSERTING_INT_CAST(
int, appWindow->windowHeight));
1270 xf_SendClientEvent(xfc, appWindow->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_REMOVE,
1271 xfc->NET_WM_STATE_MAXIMIZED_VERT, xfc->NET_WM_STATE_MAXIMIZED_HORZ,
1280 if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED)
1281 appWindow->rail_ignore_configure = TRUE;
1283 if (appWindow->is_transient)
1284 xf_SetWindowUnlisted(xfc, appWindow->handle);
1286 LogDynAndXMapWindow(xfc->log, xfc->display, appWindow->handle);
1293 appWindow->rail_state = state;
1294 LogDynAndXFlush(xfc->log, xfc->display);
1297void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow,
RECTANGLE_16* rects,
int nrects)
1299 XRectangle* xrects =
nullptr;
1305 xrects = (XRectangle*)calloc(WINPR_ASSERTING_INT_CAST(uint32_t, nrects),
sizeof(XRectangle));
1307 for (
int i = 0; i < nrects; i++)
1309 xrects[i].x = WINPR_ASSERTING_INT_CAST(
short, rects[i].left);
1310 xrects[i].y = WINPR_ASSERTING_INT_CAST(
short, rects[i].top);
1311 xrects[i].width = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].right - rects[i].left);
1312 xrects[i].height = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].bottom - rects[i].top);
1315 XShapeCombineRectangles(xfc->display, appWindow->handle, ShapeBounding, 0, 0, xrects, nrects,
1321void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32 rectsOffsetX,
1324 XRectangle* xrects =
nullptr;
1330 xrects = (XRectangle*)calloc(WINPR_ASSERTING_INT_CAST(uint32_t, nrects),
sizeof(XRectangle));
1332 for (
int i = 0; i < nrects; i++)
1334 xrects[i].x = WINPR_ASSERTING_INT_CAST(
short, rects[i].left);
1335 xrects[i].y = WINPR_ASSERTING_INT_CAST(
short, rects[i].top);
1336 xrects[i].width = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].right - rects[i].left);
1337 xrects[i].height = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].bottom - rects[i].top);
1340 XShapeCombineRectangles(
1341 xfc->display, appWindow->handle, ShapeBounding, WINPR_ASSERTING_INT_CAST(
int, rectsOffsetX),
1342 WINPR_ASSERTING_INT_CAST(
int, rectsOffsetY), xrects, nrects, ShapeSet, 0);
1347void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow,
int x,
int y,
int width,
1352 const rdpSettings* settings =
nullptr;
1356 settings = xfc->common.context.settings;
1357 WINPR_ASSERT(settings);
1359 if (appWindow ==
nullptr)
1362 if (appWindow->surfaceId < UINT16_MAX)
1365 ax = x + appWindow->windowOffsetX;
1366 ay = y + appWindow->windowOffsetY;
1368 if (ax + width > appWindow->windowOffsetX + appWindow->width)
1369 width = (appWindow->windowOffsetX + appWindow->width - 1) - ax;
1371 if (ay + height > appWindow->windowOffsetY + appWindow->height)
1372 height = (appWindow->windowOffsetY + appWindow->height - 1) - ay;
1378 LogDynAndXPutImage(xfc->log, xfc->display, appWindow->pixmap, appWindow->gc, xfc->image, ax,
1379 ay, x, y, WINPR_ASSERTING_INT_CAST(uint32_t, width),
1380 WINPR_ASSERTING_INT_CAST(uint32_t, height));
1383 LogDynAndXCopyArea(xfc->log, xfc->display, appWindow->pixmap, appWindow->handle, appWindow->gc,
1384 x, y, WINPR_ASSERTING_INT_CAST(uint32_t, width),
1385 WINPR_ASSERTING_INT_CAST(uint32_t, height), x, y);
1386 LogDynAndXFlush(xfc->log, xfc->display);
1390void xf_AppWindowDestroyImage(xfAppWindow* appWindow)
1392 WINPR_ASSERT(appWindow);
1393 if (appWindow->image)
1395 appWindow->image->data =
nullptr;
1396 XDestroyImage(appWindow->image);
1397 appWindow->image =
nullptr;
1401void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
1406 if (xfc->appWindow == appWindow)
1407 xfc->appWindow =
nullptr;
1410 LogDynAndXFreeGC(xfc->log, xfc->display, appWindow->gc);
1412 if (appWindow->pixmap)
1413 LogDynAndXFreePixmap(xfc->log, xfc->display, appWindow->pixmap);
1415 xf_AppWindowDestroyImage(appWindow);
1417 if (appWindow->handle)
1419 LogDynAndXUnmapWindow(xfc->log, xfc->display, appWindow->handle);
1420 LogDynAndXDestroyWindow(xfc->log, xfc->display, appWindow->handle);
1423 if (appWindow->xfwin)
1424 munmap(
nullptr,
sizeof(*appWindow->xfwin));
1426 if (appWindow->shmid >= 0)
1427 close(appWindow->shmid);
1429 shm_unlink(get_shm_id());
1430 appWindow->xfwin = (Window*)-1;
1431 appWindow->shmid = -1;
1432 free(appWindow->title);
1433 free(appWindow->windowRects);
1434 free(appWindow->visibilityRects);
1438static xfAppWindow* get_windowUnlocked(xfContext* xfc, UINT64
id)
1441 return HashTable_GetItemValue(xfc->railWindows, &
id);
1444xfAppWindow* xf_rail_get_windowFrom(xfContext* xfc, UINT64
id,
const char* file,
const char* fkt,
1450 if (!xfc->railWindows)
1453 xfAppWindowsLockFrom(xfc, file, fkt, line);
1454 xfAppWindow* window = get_windowUnlocked(xfc,
id);
1456 xfAppWindowsUnlockFrom(xfc, file, fkt, line);
1461xfAppWindow* xf_AppWindowFromX11WindowFrom(xfContext* xfc, Window wnd,
const char* file,
1462 const char* fkt,
size_t line)
1464 ULONG_PTR* pKeys =
nullptr;
1467 if (!xfc->railWindows)
1470 xfAppWindowsLockFrom(xfc, file, fkt, line);
1471 size_t count = HashTable_GetKeys(xfc->railWindows, &pKeys);
1473 for (
size_t index = 0; index < count; index++)
1475 xfAppWindow* appWindow = get_windowUnlocked(xfc, *(UINT64*)pKeys[index]);
1479 xfAppWindowsUnlockFrom(xfc, file, fkt, line);
1484 if (appWindow->handle == wnd)
1491 xfAppWindowsUnlockFrom(xfc, file, fkt, line);
1496UINT xf_AppUpdateWindowFromSurface(xfContext* xfc, gdiGfxSurface* surface)
1498 XImage* image =
nullptr;
1499 UINT rc = ERROR_INTERNAL_ERROR;
1502 WINPR_ASSERT(surface);
1504 xfAppWindow* appWindow = xf_rail_get_window(xfc, surface->windowId);
1507 WLog_VRB(TAG,
"Failed to find a window for id=0x%08" PRIx64, surface->windowId);
1508 return CHANNEL_RC_OK;
1513 const RECTANGLE_16* rects = region16_rects(&surface->invalidRegion, &nrects);
1518 if (appWindow->surfaceId != surface->surfaceId)
1520 xf_AppWindowDestroyImage(appWindow);
1521 appWindow->surfaceId = surface->surfaceId;
1523 if (appWindow->width != (INT64)surface->width)
1524 xf_AppWindowDestroyImage(appWindow);
1525 if (appWindow->height != (INT64)surface->height)
1526 xf_AppWindowDestroyImage(appWindow);
1528 if (!appWindow->image)
1530 WINPR_ASSERT(xfc->depth != 0);
1531 appWindow->image = LogDynAndXCreateImage(
1532 xfc->log, xfc->display, xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth),
1533 ZPixmap, 0, (
char*)surface->data, surface->width, surface->height,
1534 xfc->scanline_pad, WINPR_ASSERTING_INT_CAST(
int, surface->scanline));
1535 if (!appWindow->image)
1538 "Failed create a XImage[%" PRIu32
"x%" PRIu32
", scanline=%" PRIu32
1539 ", bpp=%" PRId32
"] for window id=0x%08" PRIx64,
1540 surface->width, surface->height, surface->scanline, xfc->depth,
1544 appWindow->image->byte_order = LSBFirst;
1545 appWindow->image->bitmap_bit_order = LSBFirst;
1548 image = appWindow->image;
1552 xfGfxSurface* xfSurface = (xfGfxSurface*)surface;
1553 image = xfSurface->image;
1556 for (UINT32 x = 0; x < nrects; x++)
1559 const UINT32 width = rect->right - rect->left;
1560 const UINT32 height = rect->bottom - rect->top;
1562 LogDynAndXPutImage(xfc->log, xfc->display, appWindow->pixmap, appWindow->gc, image,
1563 rect->left, rect->top, rect->left, rect->top, width, height);
1565 LogDynAndXCopyArea(xfc->log, xfc->display, appWindow->pixmap, appWindow->handle,
1566 appWindow->gc, rect->left, rect->top, width, height, rect->left,
1572 xf_rail_return_window(appWindow);
1573 LogDynAndXFlush(xfc->log, xfc->display);
1578BOOL xf_AppWindowResize(xfContext* xfc, xfAppWindow* appWindow)
1581 WINPR_ASSERT(appWindow);
1583 if (appWindow->pixmap != 0)
1584 LogDynAndXFreePixmap(xfc->log, xfc->display, appWindow->pixmap);
1586 WINPR_ASSERT(xfc->depth != 0);
1587 appWindow->pixmap = LogDynAndXCreatePixmap(
1588 xfc->log, xfc->display, xfc->drawable, WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->width),
1589 WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->height),
1590 WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth));
1591 xf_AppWindowDestroyImage(appWindow);
1593 return appWindow->pixmap != 0;
1596void xf_XSetTransientForHint(xfContext* xfc, xfAppWindow* window)
1599 WINPR_ASSERT(window);
1601 if (window->ownerWindowId == 0)
1604 xfAppWindow* parent = xf_rail_get_window(xfc, window->ownerWindowId);
1608 (void)LogDynAndXSetTransientForHint(xfc->log, xfc->display, window->handle, parent->handle);
1609 xf_rail_return_window(parent);
1612void xfAppWindowsLockFrom(xfContext* xfc, WINPR_ATTR_UNUSED
const char* file,
1613 WINPR_ATTR_UNUSED
const char* fkt, WINPR_ATTR_UNUSED
size_t line)
1617#if defined(WITH_VERBOSE_WINPR_ASSERT)
1618 const DWORD level = WLOG_TRACE;
1619 if (WLog_IsLevelActive(xfc->log, level))
1620 WLog_PrintTextMessage(xfc->log, level, line, file, fkt,
"[rails] locking [%s]", fkt);
1623 HashTable_Lock(xfc->railWindows);
1625#if defined(WITH_VERBOSE_WINPR_ASSERT)
1626 WINPR_ASSERT(!xfc->isRailWindowsLocked);
1627 xfc->isRailWindowsLocked = TRUE;
1631void xfAppWindowsUnlockFrom(xfContext* xfc, WINPR_ATTR_UNUSED
const char* file,
1632 WINPR_ATTR_UNUSED
const char* fkt, WINPR_ATTR_UNUSED
size_t line)
1636#if defined(WITH_VERBOSE_WINPR_ASSERT)
1637 const DWORD level = WLOG_TRACE;
1638 if (WLog_IsLevelActive(xfc->log, level))
1639 WLog_PrintTextMessage(xfc->log, level, line, file, fkt,
"[rails] unocking [%s]", fkt);
1641 WINPR_ASSERT(xfc->isRailWindowsLocked);
1642 xfc->isRailWindowsLocked = FALSE;
1645 HashTable_Unlock(xfc->railWindows);
WINPR_ATTR_NODISCARD FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.
WINPR_ATTR_NODISCARD FREERDP_API INT32 freerdp_settings_get_int32(const rdpSettings *settings, FreeRDP_Settings_Keys_Int32 id)
Returns a INT32 settings value.
WINPR_ATTR_NODISCARD FREERDP_API UINT64 freerdp_settings_get_uint64(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt64 id)
Returns a UINT64 settings value.
WINPR_ATTR_NODISCARD FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
WINPR_ATTR_NODISCARD FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.