Merge pull request #1668 from bmiklautz/issue_1654

xfreerdp: handle negative mouse coordinates
This commit is contained in:
Marc-André Moreau 2014-01-23 10:13:45 -08:00
commit ac10d0e801
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,8 @@
#include "xf_event.h"
#include "xf_input.h"
#define CLAMP_COORDINATES(x, y) if (x < 0) x = 0; if (y < 0) y = 0
const char* const X11_EVENT_STRINGS[] =
{
"", "",
@ -167,6 +169,7 @@ BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window win
x = (int)((x - xfc->offset_x) * (1.0 / xfc->settings->ScalingFactor) );
y = (int)((y - xfc->offset_y) * (1.0 / xfc->settings->ScalingFactor) );
}
CLAMP_COORDINATES(x,y);
input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
@ -276,6 +279,7 @@ BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window win
* (1.0 / xfc->settings->ScalingFactor));
}
CLAMP_COORDINATES(x,y);
if (extended)
input->ExtendedMouseEvent(input, flags, x, y);
else
@ -364,6 +368,8 @@ BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window w
y = (int) ((y - xfc->offset_y) * (1.0 / xfc->settings->ScalingFactor));
}
CLAMP_COORDINATES(x,y);
if (extended)
input->ExtendedMouseEvent(input, flags, x, y);
else