mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #11966 from akallabeth/mouse-log
[client,x11] log mouse event types and call stack
This commit is contained in:
@@ -44,8 +44,6 @@
|
||||
#include "xf_debug.h"
|
||||
#include "xf_event.h"
|
||||
|
||||
#define TAG CLIENT_TAG("x11")
|
||||
|
||||
#define CLAMP_COORDINATES(x, y) \
|
||||
do \
|
||||
{ \
|
||||
@@ -55,6 +53,8 @@
|
||||
(y) = 0; \
|
||||
} while (0)
|
||||
|
||||
static const DWORD mouseLogLevel = WLOG_TRACE;
|
||||
|
||||
const char* x11_event_string(int event)
|
||||
{
|
||||
switch (event)
|
||||
@@ -235,7 +235,7 @@ static BOOL action_script_run(xfContext* xfc, const char* buffer, size_t size, v
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
WLog_WARN(TAG, "ActionScript xevent: script did not return data");
|
||||
WLog_Print(xfc->log, WLOG_WARN, "ActionScript xevent: script did not return data");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -251,20 +251,20 @@ static BOOL action_script_run(xfContext* xfc, const char* buffer, size_t size, v
|
||||
free(cmd);
|
||||
if (!fp)
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to execute '%s'", buffer);
|
||||
WLog_Print(xfc->log, WLOG_ERROR, "Failed to execute '%s'", buffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pstatus = pclose(fp);
|
||||
if (*pstatus < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "Command '%s' returned %d", buffer, *pstatus);
|
||||
WLog_Print(xfc->log, WLOG_ERROR, "Command '%s' returned %d", buffer, *pstatus);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_WARN(TAG, "ActionScript xevent: No such file '%s'", buffer);
|
||||
WLog_Print(xfc->log, WLOG_WARN, "ActionScript xevent: No such file '%s'", buffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -425,10 +425,16 @@ static BOOL xf_event_VisibilityNotify(xfContext* xfc, const XVisibilityEvent* ev
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, Window window, BOOL app)
|
||||
BOOL xf_generic_MotionNotify_(xfContext* xfc, int x, int y, Window window, BOOL app,
|
||||
const char* file, const char* fkt, size_t line)
|
||||
{
|
||||
Window childWindow = None;
|
||||
|
||||
if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
|
||||
WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
|
||||
"%s: x=%d, y=%d, window=0x%08lx, app=%d", __func__, x, y, window,
|
||||
app);
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
WINPR_ASSERT(xfc->common.context.settings);
|
||||
|
||||
@@ -455,14 +461,20 @@ BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, Window window, BOOL a
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL xf_generic_RawMotionNotify(xfContext* xfc, int x, int y, WINPR_ATTR_UNUSED Window window,
|
||||
BOOL app)
|
||||
BOOL xf_generic_RawMotionNotify_(xfContext* xfc, int x, int y, WINPR_ATTR_UNUSED Window window,
|
||||
BOOL app, const char* file, const char* fkt, size_t line)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
|
||||
WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
|
||||
"%s: x=%d, y=%d, window=0x%08lx, app=%d", __func__, x, y, window,
|
||||
app);
|
||||
|
||||
if (app)
|
||||
{
|
||||
WLog_ERR(TAG, "Relative mouse input is not supported with remoate app mode!");
|
||||
WLog_Print(xfc->log, WLOG_ERROR,
|
||||
"Relative mouse input is not supported with remoate app mode!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -476,19 +488,23 @@ static BOOL xf_event_MotionNotify(xfContext* xfc, const XMotionEvent* event, BOO
|
||||
if (xfc->window)
|
||||
xf_floatbar_set_root_y(xfc->window->floatbar, event->y);
|
||||
|
||||
if (xfc->xi_event ||
|
||||
(xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common)))
|
||||
if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
|
||||
return TRUE;
|
||||
|
||||
return xf_generic_MotionNotify(xfc, event->x, event->y, event->window, app);
|
||||
}
|
||||
|
||||
BOOL xf_generic_ButtonEvent(xfContext* xfc, int x, int y, int button, Window window, BOOL app,
|
||||
BOOL down)
|
||||
BOOL xf_generic_ButtonEvent_(xfContext* xfc, int x, int y, int button, Window window, BOOL app,
|
||||
BOOL down, const char* file, const char* fkt, size_t line)
|
||||
{
|
||||
UINT16 flags = 0;
|
||||
Window childWindow = None;
|
||||
|
||||
if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
|
||||
WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
|
||||
"%s: x=%d, y=%d, button=%d, window=0x%08lx, app=%d, down=%d",
|
||||
__func__, x, y, button, window, app, down);
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
if (button < 0)
|
||||
return FALSE;
|
||||
@@ -585,8 +601,7 @@ static BOOL xf_event_ButtonPress(xfContext* xfc, const XButtonEvent* event, BOOL
|
||||
{
|
||||
xf_grab_mouse(xfc);
|
||||
|
||||
if (xfc->xi_event ||
|
||||
(xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common)))
|
||||
if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
|
||||
return TRUE;
|
||||
if (!app && xfc_is_floatbar_window(xfc, event->window))
|
||||
return TRUE;
|
||||
@@ -599,8 +614,7 @@ static BOOL xf_event_ButtonRelease(xfContext* xfc, const XButtonEvent* event, BO
|
||||
{
|
||||
xf_grab_mouse(xfc);
|
||||
|
||||
if (xfc->xi_event ||
|
||||
(xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common)))
|
||||
if (xfc->xi_event || xfc->xi_rawevent || (xfc->common.mouse_grabbed && xf_use_rel_mouse(xfc)))
|
||||
return TRUE;
|
||||
return xf_generic_ButtonEvent(xfc, event->x, event->y,
|
||||
WINPR_ASSERTING_INT_CAST(int, event->button), event->window, app,
|
||||
@@ -726,17 +740,17 @@ static BOOL xf_event_MappingNotify(xfContext* xfc, const XMappingEvent* event, B
|
||||
case MappingModifier:
|
||||
return xf_keyboard_update_modifier_map(xfc);
|
||||
case MappingKeyboard:
|
||||
WLog_VRB(TAG, "[%d] MappingKeyboard", event->request);
|
||||
WLog_Print(xfc->log, WLOG_TRACE, "[%d] MappingKeyboard", event->request);
|
||||
return xf_keyboard_init(xfc);
|
||||
case MappingPointer:
|
||||
WLog_VRB(TAG, "[%d] MappingPointer", event->request);
|
||||
WLog_Print(xfc->log, WLOG_TRACE, "[%d] MappingPointer", event->request);
|
||||
xf_button_map_init(xfc);
|
||||
return TRUE;
|
||||
default:
|
||||
WLog_WARN(TAG,
|
||||
"[%d] Unsupported MappingNotify::request, must be one "
|
||||
"of[MappingModifier(%d), MappingKeyboard(%d), MappingPointer(%d)]",
|
||||
event->request, MappingModifier, MappingKeyboard, MappingPointer);
|
||||
WLog_Print(xfc->log, WLOG_WARN,
|
||||
"[%d] Unsupported MappingNotify::request, must be one "
|
||||
"of[MappingModifier(%d), MappingKeyboard(%d), MappingPointer(%d)]",
|
||||
event->request, MappingModifier, MappingKeyboard, MappingPointer);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -822,8 +836,8 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, const XConfigureEvent* even
|
||||
const rdpSettings* settings = xfc->common.context.settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
WLog_DBG(TAG, "x=%" PRId32 ", y=%" PRId32 ", w=%" PRId32 ", h=%" PRId32, event->x, event->y,
|
||||
event->width, event->height);
|
||||
WLog_Print(xfc->log, WLOG_DEBUG, "x=%" PRId32 ", y=%" PRId32 ", w=%" PRId32 ", h=%" PRId32,
|
||||
event->x, event->y, event->width, event->height);
|
||||
|
||||
if (!app)
|
||||
{
|
||||
@@ -1343,10 +1357,15 @@ BOOL xf_event_process(freerdp* instance, const XEvent* event)
|
||||
return status;
|
||||
}
|
||||
|
||||
BOOL xf_generic_RawButtonEvent(xfContext* xfc, int button, BOOL app, BOOL down)
|
||||
BOOL xf_generic_RawButtonEvent_(xfContext* xfc, int button, BOOL app, BOOL down, const char* file,
|
||||
const char* fkt, size_t line)
|
||||
{
|
||||
UINT16 flags = 0;
|
||||
|
||||
if (WLog_IsLevelActive(xfc->log, mouseLogLevel))
|
||||
WLog_PrintTextMessage(xfc->log, mouseLogLevel, line, file, fkt,
|
||||
"%s: button=%d, app=%d, down=%d", __func__, button, app, down);
|
||||
|
||||
if (app || (button < 0))
|
||||
return FALSE;
|
||||
|
||||
|
||||
@@ -37,10 +37,25 @@ void xf_event_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsig
|
||||
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y);
|
||||
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y);
|
||||
|
||||
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, Window window, BOOL app);
|
||||
BOOL xf_generic_RawMotionNotify(xfContext* xfc, int x, int y, Window window, BOOL app);
|
||||
BOOL xf_generic_ButtonEvent(xfContext* xfc, int x, int y, int button, Window window, BOOL app,
|
||||
BOOL down);
|
||||
BOOL xf_generic_RawButtonEvent(xfContext* xfc, int button, BOOL app, BOOL down);
|
||||
#define xf_generic_MotionNotify(xfc, x, y, window, app) \
|
||||
xf_generic_MotionNotify_((xfc), (x), (y), (window), (app), __FILE__, __func__, __LINE__)
|
||||
BOOL xf_generic_MotionNotify_(xfContext* xfc, int x, int y, Window window, BOOL app,
|
||||
const char* file, const char* fkt, size_t line);
|
||||
|
||||
#define xf_generic_RawMotionNotify(xfc, x, y, window, app) \
|
||||
xf_generic_RawMotionNotify_((xfc), (x), (y), (window), (app), __FILE__, __func__, __LINE__)
|
||||
BOOL xf_generic_RawMotionNotify_(xfContext* xfc, int x, int y, Window window, BOOL app,
|
||||
const char* file, const char* fkt, size_t line);
|
||||
|
||||
#define xf_generic_ButtonEvent(xfc, x, y, button, window, app, down) \
|
||||
xf_generic_ButtonEvent_((xfc), (x), (y), (button), (window), (app), (down), __FILE__, \
|
||||
__func__, __LINE__)
|
||||
BOOL xf_generic_ButtonEvent_(xfContext* xfc, int x, int y, int button, Window window, BOOL app,
|
||||
BOOL down, const char* file, const char* fkt, size_t line);
|
||||
|
||||
#define xf_generic_RawButtonEvent(xfc, button, app, down) \
|
||||
xf_generic_RawButtonEvent_((xfc), (button), (app), (down), __FILE__, __func__, __LINE__)
|
||||
BOOL xf_generic_RawButtonEvent_(xfContext* xfc, int button, BOOL app, BOOL down, const char* file,
|
||||
const char* fkt, size_t line);
|
||||
|
||||
#endif /* FREERDP_CLIENT_X11_EVENT_H */
|
||||
|
||||
@@ -745,7 +745,7 @@ static int xf_input_pens_unhover(xfContext* xfc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool xf_use_rel_mouse(xfContext* xfc)
|
||||
bool xf_use_rel_mouse(xfContext* xfc)
|
||||
{
|
||||
if (!freerdp_client_use_relative_mouse_events(&xfc->common))
|
||||
return false;
|
||||
|
||||
@@ -29,5 +29,6 @@
|
||||
|
||||
int xf_input_init(xfContext* xfc, Window window);
|
||||
int xf_input_handle_event(xfContext* xfc, const XEvent* event);
|
||||
bool xf_use_rel_mouse(xfContext* xfc);
|
||||
|
||||
#endif /* FREERDP_CLIENT_X11_INPUT_H */
|
||||
|
||||
Reference in New Issue
Block a user