mirror of https://github.com/FreeRDP/FreeRDP
code cleanup: move coord conversion from individual mouse events to function mf_scale_mouse_event
This commit is contained in:
parent
46c06b5081
commit
e15636a610
|
@ -334,8 +334,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_MOVE, x, y);
|
||||
}
|
||||
|
||||
|
@ -354,8 +352,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, x, y);
|
||||
}
|
||||
|
||||
|
@ -374,8 +370,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_BUTTON1, x, y);
|
||||
}
|
||||
|
||||
|
@ -394,8 +388,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2, x, y);
|
||||
}
|
||||
|
||||
|
@ -414,8 +406,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_BUTTON2, x, y);
|
||||
}
|
||||
|
||||
|
@ -434,8 +424,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON3, x, y);
|
||||
}
|
||||
|
||||
|
@ -454,8 +442,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_BUTTON3, x, y);
|
||||
}
|
||||
|
||||
|
@ -471,8 +457,6 @@ DWORD mac_client_thread(void* param)
|
|||
NSPoint loc = [event locationInWindow];
|
||||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
flags = PTR_FLAGS_WHEEL;
|
||||
|
||||
|
@ -506,8 +490,6 @@ DWORD mac_client_thread(void* param)
|
|||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
y = [self frame].size.height - y;
|
||||
|
||||
// send mouse motion event to RDP server
|
||||
mf_scale_mouse_event(context, instance->input, PTR_FLAGS_MOVE, x, y);
|
||||
}
|
||||
|
@ -679,7 +661,6 @@ DWORD mac_client_thread(void* param)
|
|||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (argv[i])
|
||||
|
@ -1472,7 +1453,7 @@ void cliprdr_send_supported_format_list(freerdp* instance)
|
|||
|
||||
void windows_to_apple_cords(MRDPView* view, NSRect* r)
|
||||
{
|
||||
r->origin.y = [view frame].size.height - (r->origin.y + r->size.height);
|
||||
r->origin.y = [view frame].size.height - (r->origin.y + r->size.height);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -196,14 +196,18 @@ void freerdp_client_mouse_event(rdpContext* cfc, DWORD flags, int x, int y)
|
|||
void mf_scale_mouse_event(void* context, rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
mfContext* mfc = (mfContext*) context;
|
||||
MRDPView* view = (MRDPView*) mfc->view;
|
||||
|
||||
int ww, wh, dw, dh;
|
||||
|
||||
ww = mfc->client_width;
|
||||
wh = mfc->client_height;
|
||||
dw = mfc->context.settings->DesktopWidth;
|
||||
ww = mfc->client_width;
|
||||
wh = mfc->client_height;
|
||||
dw = mfc->context.settings->DesktopWidth;
|
||||
dh = mfc->context.settings->DesktopHeight;
|
||||
|
||||
// Convert to windows coordinates
|
||||
y = [view frame].size.height - y;
|
||||
|
||||
if (!mfc->context.settings->SmartSizing || ((ww == dw) && (wh == dh)))
|
||||
{
|
||||
y = y + mfc->yCurrentScroll;
|
||||
|
|
Loading…
Reference in New Issue