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);
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 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, window);
445 xf_rail_return_window(appWindow);
450 XTranslateCoordinates(xfc->display, window, RootWindowOfScreen(xfc->screen), x, y, &x, &y,
454 xf_event_adjust_coordinates(xfc, &x, &y);
455 freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
457 if (xfc->fullscreen && !app)
460 XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
466BOOL xf_generic_RawMotionNotify_(xfContext* xfc,
int x,
int y, WINPR_ATTR_UNUSED Window window,
467 BOOL app,
const char* file,
const char* fkt,
size_t line)
471 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
472 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
473 "%s: x=%d, y=%d, window=0x%08lx, app=%d", __func__, x, y, window,
478 WLog_Print(xfc->log, WLOG_ERROR,
479 "Relative mouse input is not supported with remoate app mode!");
483 return freerdp_client_send_button_event(&xfc->common, TRUE, PTR_FLAGS_MOVE, x, y);
486static BOOL xf_event_MotionNotify(xfContext* xfc,
const XMotionEvent* event, BOOL app)
491 xf_floatbar_set_root_y(xfc->window->floatbar, event->y);
493 if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
496 return xf_generic_MotionNotify(xfc, event->x, event->y, event->window, app);
499BOOL xf_generic_ButtonEvent_(xfContext* xfc,
int x,
int y,
int button, Window window, BOOL app,
500 BOOL down,
const char* file,
const char* fkt,
size_t line)
503 Window childWindow = None;
505 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
506 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
507 "%s: x=%d, y=%d, button=%d, window=0x%08lx, app=%d, down=%d",
508 __func__, x, y, button, window, app, down);
514 for (
size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
518 if (cur->button == (UINT32)button)
527 if (flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL))
530 freerdp_client_send_wheel_event(&xfc->common, flags);
534 BOOL extended = FALSE;
536 if (flags & (PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_BUTTON2))
541 flags |= PTR_XFLAGS_DOWN;
543 else if (flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3))
546 flags |= PTR_FLAGS_DOWN;
552 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, window);
553 xf_rail_return_window(appWindow);
558 XTranslateCoordinates(xfc->display, window, RootWindowOfScreen(xfc->screen), x, y,
559 &x, &y, &childWindow);
562 xf_event_adjust_coordinates(xfc, &x, &y);
565 freerdp_client_send_extended_button_event(&xfc->common, FALSE, flags, x, y);
567 freerdp_client_send_button_event(&xfc->common, FALSE, flags, x, y);
574static BOOL xf_grab_mouse(xfContext* xfc)
583 XGrabPointer(xfc->display, xfc->window->handle, False,
584 ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask |
585 EnterWindowMask | LeaveWindowMask,
586 GrabModeAsync, GrabModeAsync, xfc->window->handle, None, CurrentTime);
587 xfc->common.mouse_grabbed = TRUE;
592static BOOL xf_grab_kbd(xfContext* xfc)
599 XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync,
604static BOOL xf_event_ButtonPress(xfContext* xfc,
const XButtonEvent* event, BOOL app)
608 if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
610 if (!app && xfc_is_floatbar_window(xfc, event->window))
612 return xf_generic_ButtonEvent(xfc, event->x, event->y,
613 WINPR_ASSERTING_INT_CAST(
int, event->button), event->window, app,
617static BOOL xf_event_ButtonRelease(xfContext* xfc,
const XButtonEvent* event, BOOL app)
621 if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
623 return xf_generic_ButtonEvent(xfc, event->x, event->y,
624 WINPR_ASSERTING_INT_CAST(
int, event->button), event->window, app,
628static BOOL xf_event_KeyPress(xfContext* xfc,
const XKeyEvent* event, BOOL app)
631 char str[256] = { 0 };
634 const XKeyEvent* cev;
639 XLookupString(cnv.ev, str,
sizeof(str), &keysym, NULL);
640 xf_keyboard_key_press(xfc, event, keysym);
644static BOOL xf_event_KeyRelease(xfContext* xfc,
const XKeyEvent* event, BOOL app)
647 char str[256] = { 0 };
650 const XKeyEvent* cev;
656 XLookupString(cnv.ev, str,
sizeof(str), &keysym, NULL);
657 xf_keyboard_key_release(xfc, event, keysym);
663static BOOL xf_event_KeyReleaseOrIgnore(xfContext* xfc,
const XKeyEvent* event, BOOL app)
668 if ((event->type == KeyRelease) && XEventsQueued(xfc->display, QueuedAfterReading))
671 XPeekEvent(xfc->display, &nev);
673 if ((nev.type == KeyPress) && (nev.xkey.time == event->time) &&
674 (nev.xkey.keycode == event->keycode))
681 return xf_event_KeyRelease(xfc, event, app);
684static BOOL xf_event_FocusIn(xfContext* xfc,
const XFocusInEvent* event, BOOL app)
686 if (event->mode == NotifyGrab)
691 if (xfc->mouse_active && !app)
694 if (!xf_grab_kbd(xfc))
701 xf_keyboard_release_all_keypress(xfc);
703 xf_rail_send_activate(xfc, event->window, TRUE);
705 xf_pointer_update_scale(xfc);
709 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
714 xf_rail_adjust_position(xfc, appWindow);
715 xf_rail_return_window(appWindow);
718 xf_keyboard_focus_in(xfc);
722static BOOL xf_event_FocusOut(xfContext* xfc,
const XFocusOutEvent* event, BOOL app)
724 if (event->mode == NotifyUngrab)
727 xfc->focused = FALSE;
729 if (event->mode == NotifyWhileGrabbed)
730 XUngrabKeyboard(xfc->display, CurrentTime);
732 xf_keyboard_release_all_keypress(xfc);
734 xf_rail_send_activate(xfc, event->window, FALSE);
739static BOOL xf_event_MappingNotify(xfContext* xfc,
const XMappingEvent* event, BOOL app)
743 switch (event->request)
745 case MappingModifier:
746 return xf_keyboard_update_modifier_map(xfc);
747 case MappingKeyboard:
748 WLog_Print(xfc->log, WLOG_TRACE,
"[%d] MappingKeyboard", event->request);
749 return xf_keyboard_init(xfc);
751 WLog_Print(xfc->log, WLOG_TRACE,
"[%d] MappingPointer", event->request);
752 xf_button_map_init(xfc);
755 WLog_Print(xfc->log, WLOG_WARN,
756 "[%d] Unsupported MappingNotify::request, must be one "
757 "of[MappingModifier(%d), MappingKeyboard(%d), MappingPointer(%d)]",
758 event->request, MappingModifier, MappingKeyboard, MappingPointer);
763static BOOL xf_event_ClientMessage(xfContext* xfc,
const XClientMessageEvent* event, BOOL app)
765 if ((event->message_type == xfc->WM_PROTOCOLS) &&
766 ((Atom)event->data.l[0] == xfc->WM_DELETE_WINDOW))
771 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
774 rc = xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_CLOSE);
775 xf_rail_return_window(appWindow);
780 DEBUG_X11(
"Main window closed");
788static BOOL xf_event_EnterNotify(xfContext* xfc,
const XEnterWindowEvent* event, BOOL app)
795 xfc->mouse_active = TRUE;
798 XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
805 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
808 xfc->appWindow = appWindow;
809 xf_rail_return_window(appWindow);
815static BOOL xf_event_LeaveNotify(xfContext* xfc,
const XLeaveWindowEvent* event, BOOL app)
817 if (event->mode == NotifyGrab || event->mode == NotifyUngrab)
821 xfc->mouse_active = FALSE;
822 XUngrabKeyboard(xfc->display, CurrentTime);
826 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
829 if (xfc->appWindow == appWindow)
830 xfc->appWindow = NULL;
831 xf_rail_return_window(appWindow);
836static BOOL xf_event_ConfigureNotify(xfContext* xfc,
const XConfigureEvent* event, BOOL app)
838 Window childWindow = None;
839 xfAppWindow* appWindow = NULL;
844 const rdpSettings* settings = xfc->common.context.settings;
845 WINPR_ASSERT(settings);
847 WLog_Print(xfc->log, WLOG_DEBUG,
"x=%" PRId32
", y=%" PRId32
", w=%" PRId32
", h=%" PRId32,
848 event->x, event->y, event->width, event->height);
855 if (xfc->window->left != event->x)
856 xfc->window->left =
event->x;
858 if (xfc->window->top != event->y)
859 xfc->window->top =
event->y;
861 if (xfc->window->width != event->width || xfc->window->height != event->height)
863 xfc->window->width =
event->width;
864 xfc->window->height =
event->height;
872 xfc->scaledWidth = xfc->window->width;
873 xfc->scaledHeight = xfc->window->height;
876 WINPR_ASSERTING_INT_CAST(
878 WINPR_ASSERTING_INT_CAST(
883 xfc->scaledWidth = WINPR_ASSERTING_INT_CAST(
885 xfc->scaledHeight = WINPR_ASSERTING_INT_CAST(
894 int alignedWidth = 0;
895 int alignedHeight = 0;
896 alignedWidth = (xfc->window->width / 2) * 2;
897 alignedHeight = (xfc->window->height / 2) * 2;
899 xf_disp_handle_configureNotify(xfc, alignedWidth, alignedHeight);
904 appWindow = xf_AppWindowFromX11Window(xfc, event->window);
912 XTranslateCoordinates(xfc->display, appWindow->handle, RootWindowOfScreen(xfc->screen),
913 0, 0, &appWindow->x, &appWindow->y, &childWindow);
914 appWindow->width =
event->width;
915 appWindow->height =
event->height;
917 xf_AppWindowResize(xfc, appWindow);
925 if (appWindow->decorations)
928 xf_rail_adjust_position(xfc, appWindow);
932 if ((!event->send_event || appWindow->local_move.state == LMS_NOT_ACTIVE) &&
933 !appWindow->rail_ignore_configure && xfc->focused)
934 xf_rail_adjust_position(xfc, appWindow);
937 xf_rail_return_window(appWindow);
939 return xf_pointer_update_scale(xfc);
942static BOOL xf_event_MapNotify(xfContext* xfc,
const XMapEvent* event, BOOL app)
946 gdi_send_suppress_output(xfc->common.context.gdi, FALSE);
949 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
959 appWindow->is_mapped = TRUE;
961 xf_rail_return_window(appWindow);
967static BOOL xf_event_UnmapNotify(xfContext* xfc,
const XUnmapEvent* event, BOOL app)
973 xf_keyboard_release_all_keypress(xfc);
976 return gdi_send_suppress_output(xfc->common.context.gdi, TRUE);
979 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
982 appWindow->is_mapped = FALSE;
983 xf_rail_return_window(appWindow);
989static BOOL xf_event_PropertyNotify(xfContext* xfc,
const XPropertyEvent* event, BOOL app)
1000 if (((event->atom == xfc->NET_WM_STATE) && (event->state != PropertyDelete)) ||
1001 ((event->atom == xfc->WM_STATE) && (event->state != PropertyDelete)))
1003 BOOL status = FALSE;
1004 BOOL minimized = FALSE;
1005 BOOL minimizedChanged = FALSE;
1006 unsigned long nitems = 0;
1007 unsigned long bytes = 0;
1008 unsigned char* prop = NULL;
1009 xfAppWindow* appWindow = NULL;
1013 appWindow = xf_AppWindowFromX11Window(xfc, event->window);
1019 if (event->atom == xfc->NET_WM_STATE)
1021 status = xf_GetWindowProperty(xfc, event->window, xfc->NET_WM_STATE, 12, &nitems,
1028 appWindow->maxVert = FALSE;
1029 appWindow->maxHorz = FALSE;
1031 for (
unsigned long i = 0; i < nitems; i++)
1033 if ((Atom)((UINT16**)prop)[i] ==
1034 Logging_XInternAtom(xfc->log, xfc->display,
"_NET_WM_STATE_MAXIMIZED_VERT",
1038 appWindow->maxVert = TRUE;
1041 if ((Atom)((UINT16**)prop)[i] ==
1042 Logging_XInternAtom(xfc->log, xfc->display,
"_NET_WM_STATE_MAXIMIZED_HORZ",
1046 appWindow->maxHorz = TRUE;
1054 if (event->atom == xfc->WM_STATE)
1057 xf_GetWindowProperty(xfc, event->window, xfc->WM_STATE, 1, &nitems, &bytes, &prop);
1062 if (((UINT32)*prop == 3) && !IsGnome())
1066 appWindow->minimized = TRUE;
1072 appWindow->minimized = FALSE;
1075 minimizedChanged = TRUE;
1082 WINPR_ASSERT(appWindow);
1083 if (appWindow->maxVert && appWindow->maxHorz && !appWindow->minimized)
1085 if (appWindow->rail_state != WINDOW_SHOW_MAXIMIZED)
1087 appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
1088 rc = xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MAXIMIZE);
1091 else if (appWindow->minimized)
1093 if (appWindow->rail_state != WINDOW_SHOW_MINIMIZED)
1095 appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
1096 rc = xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MINIMIZE);
1101 if (appWindow->rail_state != WINDOW_SHOW && appWindow->rail_state != WINDOW_HIDE)
1103 appWindow->rail_state = WINDOW_SHOW;
1104 rc = xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
1108 else if (minimizedChanged)
1109 rc = gdi_send_suppress_output(xfc->common.context.gdi, minimized);
1112 xf_rail_return_window(appWindow);
1118static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow,
const XEvent* event)
1120 if (!xfc->remote_app)
1123 switch (appWindow->local_move.state)
1125 case LMS_NOT_ACTIVE:
1131 if ((event->type == ConfigureNotify) && appWindow->rail_ignore_configure)
1133 appWindow->rail_ignore_configure = FALSE;
1143 switch (event->type)
1145 case ConfigureNotify:
1148 appWindow->local_move.state = LMS_ACTIVE;
1165 case VisibilityNotify:
1166 case PropertyNotify:
1181 switch (event->type)
1183 case ConfigureNotify:
1184 case VisibilityNotify:
1185 case PropertyNotify:
1193 xf_rail_end_local_move(xfc, appWindow);
1199 case LMS_TERMINATING:
1209BOOL xf_event_process(freerdp* instance,
const XEvent* event)
1213 WINPR_ASSERT(instance);
1214 WINPR_ASSERT(event);
1216 xfContext* xfc = (xfContext*)instance->context;
1219 rdpSettings* settings = xfc->common.context.settings;
1220 WINPR_ASSERT(settings);
1222 if (xfc->remote_app)
1224 xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
1229 xfc->appWindow = appWindow;
1231 const BOOL rc = xf_event_suppress_events(xfc, appWindow, event);
1232 xf_rail_return_window(appWindow);
1240 xfFloatbar* floatbar = xfc->window->floatbar;
1241 if (xf_floatbar_check_event(floatbar, event))
1243 xf_floatbar_event_process(floatbar, event);
1247 if (xf_floatbar_is_locked(floatbar))
1250 switch (event->type)
1268 xf_event_execute_action_script(xfc, event);
1270 if (event->type != MotionNotify)
1272 DEBUG_X11(
"%s Event(%d): wnd=0x%08lX", x11_event_string(event->type), event->type,
1273 (
unsigned long)event->xany.window);
1276 switch (event->type)
1279 status = xf_event_Expose(xfc, &event->xexpose, xfc->remote_app);
1282 case VisibilityNotify:
1283 status = xf_event_VisibilityNotify(xfc, &event->xvisibility, xfc->remote_app);
1287 status = xf_event_MotionNotify(xfc, &event->xmotion, xfc->remote_app);
1291 status = xf_event_ButtonPress(xfc, &event->xbutton, xfc->remote_app);
1295 status = xf_event_ButtonRelease(xfc, &event->xbutton, xfc->remote_app);
1299 status = xf_event_KeyPress(xfc, &event->xkey, xfc->remote_app);
1303 status = xf_event_KeyReleaseOrIgnore(xfc, &event->xkey, xfc->remote_app);
1307 status = xf_event_FocusIn(xfc, &event->xfocus, xfc->remote_app);
1311 status = xf_event_FocusOut(xfc, &event->xfocus, xfc->remote_app);
1315 status = xf_event_EnterNotify(xfc, &event->xcrossing, xfc->remote_app);
1319 status = xf_event_LeaveNotify(xfc, &event->xcrossing, xfc->remote_app);
1325 case GraphicsExpose:
1328 case ConfigureNotify:
1329 status = xf_event_ConfigureNotify(xfc, &event->xconfigure, xfc->remote_app);
1333 status = xf_event_MapNotify(xfc, &event->xmap, xfc->remote_app);
1337 status = xf_event_UnmapNotify(xfc, &event->xunmap, xfc->remote_app);
1340 case ReparentNotify:
1344 status = xf_event_MappingNotify(xfc, &event->xmapping, xfc->remote_app);
1348 status = xf_event_ClientMessage(xfc, &event->xclient, xfc->remote_app);
1351 case PropertyNotify:
1352 status = xf_event_PropertyNotify(xfc, &event->xproperty, xfc->remote_app);
1357 xf_disp_handle_xevent(xfc, event);
1362 xfWindow* window = xfc->window;
1363 xfFloatbar* floatbar = NULL;
1365 floatbar = window->floatbar;
1367 xf_cliprdr_handle_xevent(xfc, event);
1368 if (!xf_floatbar_check_event(floatbar, event) && !xf_floatbar_is_locked(floatbar))
1369 xf_input_handle_event(xfc, event);
1371 LogDynAndXSync(xfc->log, xfc->display, FALSE);
1375BOOL xf_generic_RawButtonEvent_(xfContext* xfc,
int button, BOOL app, BOOL down,
const char* file,
1376 const char* fkt,
size_t line)
1380 if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
1381 WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
1382 "%s: button=%d, app=%d, down=%d", __func__, button, app, down);
1384 if (app || (button < 0))
1387 for (
size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
1391 if (cur->button == (UINT32)button)
1400 if (flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL))
1403 freerdp_client_send_wheel_event(&xfc->common, flags);
1407 BOOL extended = FALSE;
1409 if (flags & (PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_BUTTON2))
1414 flags |= PTR_XFLAGS_DOWN;
1416 else if (flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3))
1419 flags |= PTR_FLAGS_DOWN;
1423 freerdp_client_send_extended_button_event(&xfc->common, TRUE, flags, 0, 0);
1425 freerdp_client_send_button_event(&xfc->common, TRUE, flags, 0, 0);
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.
This struct contains function pointer to initialize/free objects.
OBJECT_FREE_FN fnObjectFree
OBJECT_NEW_FN fnObjectNew