21#include <freerdp/config.h>
29#include <winpr/assert.h>
30#include <winpr/path.h>
32#include <freerdp/log.h>
33#include <freerdp/locale/keyboard.h>
37#include "xf_cliprdr.h"
41#include "xf_graphics.h"
47#define TAG CLIENT_TAG("x11")
49#define CLAMP_COORDINATES(x, y) \
58const char* x11_event_string(
int event)
72 return "ButtonRelease";
75 return "MotionNotify";
90 return "KeymapNotify";
96 return "GraphicsExpose";
101 case VisibilityNotify:
102 return "VisibilityNotify";
105 return "CreateNotify";
108 return "DestroyNotify";
111 return "UnmapNotify";
120 return "ReparentNotify";
122 case ConfigureNotify:
123 return "ConfigureNotify";
125 case ConfigureRequest:
126 return "ConfigureRequest";
129 return "GravityNotify";
132 return "ResizeRequest";
134 case CirculateNotify:
135 return "CirculateNotify";
137 case CirculateRequest:
138 return "CirculateRequest";
141 return "PropertyNotify";
144 return "SelectionClear";
146 case SelectionRequest:
147 return "SelectionRequest";
149 case SelectionNotify:
150 return "SelectionNotify";
153 return "ColormapNotify";
156 return "ClientMessage";
159 return "MappingNotify";
162 return "GenericEvent";
169static BOOL xf_action_script_append(xfContext* xfc,
const char* buffer,
size_t size,
170 WINPR_ATTR_UNUSED
void* user,
const char* what,
const char* arg)
176 if (buffer || (size == 0))
179 if (!ArrayList_Append(xfc->xevents, buffer))
181 ArrayList_Clear(xfc->xevents);
187BOOL xf_event_action_script_init(xfContext* xfc)
191 xf_event_action_script_free(xfc);
193 char* val = getConfigOption(TRUE,
"isActionScriptAllowed");
196 xfc->isActionScriptAllowed = !val || (_stricmp(val,
"true") == 0);
199 if (!xfc->isActionScriptAllowed)
202 xfc->xevents = ArrayList_New(TRUE);
207 wObject* obj = ArrayList_Object(xfc->xevents);
209 obj->fnObjectNew = winpr_ObjectStringClone;
210 obj->fnObjectFree = winpr_ObjectStringFree;
212 return run_action_script(xfc,
"xevent", NULL, xf_action_script_append, NULL);
215void xf_event_action_script_free(xfContext* xfc)
219 ArrayList_Free(xfc->xevents);
224static BOOL action_script_run(xfContext* xfc,
const char* buffer,
size_t size,
void* user,
225 const char* what,
const char* arg)
228 if (!xfc->isActionScriptAllowed)
238 WLog_WARN(TAG,
"ActionScript xevent: script did not return data");
242 if (winpr_PathFileExists(buffer))
246 winpr_asprintf(&cmd, &cmdlen,
"%s %s %s", buffer, what, arg);
250 FILE* fp = popen(cmd,
"w");
254 WLog_ERR(TAG,
"Failed to execute '%s'", buffer);
258 *pstatus = pclose(fp);
261 WLog_ERR(TAG,
"Command '%s' returned %d", buffer, *pstatus);
267 WLog_WARN(TAG,
"ActionScript xevent: No such file '%s'", buffer);
274static BOOL xf_event_execute_action_script(xfContext* xfc,
const XEvent* event)
279 const char* xeventName = NULL;
281 if (!xfc->actionScriptExists || !xfc->xevents || !xfc->window)
284 if (event->type > LASTEvent)
287 xeventName = x11_event_string(event->type);
288 count = ArrayList_Count(xfc->xevents);
290 for (
size_t index = 0; index < count; index++)
292 name = (
char*)ArrayList_GetItem(xfc->xevents, index);
294 if (_stricmp(name, xeventName) == 0)
304 char command[2048] = { 0 };
305 char arg[2048] = { 0 };
306 (void)_snprintf(command,
sizeof(command),
"xevent %s", xeventName);
307 (void)_snprintf(arg,
sizeof(arg),
"%lu", (
unsigned long)xfc->window->handle);
308 return run_action_script(xfc, command, arg, action_script_run, NULL);
311void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y)
313 if (!xfc || !xfc->common.context.settings || !y || !x)
316 rdpSettings* settings = xfc->common.context.settings;
319 if (!xfc->remote_app)
323 if (xf_picture_transform_required(xfc))
327 double xScalingFactor = xfc->scaledWidth / dw;
328 double yScalingFactor = xfc->scaledHeight / dh;
329 tx = (INT64)lround((1.0 * (*x) + xfc->offset_x) * xScalingFactor);
330 ty = (INT64)lround((1.0 * (*y) + xfc->offset_y) * yScalingFactor);
336 CLAMP_COORDINATES(tx, ty);
341void xf_event_adjust_coordinates(xfContext* xfc,
int* x,
int* y)
343 if (!xfc || !xfc->common.context.settings || !y || !x)
346 if (!xfc->remote_app)
349 rdpSettings* settings = xfc->common.context.settings;
350 if (xf_picture_transform_required(xfc))
353 (double)xfc->scaledWidth;
355 (double)xfc->scaledHeight;
356 *x = (int)((*x - xfc->offset_x) * xScalingFactor);
357 *y = (int)((*y - xfc->offset_y) * yScalingFactor);
363 CLAMP_COORDINATES(*x, *y);
366static BOOL xf_event_Expose(xfContext* xfc,
const XExposeEvent* event, BOOL app)
372 rdpSettings* settings = NULL;
377 settings = xfc->common.context.settings;
378 WINPR_ASSERT(settings);
385 w = WINPR_ASSERTING_INT_CAST(
int,
387 h = WINPR_ASSERTING_INT_CAST(
int,
400 if (xfc->common.context.gdi->gfx)
403 xfc, WINPR_ASSERTING_INT_CAST(uint32_t, x), WINPR_ASSERTING_INT_CAST(uint32_t, y),
404 WINPR_ASSERTING_INT_CAST(uint32_t, w), WINPR_ASSERTING_INT_CAST(uint32_t, h));
407 xf_draw_screen(xfc, x, y, w, h);
411 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
414 xf_UpdateWindowArea(xfc, appWindow, x, y, w, h);
421static BOOL xf_event_VisibilityNotify(xfContext* xfc,
const XVisibilityEvent* event, BOOL app)
424 xfc->unobscured =
event->state == VisibilityUnobscured;
428BOOL xf_generic_MotionNotify(xfContext* xfc,
int x,
int y, Window window, BOOL app)
430 Window childWindow = None;
433 WINPR_ASSERT(xfc->common.context.settings);
438 if (!xf_AppWindowFromX11Window(xfc, window))
442 XTranslateCoordinates(xfc->display, window, RootWindowOfScreen(xfc->screen), x, y, &x, &y,
446 xf_event_adjust_coordinates(xfc, &x, &y);
447 freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
449 if (xfc->fullscreen && !app)
452 XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
458BOOL xf_generic_RawMotionNotify(xfContext* xfc,
int x,
int y, WINPR_ATTR_UNUSED Window window,
465 WLog_ERR(TAG,
"Relative mouse input is not supported with remoate app mode!");
469 return freerdp_client_send_button_event(&xfc->common, TRUE, PTR_FLAGS_MOVE, x, y);
472static BOOL xf_event_MotionNotify(xfContext* xfc,
const XMotionEvent* event, BOOL app)
477 xf_floatbar_set_root_y(xfc->window->floatbar, event->y);
480 (xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common)))
483 return xf_generic_MotionNotify(xfc, event->x, event->y, event->window, app);
486BOOL xf_generic_ButtonEvent(xfContext* xfc,
int x,
int y,
int button, Window window, BOOL app,
490 Window childWindow = None;
496 for (
size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
500 if (cur->button == (UINT32)button)
509 if (flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL))
512 freerdp_client_send_wheel_event(&xfc->common, flags);
516 BOOL extended = FALSE;
518 if (flags & (PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_BUTTON2))
523 flags |= PTR_XFLAGS_DOWN;
525 else if (flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3))
528 flags |= PTR_FLAGS_DOWN;
534 if (!xf_AppWindowFromX11Window(xfc, window))
538 XTranslateCoordinates(xfc->display, window, RootWindowOfScreen(xfc->screen), x, y,
539 &x, &y, &childWindow);
542 xf_event_adjust_coordinates(xfc, &x, &y);
545 freerdp_client_send_extended_button_event(&xfc->common, FALSE, flags, x, y);
547 freerdp_client_send_button_event(&xfc->common, FALSE, flags, x, y);
554static BOOL xf_grab_mouse(xfContext* xfc)
563 XGrabPointer(xfc->display, xfc->window->handle, False,
564 ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask |
565 EnterWindowMask | LeaveWindowMask,
566 GrabModeAsync, GrabModeAsync, xfc->window->handle, None, CurrentTime);
567 xfc->common.mouse_grabbed = TRUE;
572static BOOL xf_grab_kbd(xfContext* xfc)
579 XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync,
584static BOOL xf_event_ButtonPress(xfContext* xfc,
const XButtonEvent* event, BOOL app)
589 (xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common)))
591 if (!app && xfc_is_floatbar_window(xfc, event->window))
593 return xf_generic_ButtonEvent(xfc, event->x, event->y,
594 WINPR_ASSERTING_INT_CAST(
int, event->button), event->window, app,
598static BOOL xf_event_ButtonRelease(xfContext* xfc,
const XButtonEvent* event, BOOL app)
603 (xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common)))
605 return xf_generic_ButtonEvent(xfc, event->x, event->y,
606 WINPR_ASSERTING_INT_CAST(
int, event->button), event->window, app,
610static BOOL xf_event_KeyPress(xfContext* xfc,
const XKeyEvent* event, BOOL app)
613 char str[256] = { 0 };
616 const XKeyEvent* cev;
621 XLookupString(cnv.ev, str,
sizeof(str), &keysym, NULL);
622 xf_keyboard_key_press(xfc, event, keysym);
626static BOOL xf_event_KeyRelease(xfContext* xfc,
const XKeyEvent* event, BOOL app)
629 char str[256] = { 0 };
632 const XKeyEvent* cev;
638 XLookupString(cnv.ev, str,
sizeof(str), &keysym, NULL);
639 xf_keyboard_key_release(xfc, event, keysym);
645static BOOL xf_event_KeyReleaseOrIgnore(xfContext* xfc,
const XKeyEvent* event, BOOL app)
650 if ((event->type == KeyRelease) && XEventsQueued(xfc->display, QueuedAfterReading))
653 XPeekEvent(xfc->display, &nev);
655 if ((nev.type == KeyPress) && (nev.xkey.time == event->time) &&
656 (nev.xkey.keycode == event->keycode))
663 return xf_event_KeyRelease(xfc, event, app);
666static BOOL xf_event_FocusIn(xfContext* xfc,
const XFocusInEvent* event, BOOL app)
668 if (event->mode == NotifyGrab)
673 if (xfc->mouse_active && !app)
676 if (!xf_grab_kbd(xfc))
683 xf_keyboard_release_all_keypress(xfc);
685 xf_rail_send_activate(xfc, event->window, TRUE);
687 xf_pointer_update_scale(xfc);
691 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
696 xf_rail_adjust_position(xfc, appWindow);
699 xf_keyboard_focus_in(xfc);
703static BOOL xf_event_FocusOut(xfContext* xfc,
const XFocusOutEvent* event, BOOL app)
705 if (event->mode == NotifyUngrab)
708 xfc->focused = FALSE;
710 if (event->mode == NotifyWhileGrabbed)
711 XUngrabKeyboard(xfc->display, CurrentTime);
713 xf_keyboard_release_all_keypress(xfc);
715 xf_rail_send_activate(xfc, event->window, FALSE);
720static BOOL xf_event_MappingNotify(xfContext* xfc,
const XMappingEvent* event, BOOL app)
724 switch (event->request)
726 case MappingModifier:
727 return xf_keyboard_update_modifier_map(xfc);
728 case MappingKeyboard:
729 WLog_VRB(TAG,
"[%d] MappingKeyboard", event->request);
730 return xf_keyboard_init(xfc);
732 WLog_VRB(TAG,
"[%d] MappingPointer", event->request);
733 xf_button_map_init(xfc);
737 "[%d] Unsupported MappingNotify::request, must be one "
738 "of[MappingModifier(%d), MappingKeyboard(%d), MappingPointer(%d)]",
739 event->request, MappingModifier, MappingKeyboard, MappingPointer);
744static BOOL xf_event_ClientMessage(xfContext* xfc,
const XClientMessageEvent* event, BOOL app)
746 if ((event->message_type == xfc->WM_PROTOCOLS) &&
747 ((Atom)event->data.l[0] == xfc->WM_DELETE_WINDOW))
751 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
754 return xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_CLOSE);
760 DEBUG_X11(
"Main window closed");
768static BOOL xf_event_EnterNotify(xfContext* xfc,
const XEnterWindowEvent* event, BOOL app)
775 xfc->mouse_active = TRUE;
778 XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
785 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
788 xfc->appWindow = appWindow;
794static BOOL xf_event_LeaveNotify(xfContext* xfc,
const XLeaveWindowEvent* event, BOOL app)
796 if (event->mode == NotifyGrab || event->mode == NotifyUngrab)
800 xfc->mouse_active = FALSE;
801 XUngrabKeyboard(xfc->display, CurrentTime);
805 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
808 if (xfc->appWindow == appWindow)
809 xfc->appWindow = NULL;
814static BOOL xf_event_ConfigureNotify(xfContext* xfc,
const XConfigureEvent* event, BOOL app)
816 Window childWindow = None;
817 xfAppWindow* appWindow = NULL;
822 const rdpSettings* settings = xfc->common.context.settings;
823 WINPR_ASSERT(settings);
825 WLog_DBG(TAG,
"x=%" PRId32
", y=%" PRId32
", w=%" PRId32
", h=%" PRId32, event->x, event->y,
826 event->width, event->height);
833 if (xfc->window->left != event->x)
834 xfc->window->left =
event->x;
836 if (xfc->window->top != event->y)
837 xfc->window->top =
event->y;
839 if (xfc->window->width != event->width || xfc->window->height != event->height)
841 xfc->window->width =
event->width;
842 xfc->window->height =
event->height;
850 xfc->scaledWidth = xfc->window->width;
851 xfc->scaledHeight = xfc->window->height;
854 WINPR_ASSERTING_INT_CAST(
856 WINPR_ASSERTING_INT_CAST(
861 xfc->scaledWidth = WINPR_ASSERTING_INT_CAST(
863 xfc->scaledHeight = WINPR_ASSERTING_INT_CAST(
872 int alignedWidth = 0;
873 int alignedHeight = 0;
874 alignedWidth = (xfc->window->width / 2) * 2;
875 alignedHeight = (xfc->window->height / 2) * 2;
877 xf_disp_handle_configureNotify(xfc, alignedWidth, alignedHeight);
882 appWindow = xf_AppWindowFromX11Window(xfc, event->window);
890 XTranslateCoordinates(xfc->display, appWindow->handle, RootWindowOfScreen(xfc->screen),
891 0, 0, &appWindow->x, &appWindow->y, &childWindow);
892 appWindow->width =
event->width;
893 appWindow->height =
event->height;
895 xf_AppWindowResize(xfc, appWindow);
903 if (appWindow->decorations)
906 xf_rail_adjust_position(xfc, appWindow);
910 if ((!event->send_event || appWindow->local_move.state == LMS_NOT_ACTIVE) &&
911 !appWindow->rail_ignore_configure && xfc->focused)
912 xf_rail_adjust_position(xfc, appWindow);
916 return xf_pointer_update_scale(xfc);
919static BOOL xf_event_MapNotify(xfContext* xfc,
const XMapEvent* event, BOOL app)
923 gdi_send_suppress_output(xfc->common.context.gdi, FALSE);
926 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
936 appWindow->is_mapped = TRUE;
943static BOOL xf_event_UnmapNotify(xfContext* xfc,
const XUnmapEvent* event, BOOL app)
949 xf_keyboard_release_all_keypress(xfc);
952 gdi_send_suppress_output(xfc->common.context.gdi, TRUE);
955 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
958 appWindow->is_mapped = FALSE;
964static BOOL xf_event_PropertyNotify(xfContext* xfc,
const XPropertyEvent* event, BOOL app)
974 if (((event->atom == xfc->NET_WM_STATE) && (event->state != PropertyDelete)) ||
975 ((event->atom == xfc->WM_STATE) && (event->state != PropertyDelete)))
978 BOOL minimized = FALSE;
979 BOOL minimizedChanged = FALSE;
980 unsigned long nitems = 0;
981 unsigned long bytes = 0;
982 unsigned char* prop = NULL;
983 xfAppWindow* appWindow = NULL;
987 appWindow = xf_AppWindowFromX11Window(xfc, event->window);
993 if (event->atom == xfc->NET_WM_STATE)
995 status = xf_GetWindowProperty(xfc, event->window, xfc->NET_WM_STATE, 12, &nitems,
1002 appWindow->maxVert = FALSE;
1003 appWindow->maxHorz = FALSE;
1005 for (
unsigned long i = 0; i < nitems; i++)
1007 if ((Atom)((UINT16**)prop)[i] ==
1008 Logging_XInternAtom(xfc->log, xfc->display,
"_NET_WM_STATE_MAXIMIZED_VERT",
1012 appWindow->maxVert = TRUE;
1015 if ((Atom)((UINT16**)prop)[i] ==
1016 Logging_XInternAtom(xfc->log, xfc->display,
"_NET_WM_STATE_MAXIMIZED_HORZ",
1020 appWindow->maxHorz = TRUE;
1028 if (event->atom == xfc->WM_STATE)
1031 xf_GetWindowProperty(xfc, event->window, xfc->WM_STATE, 1, &nitems, &bytes, &prop);
1036 if (((UINT32)*prop == 3) && !IsGnome())
1040 appWindow->minimized = TRUE;
1046 appWindow->minimized = FALSE;
1049 minimizedChanged = TRUE;
1056 WINPR_ASSERT(appWindow);
1057 if (appWindow->maxVert && appWindow->maxHorz && !appWindow->minimized)
1059 if (appWindow->rail_state != WINDOW_SHOW_MAXIMIZED)
1061 appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
1062 return xf_rail_send_client_system_command(xfc, appWindow->windowId,
1066 else if (appWindow->minimized)
1068 if (appWindow->rail_state != WINDOW_SHOW_MINIMIZED)
1070 appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
1071 return xf_rail_send_client_system_command(xfc, appWindow->windowId,
1077 if (appWindow->rail_state != WINDOW_SHOW && appWindow->rail_state != WINDOW_HIDE)
1079 appWindow->rail_state = WINDOW_SHOW;
1080 return xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
1084 else if (minimizedChanged)
1085 gdi_send_suppress_output(xfc->common.context.gdi, minimized);
1091static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow,
const XEvent* event)
1093 if (!xfc->remote_app)
1096 switch (appWindow->local_move.state)
1098 case LMS_NOT_ACTIVE:
1104 if ((event->type == ConfigureNotify) && appWindow->rail_ignore_configure)
1106 appWindow->rail_ignore_configure = FALSE;
1116 switch (event->type)
1118 case ConfigureNotify:
1121 appWindow->local_move.state = LMS_ACTIVE;
1138 case VisibilityNotify:
1139 case PropertyNotify:
1154 switch (event->type)
1156 case ConfigureNotify:
1157 case VisibilityNotify:
1158 case PropertyNotify:
1166 xf_rail_end_local_move(xfc, appWindow);
1172 case LMS_TERMINATING:
1182BOOL xf_event_process(freerdp* instance,
const XEvent* event)
1186 WINPR_ASSERT(instance);
1187 WINPR_ASSERT(event);
1189 xfContext* xfc = (xfContext*)instance->context;
1192 rdpSettings* settings = xfc->common.context.settings;
1193 WINPR_ASSERT(settings);
1195 if (xfc->remote_app)
1197 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
1202 xfc->appWindow = appWindow;
1204 if (xf_event_suppress_events(xfc, appWindow, event))
1211 xfFloatbar* floatbar = xfc->window->floatbar;
1212 if (xf_floatbar_check_event(floatbar, event))
1214 xf_floatbar_event_process(floatbar, event);
1218 if (xf_floatbar_is_locked(floatbar))
1221 switch (event->type)
1239 xf_event_execute_action_script(xfc, event);
1241 if (event->type != MotionNotify)
1243 DEBUG_X11(
"%s Event(%d): wnd=0x%08lX", x11_event_string(event->type), event->type,
1244 (
unsigned long)event->xany.window);
1247 switch (event->type)
1250 status = xf_event_Expose(xfc, &event->xexpose, xfc->remote_app);
1253 case VisibilityNotify:
1254 status = xf_event_VisibilityNotify(xfc, &event->xvisibility, xfc->remote_app);
1258 status = xf_event_MotionNotify(xfc, &event->xmotion, xfc->remote_app);
1262 status = xf_event_ButtonPress(xfc, &event->xbutton, xfc->remote_app);
1266 status = xf_event_ButtonRelease(xfc, &event->xbutton, xfc->remote_app);
1270 status = xf_event_KeyPress(xfc, &event->xkey, xfc->remote_app);
1274 status = xf_event_KeyReleaseOrIgnore(xfc, &event->xkey, xfc->remote_app);
1278 status = xf_event_FocusIn(xfc, &event->xfocus, xfc->remote_app);
1282 status = xf_event_FocusOut(xfc, &event->xfocus, xfc->remote_app);
1286 status = xf_event_EnterNotify(xfc, &event->xcrossing, xfc->remote_app);
1290 status = xf_event_LeaveNotify(xfc, &event->xcrossing, xfc->remote_app);
1296 case GraphicsExpose:
1299 case ConfigureNotify:
1300 status = xf_event_ConfigureNotify(xfc, &event->xconfigure, xfc->remote_app);
1304 status = xf_event_MapNotify(xfc, &event->xmap, xfc->remote_app);
1308 status = xf_event_UnmapNotify(xfc, &event->xunmap, xfc->remote_app);
1311 case ReparentNotify:
1315 status = xf_event_MappingNotify(xfc, &event->xmapping, xfc->remote_app);
1319 status = xf_event_ClientMessage(xfc, &event->xclient, xfc->remote_app);
1322 case PropertyNotify:
1323 status = xf_event_PropertyNotify(xfc, &event->xproperty, xfc->remote_app);
1328 xf_disp_handle_xevent(xfc, event);
1333 xfWindow* window = xfc->window;
1334 xfFloatbar* floatbar = NULL;
1336 floatbar = window->floatbar;
1338 xf_cliprdr_handle_xevent(xfc, event);
1339 if (!xf_floatbar_check_event(floatbar, event) && !xf_floatbar_is_locked(floatbar))
1340 xf_input_handle_event(xfc, event);
1342 LogDynAndXSync(xfc->log, xfc->display, FALSE);
1346BOOL xf_generic_RawButtonEvent(xfContext* xfc,
int button, BOOL app, BOOL down)
1350 if (app || (button < 0))
1353 for (
size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
1357 if (cur->button == (UINT32)button)
1366 if (flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL))
1369 freerdp_client_send_wheel_event(&xfc->common, flags);
1373 BOOL extended = FALSE;
1375 if (flags & (PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_BUTTON2))
1380 flags |= PTR_XFLAGS_DOWN;
1382 else if (flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3))
1385 flags |= PTR_FLAGS_DOWN;
1389 freerdp_client_send_extended_button_event(&xfc->common, TRUE, flags, 0, 0);
1391 freerdp_client_send_button_event(&xfc->common, TRUE, flags, 0, 0);
FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
This struct contains function pointer to initialize/free objects.