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 if (xf_input_init(xfc, window->handle) < 0)
759 xf_DestroyDesktopWindow(xfc, window);
769 XMaskEvent(xfc->display, VisibilityChangeMask, &xevent);
770 }
while (xevent.type != VisibilityNotify);
779 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle, 0, 0);
784 LogDynAndXMoveWindow(xfc->log, xfc->display, window->handle,
785 WINPR_ASSERTING_INT_CAST(
787 WINPR_ASSERTING_INT_CAST(
791 window->floatbar = xf_floatbar_new(xfc, window->handle, name,
794 if (xfc->XWAYLAND_MAY_GRAB_KEYBOARD)
795 xf_SendClientEvent(xfc, window->handle, xfc->XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
800void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window,
int width,
int height)
802 XSizeHints* size_hints =
nullptr;
803 rdpSettings* settings =
nullptr;
808 settings = xfc->common.context.settings;
809 WINPR_ASSERT(settings);
811 if (!(size_hints = XAllocSizeHints()))
814 size_hints->flags = PMinSize | PMaxSize | PWinGravity;
815 size_hints->win_gravity = NorthWestGravity;
816 size_hints->min_width = size_hints->min_height = 1;
817 size_hints->max_width = size_hints->max_height = 16384;
818 LogDynAndXResizeWindow(xfc->log, xfc->display, window->handle,
819 WINPR_ASSERTING_INT_CAST(uint32_t, width),
820 WINPR_ASSERTING_INT_CAST(uint32_t, height));
827 if (!xfc->fullscreen)
831 size_hints->min_width = size_hints->max_width = width;
832 size_hints->min_height = size_hints->max_height = height;
836 XSetWMNormalHints(xfc->display, window->handle, size_hints);
840void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window)
847 if (xfc->window == window)
848 xfc->window =
nullptr;
850 xf_floatbar_free(window->floatbar);
853 LogDynAndXFreeGC(xfc->log, xfc->display, window->gc);
857 LogDynAndXUnmapWindow(xfc->log, xfc->display, window->handle);
858 LogDynAndXDestroyWindow(xfc->log, xfc->display, window->handle);
862 munmap(window->xfwin,
sizeof(*window->xfwin));
864 if (window->shmid >= 0)
865 close(window->shmid);
867 shm_unlink(get_shm_id());
868 window->xfwin = (Window*)-1;
873void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style, UINT32 ex_style)
875 Atom window_type = 0;
876 BOOL redirect = FALSE;
878 window_type = xfc->NET_WM_WINDOW_TYPE_NORMAL;
880 if ((ex_style & WS_EX_NOACTIVATE) || (ex_style & WS_EX_TOOLWINDOW))
883 appWindow->is_transient = TRUE;
884 xf_SetWindowUnlisted(xfc, appWindow->handle);
885 window_type = xfc->NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
891 else if (ex_style & WS_EX_TOPMOST)
893 window_type = xfc->NET_WM_WINDOW_TYPE_NORMAL;
896 if (style & WS_POPUP)
898 window_type = xfc->NET_WM_WINDOW_TYPE_DIALOG;
901 if (!((ex_style & WS_EX_DLGMODALFRAME) || (ex_style & WS_EX_LAYERED) ||
902 (style & WS_SYSMENU)))
904 appWindow->is_transient = TRUE;
907 xf_SetWindowUnlisted(xfc, appWindow->handle);
911 if (!(style == 0 && ex_style == 0))
913 xf_SetWindowActions(xfc, appWindow);
926 XSetWindowAttributes attrs = WINPR_C_ARRAY_INIT;
927 attrs.override_redirect = redirect ? True : False;
928 LogDynAndXChangeWindowAttributes(xfc->log, xfc->display, appWindow->handle,
929 CWOverrideRedirect, &attrs);
932 LogDynAndXChangeProperty(xfc->log, xfc->display, appWindow->handle, xfc->NET_WM_WINDOW_TYPE,
933 XA_ATOM, 32, PropModeReplace, (BYTE*)&window_type, 1);
935 const BOOL above = (ex_style & WS_EX_TOPMOST) != 0;
936 const BOOL transient = (style & WS_CHILD) == 0;
939 xf_XSetTransientForHint(
942 xf_SendClientEvent(xfc, appWindow->handle, xfc->NET_WM_STATE, 4,
943 above ? NET_WM_STATE_ADD : NET_WM_STATE_REMOVE, xfc->NET_WM_STATE_ABOVE, 0,
947void xf_SetWindowActions(xfContext* xfc, xfAppWindow* appWindow)
949 Atom allowed_actions[] = {
950 xfc->NET_WM_ACTION_CLOSE, xfc->NET_WM_ACTION_MINIMIZE,
951 xfc->NET_WM_ACTION_MOVE, xfc->NET_WM_ACTION_RESIZE,
952 xfc->NET_WM_ACTION_MAXIMIZE_HORZ, xfc->NET_WM_ACTION_MAXIMIZE_VERT,
953 xfc->NET_WM_ACTION_FULLSCREEN, xfc->NET_WM_ACTION_CHANGE_DESKTOP
956 if (!(appWindow->dwStyle & WS_SYSMENU))
957 allowed_actions[0] = 0;
959 if (!(appWindow->dwStyle & WS_MINIMIZEBOX))
960 allowed_actions[1] = 0;
962 if (!(appWindow->dwStyle & WS_SIZEBOX))
963 allowed_actions[3] = 0;
965 if (!(appWindow->dwStyle & WS_MAXIMIZEBOX))
967 allowed_actions[4] = 0;
968 allowed_actions[5] = 0;
969 allowed_actions[6] = 0;
972 LogDynAndXChangeProperty(xfc->log, xfc->display, appWindow->handle, xfc->NET_WM_ALLOWED_ACTIONS,
973 XA_ATOM, 32, PropModeReplace, (
unsigned char*)&allowed_actions, 8);
976void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow,
const char* name)
978 xf_SetWindowTitleText(xfc, appWindow->handle, name);
981static void xf_FixWindowCoordinates(xfContext* xfc,
int* x,
int* y,
int* width,
int* height)
983 int vscreen_width = 0;
984 int vscreen_height = 0;
985 vscreen_width = xfc->vscreen.area.right - xfc->vscreen.area.left + 1;
986 vscreen_height = xfc->vscreen.area.bottom - xfc->vscreen.area.top + 1;
988 if (*x < xfc->vscreen.area.left)
991 *x = xfc->vscreen.area.left;
994 if (*y < xfc->vscreen.area.top)
997 *y = xfc->vscreen.area.top;
1000 if (*width > vscreen_width)
1002 *width = vscreen_width;
1005 if (*height > vscreen_height)
1007 *height = vscreen_height;
1021int xf_AppWindowInit(xfContext* xfc, xfAppWindow* appWindow)
1023 if (!xfc || !appWindow)
1026 xf_SetWindowDecorations(xfc, appWindow->handle, appWindow->decorations);
1027 xf_SetWindowStyle(xfc, appWindow, appWindow->dwStyle, appWindow->dwExStyle);
1028 xf_SetWindowPID(xfc, appWindow->handle, 0);
1029 xf_ShowWindow(xfc, appWindow, WINDOW_SHOW);
1030 LogDynAndXClearWindow(xfc->log, xfc->display, appWindow->handle);
1031 LogDynAndXMapWindow(xfc->log, xfc->display, appWindow->handle);
1033 xf_MoveWindow(xfc, appWindow, appWindow->x, appWindow->y, appWindow->width, appWindow->height);
1034 xf_SetWindowText(xfc, appWindow, appWindow->title);
1038BOOL xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow)
1040 XGCValues gcv = WINPR_C_ARRAY_INIT;
1042 XWMHints* InputModeHint =
nullptr;
1043 XClassHint* class_hints =
nullptr;
1044 const rdpSettings* settings =
nullptr;
1047 WINPR_ASSERT(appWindow);
1049 settings = xfc->common.context.settings;
1050 WINPR_ASSERT(settings);
1052 xf_FixWindowCoordinates(xfc, &appWindow->x, &appWindow->y, &appWindow->width,
1053 &appWindow->height);
1054 appWindow->shmid = -1;
1055 appWindow->decorations = FALSE;
1056 appWindow->fullscreen = FALSE;
1057 appWindow->local_move.state = LMS_NOT_ACTIVE;
1058 appWindow->is_mapped = FALSE;
1059 appWindow->is_transient = FALSE;
1060 appWindow->rail_state = 0;
1061 appWindow->maxVert = FALSE;
1062 appWindow->maxHorz = FALSE;
1063 appWindow->minimized = FALSE;
1064 appWindow->rail_ignore_configure = FALSE;
1066 WINPR_ASSERT(xfc->depth != 0);
1067 appWindow->handle = LogDynAndXCreateWindow(
1068 xfc->log, xfc->display, RootWindowOfScreen(xfc->screen), appWindow->x, appWindow->y,
1069 WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->width),
1070 WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->height), 0, xfc->depth, InputOutput,
1071 xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->attribs_mask), &xfc->attribs);
1073 if (!appWindow->handle)
1077 LogDynAndXCreateGC(xfc->log, xfc->display, appWindow->handle, GCGraphicsExposures, &gcv);
1079 if (!xf_AppWindowResize(xfc, appWindow))
1082 class_hints = XAllocClassHint();
1086 char* strclass =
nullptr;
1090 strclass = _strdup(WmClass);
1094 winpr_asprintf(&strclass, &size,
"RAIL:%08" PRIX64
"", appWindow->windowId);
1096 class_hints->res_class = strclass;
1097 class_hints->res_name =
"RAIL";
1098 XSetClassHint(xfc->display, appWindow->handle, class_hints);
1104 InputModeHint = XAllocWMHints();
1105 InputModeHint->flags = (1L << 0);
1106 InputModeHint->input = True;
1107 XSetWMHints(xfc->display, appWindow->handle, InputModeHint);
1108 XFree(InputModeHint);
1109 XSetWMProtocols(xfc->display, appWindow->handle, &(xfc->WM_DELETE_WINDOW), 1);
1110 input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
1111 EnterWindowMask | LeaveWindowMask | PointerMotionMask | Button1MotionMask |
1112 Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask |
1113 ButtonMotionMask | KeymapStateMask | ExposureMask | VisibilityChangeMask |
1114 StructureNotifyMask | SubstructureNotifyMask | SubstructureRedirectMask |
1115 FocusChangeMask | PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask;
1116 XSelectInput(xfc->display, appWindow->handle, input_mask);
1118 if (xfc->XWAYLAND_MAY_GRAB_KEYBOARD)
1119 xf_SendClientEvent(xfc, appWindow->handle, xfc->XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
1124void xf_SetWindowMinMaxInfo(xfContext* xfc, xfAppWindow* appWindow, WINPR_ATTR_UNUSED
int maxWidth,
1125 WINPR_ATTR_UNUSED
int maxHeight, WINPR_ATTR_UNUSED
int maxPosX,
1126 WINPR_ATTR_UNUSED
int maxPosY,
int minTrackWidth,
int minTrackHeight,
1127 int maxTrackWidth,
int maxTrackHeight)
1129 XSizeHints* size_hints =
nullptr;
1130 size_hints = XAllocSizeHints();
1134 size_hints->flags = PMinSize | PMaxSize | PResizeInc;
1135 size_hints->min_width = minTrackWidth;
1136 size_hints->min_height = minTrackHeight;
1137 size_hints->max_width = maxTrackWidth;
1138 size_hints->max_height = maxTrackHeight;
1140 size_hints->width_inc = size_hints->height_inc = 1;
1141 XSetWMNormalHints(xfc->display, appWindow->handle, size_hints);
1146void xf_StartLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow,
int direction,
int x,
int y)
1148 if (appWindow->local_move.state != LMS_NOT_ACTIVE)
1155 appWindow->local_move.root_x = x;
1156 appWindow->local_move.root_y = y;
1157 appWindow->local_move.state = LMS_STARTING;
1158 appWindow->local_move.direction = direction;
1163 xfc, appWindow->handle,
1164 xfc->NET_WM_MOVERESIZE,
1173void xf_EndLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow)
1175 if (appWindow->local_move.state == LMS_NOT_ACTIVE)
1178 if (appWindow->local_move.state == LMS_STARTING)
1187 xfc, appWindow->handle,
1188 xfc->NET_WM_MOVERESIZE,
1190 appWindow->local_move.root_x,
1191 appWindow->local_move.root_y,
1192 NET_WM_MOVERESIZE_CANCEL,
1197 appWindow->local_move.state = LMS_NOT_ACTIVE;
1200void xf_MoveWindow(xfContext* xfc, xfAppWindow* appWindow,
int x,
int y,
int width,
int height)
1202 BOOL resize = FALSE;
1204 if ((width * height) < 1)
1207 if ((appWindow->width != width) || (appWindow->height != height))
1210 if (appWindow->local_move.state == LMS_STARTING || appWindow->local_move.state == LMS_ACTIVE)
1215 appWindow->width = width;
1216 appWindow->height = height;
1220 if (!xf_AppWindowResize(xfc, appWindow))
1223 LogDynAndXMoveResizeWindow(xfc->log, xfc->display, appWindow->handle, x, y,
1224 WINPR_ASSERTING_INT_CAST(uint32_t, width),
1225 WINPR_ASSERTING_INT_CAST(uint32_t, height));
1228 LogDynAndXMoveWindow(xfc->log, xfc->display, appWindow->handle, x, y);
1230 xf_UpdateWindowArea(xfc, appWindow, 0, 0, width, height);
1233void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
1236 WINPR_ASSERT(appWindow);
1241 LogDynAndXWithdrawWindow(xfc->log, xfc->display, appWindow->handle, xfc->screen_number);
1244 case WINDOW_SHOW_MINIMIZED:
1245 appWindow->minimized = TRUE;
1246 XIconifyWindow(xfc->display, appWindow->handle, xfc->screen_number);
1249 case WINDOW_SHOW_MAXIMIZED:
1251 appWindow->maxHorz = TRUE;
1252 appWindow->maxVert = TRUE;
1253 xf_SendClientEvent(xfc, appWindow->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_ADD,
1254 xfc->NET_WM_STATE_MAXIMIZED_VERT, xfc->NET_WM_STATE_MAXIMIZED_HORZ,
1265 if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED)
1267 xf_UpdateWindowArea(xfc, appWindow, 0, 0,
1268 WINPR_ASSERTING_INT_CAST(
int, appWindow->windowWidth),
1269 WINPR_ASSERTING_INT_CAST(
int, appWindow->windowHeight));
1276 xf_SendClientEvent(xfc, appWindow->handle, xfc->NET_WM_STATE, 4, NET_WM_STATE_REMOVE,
1277 xfc->NET_WM_STATE_MAXIMIZED_VERT, xfc->NET_WM_STATE_MAXIMIZED_HORZ,
1286 if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED)
1287 appWindow->rail_ignore_configure = TRUE;
1289 if (appWindow->is_transient)
1290 xf_SetWindowUnlisted(xfc, appWindow->handle);
1292 LogDynAndXMapWindow(xfc->log, xfc->display, appWindow->handle);
1299 appWindow->rail_state = state;
1300 LogDynAndXFlush(xfc->log, xfc->display);
1303void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow,
RECTANGLE_16* rects,
int nrects)
1305 XRectangle* xrects =
nullptr;
1311 xrects = (XRectangle*)calloc(WINPR_ASSERTING_INT_CAST(uint32_t, nrects),
sizeof(XRectangle));
1313 for (
int i = 0; i < nrects; i++)
1315 xrects[i].x = WINPR_ASSERTING_INT_CAST(
short, rects[i].left);
1316 xrects[i].y = WINPR_ASSERTING_INT_CAST(
short, rects[i].top);
1317 xrects[i].width = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].right - rects[i].left);
1318 xrects[i].height = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].bottom - rects[i].top);
1321 XShapeCombineRectangles(xfc->display, appWindow->handle, ShapeBounding, 0, 0, xrects, nrects,
1327void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32 rectsOffsetX,
1330 XRectangle* xrects =
nullptr;
1336 xrects = (XRectangle*)calloc(WINPR_ASSERTING_INT_CAST(uint32_t, nrects),
sizeof(XRectangle));
1338 for (
int i = 0; i < nrects; i++)
1340 xrects[i].x = WINPR_ASSERTING_INT_CAST(
short, rects[i].left);
1341 xrects[i].y = WINPR_ASSERTING_INT_CAST(
short, rects[i].top);
1342 xrects[i].width = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].right - rects[i].left);
1343 xrects[i].height = WINPR_ASSERTING_INT_CAST(
unsigned short, rects[i].bottom - rects[i].top);
1346 XShapeCombineRectangles(
1347 xfc->display, appWindow->handle, ShapeBounding, WINPR_ASSERTING_INT_CAST(
int, rectsOffsetX),
1348 WINPR_ASSERTING_INT_CAST(
int, rectsOffsetY), xrects, nrects, ShapeSet, 0);
1353void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow,
int x,
int y,
int width,
1358 const rdpSettings* settings =
nullptr;
1362 settings = xfc->common.context.settings;
1363 WINPR_ASSERT(settings);
1365 if (appWindow ==
nullptr)
1368 if (appWindow->surfaceId < UINT16_MAX)
1371 ax = x + appWindow->windowOffsetX;
1372 ay = y + appWindow->windowOffsetY;
1374 if (ax + width > appWindow->windowOffsetX + appWindow->width)
1375 width = (appWindow->windowOffsetX + appWindow->width - 1) - ax;
1377 if (ay + height > appWindow->windowOffsetY + appWindow->height)
1378 height = (appWindow->windowOffsetY + appWindow->height - 1) - ay;
1382 LogDynAndXPutImage(xfc->log, xfc->display, appWindow->pixmap, appWindow->gc, xfc->image, ax,
1383 ay, x, y, WINPR_ASSERTING_INT_CAST(uint32_t, width),
1384 WINPR_ASSERTING_INT_CAST(uint32_t, height));
1387 LogDynAndXCopyArea(xfc->log, xfc->display, appWindow->pixmap, appWindow->handle, appWindow->gc,
1388 x, y, WINPR_ASSERTING_INT_CAST(uint32_t, width),
1389 WINPR_ASSERTING_INT_CAST(uint32_t, height), x, y);
1390 LogDynAndXFlush(xfc->log, xfc->display);
1393void xf_AppWindowDestroyImage(xfAppWindow* appWindow)
1395 WINPR_ASSERT(appWindow);
1396 if (appWindow->image)
1398 appWindow->image->data =
nullptr;
1399 XDestroyImage(appWindow->image);
1400 appWindow->image =
nullptr;
1404void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
1409 if (xfc->appWindow == appWindow)
1410 xfc->appWindow =
nullptr;
1413 LogDynAndXFreeGC(xfc->log, xfc->display, appWindow->gc);
1415 if (appWindow->pixmap)
1416 LogDynAndXFreePixmap(xfc->log, xfc->display, appWindow->pixmap);
1418 xf_AppWindowDestroyImage(appWindow);
1420 if (appWindow->handle)
1422 LogDynAndXUnmapWindow(xfc->log, xfc->display, appWindow->handle);
1423 LogDynAndXDestroyWindow(xfc->log, xfc->display, appWindow->handle);
1426 if (appWindow->xfwin)
1427 munmap(
nullptr,
sizeof(*appWindow->xfwin));
1429 if (appWindow->shmid >= 0)
1430 close(appWindow->shmid);
1432 shm_unlink(get_shm_id());
1433 appWindow->xfwin = (Window*)-1;
1434 appWindow->shmid = -1;
1435 free(appWindow->title);
1436 free(appWindow->windowRects);
1437 free(appWindow->visibilityRects);
1441static xfAppWindow* get_windowUnlocked(xfContext* xfc, UINT64
id)
1444 return HashTable_GetItemValue(xfc->railWindows, &
id);
1447xfAppWindow* xf_rail_get_windowFrom(xfContext* xfc, UINT64
id, BOOL alreadyLocked,
const char* file,
1448 const char* fkt,
size_t line)
1453 if (!xfc->railWindows)
1457 xfAppWindowsLockFrom(xfc, file, fkt, line);
1459 xfAppWindow* window = get_windowUnlocked(xfc,
id);
1461 if (!window && !alreadyLocked)
1462 xfAppWindowsUnlockFrom(xfc, file, fkt, line);
1467xfAppWindow* xf_AppWindowFromX11WindowFrom(xfContext* xfc, Window wnd,
const char* file,
1468 const char* fkt,
size_t line)
1470 ULONG_PTR* pKeys =
nullptr;
1473 if (!xfc->railWindows)
1476 xfAppWindowsLockFrom(xfc, file, fkt, line);
1477 size_t count = HashTable_GetKeys(xfc->railWindows, &pKeys);
1479 for (
size_t index = 0; index < count; index++)
1481 xfAppWindow* appWindow = get_windowUnlocked(xfc, *(UINT64*)pKeys[index]);
1485 xfAppWindowsUnlockFrom(xfc, file, fkt, line);
1490 if (appWindow->handle == wnd)
1497 xfAppWindowsUnlockFrom(xfc, file, fkt, line);
1502UINT xf_AppUpdateWindowFromSurface(xfContext* xfc, gdiGfxSurface* surface)
1504 XImage* image =
nullptr;
1505 UINT rc = ERROR_INTERNAL_ERROR;
1508 WINPR_ASSERT(surface);
1510 xfAppWindow* appWindow = xf_rail_get_window(xfc, surface->windowId, FALSE);
1513 WLog_VRB(TAG,
"Failed to find a window for id=0x%08" PRIx64, surface->windowId);
1514 return CHANNEL_RC_OK;
1519 const RECTANGLE_16* rects = region16_rects(&surface->invalidRegion, &nrects);
1523 if (appWindow->surfaceId != surface->surfaceId)
1525 xf_AppWindowDestroyImage(appWindow);
1526 appWindow->surfaceId = surface->surfaceId;
1528 if (appWindow->width != (INT64)surface->width)
1529 xf_AppWindowDestroyImage(appWindow);
1530 if (appWindow->height != (INT64)surface->height)
1531 xf_AppWindowDestroyImage(appWindow);
1533 if (!appWindow->image)
1535 WINPR_ASSERT(xfc->depth != 0);
1536 appWindow->image = LogDynAndXCreateImage(
1537 xfc->log, xfc->display, xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth),
1538 ZPixmap, 0, (
char*)surface->data, surface->width, surface->height,
1539 xfc->scanline_pad, WINPR_ASSERTING_INT_CAST(
int, surface->scanline));
1540 if (!appWindow->image)
1543 "Failed create a XImage[%" PRIu32
"x%" PRIu32
", scanline=%" PRIu32
1544 ", bpp=%" PRId32
"] for window id=0x%08" PRIx64,
1545 surface->width, surface->height, surface->scanline, xfc->depth,
1549 appWindow->image->byte_order = LSBFirst;
1550 appWindow->image->bitmap_bit_order = LSBFirst;
1553 image = appWindow->image;
1557 xfGfxSurface* xfSurface = (xfGfxSurface*)surface;
1558 image = xfSurface->image;
1561 for (UINT32 x = 0; x < nrects; x++)
1564 const UINT32 width = rect->right - rect->left;
1565 const UINT32 height = rect->bottom - rect->top;
1567 LogDynAndXPutImage(xfc->log, xfc->display, appWindow->pixmap, appWindow->gc, image,
1568 rect->left, rect->top, rect->left, rect->top, width, height);
1570 LogDynAndXCopyArea(xfc->log, xfc->display, appWindow->pixmap, appWindow->handle,
1571 appWindow->gc, rect->left, rect->top, width, height, rect->left,
1577 xf_rail_return_window(appWindow, FALSE);
1578 LogDynAndXFlush(xfc->log, xfc->display);
1583BOOL xf_AppWindowResize(xfContext* xfc, xfAppWindow* appWindow)
1586 WINPR_ASSERT(appWindow);
1588 if (appWindow->pixmap != 0)
1589 LogDynAndXFreePixmap(xfc->log, xfc->display, appWindow->pixmap);
1591 WINPR_ASSERT(xfc->depth != 0);
1592 appWindow->pixmap = LogDynAndXCreatePixmap(
1593 xfc->log, xfc->display, xfc->drawable, WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->width),
1594 WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->height),
1595 WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth));
1596 xf_AppWindowDestroyImage(appWindow);
1598 return appWindow->pixmap != 0;
1601void xf_XSetTransientForHint(xfContext* xfc, xfAppWindow* window)
1604 WINPR_ASSERT(window);
1606 if (window->ownerWindowId == 0)
1609 xfAppWindow* parent = xf_rail_get_window(xfc, window->ownerWindowId, TRUE);
1613 (void)LogDynAndXSetTransientForHint(xfc->log, xfc->display, window->handle, parent->handle);
1614 xf_rail_return_window(parent, TRUE);
1617void xfAppWindowsLockFrom(xfContext* xfc, WINPR_ATTR_UNUSED
const char* file,
1618 WINPR_ATTR_UNUSED
const char* fkt, WINPR_ATTR_UNUSED
size_t line)
1622#if defined(WITH_VERBOSE_WINPR_ASSERT)
1623 const DWORD level = WLOG_TRACE;
1624 if (WLog_IsLevelActive(xfc->log, level))
1625 WLog_PrintTextMessage(xfc->log, level, line, file, fkt,
"[rails] locking [%s]", fkt);
1629 HashTable_Lock(xfc->railWindows);
1631#if defined(WITH_VERBOSE_WINPR_ASSERT)
1632 WINPR_ASSERT(!xfc->isRailWindowsLocked);
1633 xfc->isRailWindowsLocked = TRUE;
1637void xfAppWindowsUnlockFrom(xfContext* xfc, WINPR_ATTR_UNUSED
const char* file,
1638 WINPR_ATTR_UNUSED
const char* fkt, WINPR_ATTR_UNUSED
size_t line)
1642#if defined(WITH_VERBOSE_WINPR_ASSERT)
1643 const DWORD level = WLOG_TRACE;
1644 if (WLog_IsLevelActive(xfc->log, level))
1645 WLog_PrintTextMessage(xfc->log, level, line, file, fkt,
"[rails] unocking [%s]", fkt);
1647 WINPR_ASSERT(xfc->isRailWindowsLocked);
1648 xfc->isRailWindowsLocked = FALSE;
1651 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.