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 CLAMP_COORDINATES(x, y) \
56static const DWORD mouseLogLevel = WLOG_TRACE;
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_Print(xfc->log, WLOG_WARN,
"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_Print(xfc->log, WLOG_ERROR,
"Failed to execute '%s'", buffer);
258 *pstatus = pclose(fp);
261 WLog_Print(xfc->log, WLOG_ERROR,
"Command '%s' returned %d", buffer, *pstatus);
267 WLog_Print(xfc->log, WLOG_WARN,
"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,
429 const char* file,
const char* fkt,
size_t line)
431 Window childWindow = None;
433 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
434 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
435 "%s: x=%d, y=%d, window=0x%08lx, app=%d", __func__, x, y, window,
439 WINPR_ASSERT(xfc->common.context.settings);
444 if (!xf_AppWindowFromX11Window(xfc, window))
448 XTranslateCoordinates(xfc->display, window, RootWindowOfScreen(xfc->screen), x, y, &x, &y,
452 xf_event_adjust_coordinates(xfc, &x, &y);
453 freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
455 if (xfc->fullscreen && !app)
458 XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
464BOOL xf_generic_RawMotionNotify_(xfContext* xfc,
int x,
int y, WINPR_ATTR_UNUSED Window window,
465 BOOL app,
const char* file,
const char* fkt,
size_t line)
469 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
470 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
471 "%s: x=%d, y=%d, window=0x%08lx, app=%d", __func__, x, y, window,
476 WLog_Print(xfc->log, WLOG_ERROR,
477 "Relative mouse input is not supported with remoate app mode!");
481 return freerdp_client_send_button_event(&xfc->common, TRUE, PTR_FLAGS_MOVE, x, y);
484static BOOL xf_event_MotionNotify(xfContext* xfc,
const XMotionEvent* event, BOOL app)
489 xf_floatbar_set_root_y(xfc->window->floatbar, event->y);
491 if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
494 return xf_generic_MotionNotify(xfc, event->x, event->y, event->window, app);
497BOOL xf_generic_ButtonEvent_(xfContext* xfc,
int x,
int y,
int button, Window window, BOOL app,
498 BOOL down,
const char* file,
const char* fkt,
size_t line)
501 Window childWindow = None;
503 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
504 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
505 "%s: x=%d, y=%d, button=%d, window=0x%08lx, app=%d, down=%d",
506 __func__, x, y, button, window, app, down);
512 for (
size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
516 if (cur->button == (UINT32)button)
525 if (flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL))
528 freerdp_client_send_wheel_event(&xfc->common, flags);
532 BOOL extended = FALSE;
534 if (flags & (PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_BUTTON2))
539 flags |= PTR_XFLAGS_DOWN;
541 else if (flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3))
544 flags |= PTR_FLAGS_DOWN;
550 if (!xf_AppWindowFromX11Window(xfc, window))
554 XTranslateCoordinates(xfc->display, window, RootWindowOfScreen(xfc->screen), x, y,
555 &x, &y, &childWindow);
558 xf_event_adjust_coordinates(xfc, &x, &y);
561 freerdp_client_send_extended_button_event(&xfc->common, FALSE, flags, x, y);
563 freerdp_client_send_button_event(&xfc->common, FALSE, flags, x, y);
570static BOOL xf_grab_mouse(xfContext* xfc)
579 XGrabPointer(xfc->display, xfc->window->handle, False,
580 ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask |
581 EnterWindowMask | LeaveWindowMask,
582 GrabModeAsync, GrabModeAsync, xfc->window->handle, None, CurrentTime);
583 xfc->common.mouse_grabbed = TRUE;
588static BOOL xf_grab_kbd(xfContext* xfc)
595 XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync,
600static BOOL xf_event_ButtonPress(xfContext* xfc,
const XButtonEvent* event, BOOL app)
604 if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
606 if (!app && xfc_is_floatbar_window(xfc, event->window))
608 return xf_generic_ButtonEvent(xfc, event->x, event->y,
609 WINPR_ASSERTING_INT_CAST(
int, event->button), event->window, app,
613static BOOL xf_event_ButtonRelease(xfContext* xfc,
const XButtonEvent* event, BOOL app)
617 if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
619 return xf_generic_ButtonEvent(xfc, event->x, event->y,
620 WINPR_ASSERTING_INT_CAST(
int, event->button), event->window, app,
624static BOOL xf_event_KeyPress(xfContext* xfc,
const XKeyEvent* event, BOOL app)
627 char str[256] = { 0 };
630 const XKeyEvent* cev;
635 XLookupString(cnv.ev, str,
sizeof(str), &keysym, NULL);
636 xf_keyboard_key_press(xfc, event, keysym);
640static BOOL xf_event_KeyRelease(xfContext* xfc,
const XKeyEvent* event, BOOL app)
643 char str[256] = { 0 };
646 const XKeyEvent* cev;
652 XLookupString(cnv.ev, str,
sizeof(str), &keysym, NULL);
653 xf_keyboard_key_release(xfc, event, keysym);
659static BOOL xf_event_KeyReleaseOrIgnore(xfContext* xfc,
const XKeyEvent* event, BOOL app)
664 if ((event->type == KeyRelease) && XEventsQueued(xfc->display, QueuedAfterReading))
667 XPeekEvent(xfc->display, &nev);
669 if ((nev.type == KeyPress) && (nev.xkey.time == event->time) &&
670 (nev.xkey.keycode == event->keycode))
677 return xf_event_KeyRelease(xfc, event, app);
680static BOOL xf_event_FocusIn(xfContext* xfc,
const XFocusInEvent* event, BOOL app)
682 if (event->mode == NotifyGrab)
687 if (xfc->mouse_active && !app)
690 if (!xf_grab_kbd(xfc))
697 xf_keyboard_release_all_keypress(xfc);
699 xf_rail_send_activate(xfc, event->window, TRUE);
701 xf_pointer_update_scale(xfc);
705 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
710 xf_rail_adjust_position(xfc, appWindow);
713 xf_keyboard_focus_in(xfc);
717static BOOL xf_event_FocusOut(xfContext* xfc,
const XFocusOutEvent* event, BOOL app)
719 if (event->mode == NotifyUngrab)
722 xfc->focused = FALSE;
724 if (event->mode == NotifyWhileGrabbed)
725 XUngrabKeyboard(xfc->display, CurrentTime);
727 xf_keyboard_release_all_keypress(xfc);
729 xf_rail_send_activate(xfc, event->window, FALSE);
734static BOOL xf_event_MappingNotify(xfContext* xfc,
const XMappingEvent* event, BOOL app)
738 switch (event->request)
740 case MappingModifier:
741 return xf_keyboard_update_modifier_map(xfc);
742 case MappingKeyboard:
743 WLog_Print(xfc->log, WLOG_TRACE,
"[%d] MappingKeyboard", event->request);
744 return xf_keyboard_init(xfc);
746 WLog_Print(xfc->log, WLOG_TRACE,
"[%d] MappingPointer", event->request);
747 xf_button_map_init(xfc);
750 WLog_Print(xfc->log, WLOG_WARN,
751 "[%d] Unsupported MappingNotify::request, must be one "
752 "of[MappingModifier(%d), MappingKeyboard(%d), MappingPointer(%d)]",
753 event->request, MappingModifier, MappingKeyboard, MappingPointer);
758static BOOL xf_event_ClientMessage(xfContext* xfc,
const XClientMessageEvent* event, BOOL app)
760 if ((event->message_type == xfc->WM_PROTOCOLS) &&
761 ((Atom)event->data.l[0] == xfc->WM_DELETE_WINDOW))
765 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
768 return xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_CLOSE);
774 DEBUG_X11(
"Main window closed");
782static BOOL xf_event_EnterNotify(xfContext* xfc,
const XEnterWindowEvent* event, BOOL app)
789 xfc->mouse_active = TRUE;
792 XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
799 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
802 xfc->appWindow = appWindow;
808static BOOL xf_event_LeaveNotify(xfContext* xfc,
const XLeaveWindowEvent* event, BOOL app)
810 if (event->mode == NotifyGrab || event->mode == NotifyUngrab)
814 xfc->mouse_active = FALSE;
815 XUngrabKeyboard(xfc->display, CurrentTime);
819 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
822 if (xfc->appWindow == appWindow)
823 xfc->appWindow = NULL;
828static BOOL xf_event_ConfigureNotify(xfContext* xfc,
const XConfigureEvent* event, BOOL app)
830 Window childWindow = None;
831 xfAppWindow* appWindow = NULL;
836 const rdpSettings* settings = xfc->common.context.settings;
837 WINPR_ASSERT(settings);
839 WLog_Print(xfc->log, WLOG_DEBUG,
"x=%" PRId32
", y=%" PRId32
", w=%" PRId32
", h=%" PRId32,
840 event->x, event->y, event->width, event->height);
847 if (xfc->window->left != event->x)
848 xfc->window->left =
event->x;
850 if (xfc->window->top != event->y)
851 xfc->window->top =
event->y;
853 if (xfc->window->width != event->width || xfc->window->height != event->height)
855 xfc->window->width =
event->width;
856 xfc->window->height =
event->height;
864 xfc->scaledWidth = xfc->window->width;
865 xfc->scaledHeight = xfc->window->height;
868 WINPR_ASSERTING_INT_CAST(
870 WINPR_ASSERTING_INT_CAST(
875 xfc->scaledWidth = WINPR_ASSERTING_INT_CAST(
877 xfc->scaledHeight = WINPR_ASSERTING_INT_CAST(
886 int alignedWidth = 0;
887 int alignedHeight = 0;
888 alignedWidth = (xfc->window->width / 2) * 2;
889 alignedHeight = (xfc->window->height / 2) * 2;
891 xf_disp_handle_configureNotify(xfc, alignedWidth, alignedHeight);
896 appWindow = xf_AppWindowFromX11Window(xfc, event->window);
904 XTranslateCoordinates(xfc->display, appWindow->handle, RootWindowOfScreen(xfc->screen),
905 0, 0, &appWindow->x, &appWindow->y, &childWindow);
906 appWindow->width =
event->width;
907 appWindow->height =
event->height;
909 xf_AppWindowResize(xfc, appWindow);
917 if (appWindow->decorations)
920 xf_rail_adjust_position(xfc, appWindow);
924 if ((!event->send_event || appWindow->local_move.state == LMS_NOT_ACTIVE) &&
925 !appWindow->rail_ignore_configure && xfc->focused)
926 xf_rail_adjust_position(xfc, appWindow);
930 return xf_pointer_update_scale(xfc);
933static BOOL xf_event_MapNotify(xfContext* xfc,
const XMapEvent* event, BOOL app)
937 gdi_send_suppress_output(xfc->common.context.gdi, FALSE);
940 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
950 appWindow->is_mapped = TRUE;
957static BOOL xf_event_UnmapNotify(xfContext* xfc,
const XUnmapEvent* event, BOOL app)
963 xf_keyboard_release_all_keypress(xfc);
966 gdi_send_suppress_output(xfc->common.context.gdi, TRUE);
969 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
972 appWindow->is_mapped = FALSE;
978static BOOL xf_event_PropertyNotify(xfContext* xfc,
const XPropertyEvent* event, BOOL app)
988 if (((event->atom == xfc->NET_WM_STATE) && (event->state != PropertyDelete)) ||
989 ((event->atom == xfc->WM_STATE) && (event->state != PropertyDelete)))
992 BOOL minimized = FALSE;
993 BOOL minimizedChanged = FALSE;
994 unsigned long nitems = 0;
995 unsigned long bytes = 0;
996 unsigned char* prop = NULL;
997 xfAppWindow* appWindow = NULL;
1001 appWindow = xf_AppWindowFromX11Window(xfc, event->window);
1007 if (event->atom == xfc->NET_WM_STATE)
1009 status = xf_GetWindowProperty(xfc, event->window, xfc->NET_WM_STATE, 12, &nitems,
1016 appWindow->maxVert = FALSE;
1017 appWindow->maxHorz = FALSE;
1019 for (
unsigned long i = 0; i < nitems; i++)
1021 if ((Atom)((UINT16**)prop)[i] ==
1022 Logging_XInternAtom(xfc->log, xfc->display,
"_NET_WM_STATE_MAXIMIZED_VERT",
1026 appWindow->maxVert = TRUE;
1029 if ((Atom)((UINT16**)prop)[i] ==
1030 Logging_XInternAtom(xfc->log, xfc->display,
"_NET_WM_STATE_MAXIMIZED_HORZ",
1034 appWindow->maxHorz = TRUE;
1042 if (event->atom == xfc->WM_STATE)
1045 xf_GetWindowProperty(xfc, event->window, xfc->WM_STATE, 1, &nitems, &bytes, &prop);
1050 if (((UINT32)*prop == 3) && !IsGnome())
1054 appWindow->minimized = TRUE;
1060 appWindow->minimized = FALSE;
1063 minimizedChanged = TRUE;
1070 WINPR_ASSERT(appWindow);
1071 if (appWindow->maxVert && appWindow->maxHorz && !appWindow->minimized)
1073 if (appWindow->rail_state != WINDOW_SHOW_MAXIMIZED)
1075 appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
1076 return xf_rail_send_client_system_command(xfc, appWindow->windowId,
1080 else if (appWindow->minimized)
1082 if (appWindow->rail_state != WINDOW_SHOW_MINIMIZED)
1084 appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
1085 return xf_rail_send_client_system_command(xfc, appWindow->windowId,
1091 if (appWindow->rail_state != WINDOW_SHOW && appWindow->rail_state != WINDOW_HIDE)
1093 appWindow->rail_state = WINDOW_SHOW;
1094 return xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
1098 else if (minimizedChanged)
1099 gdi_send_suppress_output(xfc->common.context.gdi, minimized);
1105static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow,
const XEvent* event)
1107 if (!xfc->remote_app)
1110 switch (appWindow->local_move.state)
1112 case LMS_NOT_ACTIVE:
1118 if ((event->type == ConfigureNotify) && appWindow->rail_ignore_configure)
1120 appWindow->rail_ignore_configure = FALSE;
1130 switch (event->type)
1132 case ConfigureNotify:
1135 appWindow->local_move.state = LMS_ACTIVE;
1152 case VisibilityNotify:
1153 case PropertyNotify:
1168 switch (event->type)
1170 case ConfigureNotify:
1171 case VisibilityNotify:
1172 case PropertyNotify:
1180 xf_rail_end_local_move(xfc, appWindow);
1186 case LMS_TERMINATING:
1196BOOL xf_event_process(freerdp* instance,
const XEvent* event)
1200 WINPR_ASSERT(instance);
1201 WINPR_ASSERT(event);
1203 xfContext* xfc = (xfContext*)instance->context;
1206 rdpSettings* settings = xfc->common.context.settings;
1207 WINPR_ASSERT(settings);
1209 if (xfc->remote_app)
1211 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
1216 xfc->appWindow = appWindow;
1218 if (xf_event_suppress_events(xfc, appWindow, event))
1225 xfFloatbar* floatbar = xfc->window->floatbar;
1226 if (xf_floatbar_check_event(floatbar, event))
1228 xf_floatbar_event_process(floatbar, event);
1232 if (xf_floatbar_is_locked(floatbar))
1235 switch (event->type)
1253 xf_event_execute_action_script(xfc, event);
1255 if (event->type != MotionNotify)
1257 DEBUG_X11(
"%s Event(%d): wnd=0x%08lX", x11_event_string(event->type), event->type,
1258 (
unsigned long)event->xany.window);
1261 switch (event->type)
1264 status = xf_event_Expose(xfc, &event->xexpose, xfc->remote_app);
1267 case VisibilityNotify:
1268 status = xf_event_VisibilityNotify(xfc, &event->xvisibility, xfc->remote_app);
1272 status = xf_event_MotionNotify(xfc, &event->xmotion, xfc->remote_app);
1276 status = xf_event_ButtonPress(xfc, &event->xbutton, xfc->remote_app);
1280 status = xf_event_ButtonRelease(xfc, &event->xbutton, xfc->remote_app);
1284 status = xf_event_KeyPress(xfc, &event->xkey, xfc->remote_app);
1288 status = xf_event_KeyReleaseOrIgnore(xfc, &event->xkey, xfc->remote_app);
1292 status = xf_event_FocusIn(xfc, &event->xfocus, xfc->remote_app);
1296 status = xf_event_FocusOut(xfc, &event->xfocus, xfc->remote_app);
1300 status = xf_event_EnterNotify(xfc, &event->xcrossing, xfc->remote_app);
1304 status = xf_event_LeaveNotify(xfc, &event->xcrossing, xfc->remote_app);
1310 case GraphicsExpose:
1313 case ConfigureNotify:
1314 status = xf_event_ConfigureNotify(xfc, &event->xconfigure, xfc->remote_app);
1318 status = xf_event_MapNotify(xfc, &event->xmap, xfc->remote_app);
1322 status = xf_event_UnmapNotify(xfc, &event->xunmap, xfc->remote_app);
1325 case ReparentNotify:
1329 status = xf_event_MappingNotify(xfc, &event->xmapping, xfc->remote_app);
1333 status = xf_event_ClientMessage(xfc, &event->xclient, xfc->remote_app);
1336 case PropertyNotify:
1337 status = xf_event_PropertyNotify(xfc, &event->xproperty, xfc->remote_app);
1342 xf_disp_handle_xevent(xfc, event);
1347 xfWindow* window = xfc->window;
1348 xfFloatbar* floatbar = NULL;
1350 floatbar = window->floatbar;
1352 xf_cliprdr_handle_xevent(xfc, event);
1353 if (!xf_floatbar_check_event(floatbar, event) && !xf_floatbar_is_locked(floatbar))
1354 xf_input_handle_event(xfc, event);
1356 LogDynAndXSync(xfc->log, xfc->display, FALSE);
1360BOOL xf_generic_RawButtonEvent_(xfContext* xfc,
int button, BOOL app, BOOL down,
const char* file,
1361 const char* fkt,
size_t line)
1365 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
1366 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
1367 "%s: button=%d, app=%d, down=%d", __func__, button, app, down);
1369 if (app || (button < 0))
1372 for (
size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
1376 if (cur->button == (UINT32)button)
1385 if (flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL))
1388 freerdp_client_send_wheel_event(&xfc->common, flags);
1392 BOOL extended = FALSE;
1394 if (flags & (PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_BUTTON2))
1399 flags |= PTR_XFLAGS_DOWN;
1401 else if (flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3))
1404 flags |= PTR_FLAGS_DOWN;
1408 freerdp_client_send_extended_button_event(&xfc->common, TRUE, flags, 0, 0);
1410 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.