freerdp-client: fix input coord translation

This commit is contained in:
C-o-r-E 2013-05-28 16:28:13 -04:00
parent c6049f7628
commit 284f54ffcd
2 changed files with 24 additions and 18 deletions

View File

@ -99,7 +99,8 @@ static BOOL xf_event_Expose(xfInfo* xfi, XEvent* event, BOOL app)
if (!app) if (!app)
{ {
if (xfi->scale != 1.0) //if (xfi->scale != 1.0)
if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
xf_draw_screen_scaled(xfi, x, y, w, h, FALSE); xf_draw_screen_scaled(xfi, x, y, w, h, FALSE);
} }
@ -164,10 +165,11 @@ static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app)
} }
/* Take scaling in to consideration */ /* Take scaling in to consideration */
if(xfi->scale != 1.0) //if(xfi->scale != 1.0)
if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
x = (int)(x * (1.0 / xfi->scale) ); x = (int)((x - xfi->offset_x) * (1.0 / xfi->scale) );
y = (int)(y * (1.0 / xfi->scale) ); y = (int)((y - xfi->offset_y) * (1.0 / xfi->scale) );
} }
input->MouseEvent(input, PTR_FLAGS_MOVE, x, y); input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
@ -274,12 +276,12 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
} }
if (xfi->scale != 1.0) //if (xfi->scale != 1.0)
{ if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
/* Take scaling in to consideration */ {
x = (int) (x * (1.0 / xfi->scale)); x = (int)((x - xfi->offset_x) * (1.0 / xfi->scale) );
y = (int) (y * (1.0 / xfi->scale)); y = (int)((y - xfi->offset_y) * (1.0 / xfi->scale) );
} }
if (extended) if (extended)
input->ExtendedMouseEvent(input, flags, x, y); input->ExtendedMouseEvent(input, flags, x, y);
@ -364,11 +366,12 @@ static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app)
x, y, &x, &y, &childWindow); x, y, &x, &y, &childWindow);
} }
if (xfi->scale != 1.0)
//if (xfi->scale != 1.0)
if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
/* Take scaling in to consideration */ x = (int)((x - xfi->offset_x) * (1.0 / xfi->scale) );
x = (int) (x * (1.0 / xfi->scale)); y = (int)((y - xfi->offset_y) * (1.0 / xfi->scale) );
y = (int) (y * (1.0 / xfi->scale));
} }
if (extended) if (extended)

View File

@ -231,7 +231,7 @@ void xf_sw_end_paint(rdpContext* context)
XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h); XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h);
if (xfi->scale != 1.0) if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
xf_draw_screen_scaled(xfi, x, y, w, h, TRUE); xf_draw_screen_scaled(xfi, x, y, w, h, TRUE);
} }
@ -266,7 +266,8 @@ void xf_sw_end_paint(rdpContext* context)
//combine xfi->primary with xfi->image //combine xfi->primary with xfi->image
XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h); XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h);
if (xfi->scale != 1.0) //if (xfi->scale != 1.0)
if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
xf_draw_screen_scaled(xfi, x, y, w, h, TRUE); xf_draw_screen_scaled(xfi, x, y, w, h, TRUE);
} }
@ -357,7 +358,8 @@ void xf_hw_end_paint(rdpContext* context)
xf_lock_x11(xfi, FALSE); xf_lock_x11(xfi, FALSE);
if (xfi->scale != 1.0) //if (xfi->scale != 1.0)
if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
xf_draw_screen_scaled(xfi, x, y, w, h, TRUE); xf_draw_screen_scaled(xfi, x, y, w, h, TRUE);
} }
@ -389,7 +391,8 @@ void xf_hw_end_paint(rdpContext* context)
w = cinvalid[i].w; w = cinvalid[i].w;
h = cinvalid[i].h; h = cinvalid[i].h;
if(xfi->scale != 1.0) //if(xfi->scale != 1.0)
if ( (xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y) )
{ {
xf_draw_screen_scaled(xfi, x, y, w, h, TRUE); xf_draw_screen_scaled(xfi, x, y, w, h, TRUE);
} }