Update of /cvsroot/arcem/arcem/X In directory vz-cvs-4.sog:/tmp/cvs-serv1065/X
Modified Files: DispKbd.c Log Message: Allow use with X servers that don't support XWarpPointer. New environment variable ARCEMNOWARP which invokes this mode of operation. Not very smart and not perfect, but better than the alternative which is totally unusable. Index: DispKbd.c =================================================================== RCS file: /cvsroot/arcem/arcem/X/DispKbd.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- DispKbd.c 12 May 2012 17:34:51 -0000 1.80 +++ DispKbd.c 20 Jul 2012 20:18:57 -0000 1.81 @@ -55,6 +55,9 @@ } /* ------------------------------------------------------------------ */ +static int lastmousemode=0, lastmousex=0, lastmousey=0; + +/* ------------------------------------------------------------------ */ static void store_colour(Colormap map, unsigned long pixel, unsigned short r, unsigned short g, unsigned short b); @@ -347,6 +350,11 @@ fputs("arcem: synchronous X protocol selected.\n", stderr); } + if (getenv("ARCEMNOWARP")) { + lastmousemode=1; + fputs("arcem: no-XWarpPointer mode selected.\n", stderr); + } + if ((s = getenv("ARCEMXMOUSEKEY"))) { if ((ks = XStringToKeysym(s))) { mouse_key.name = s; @@ -683,7 +691,7 @@ DisplayDev_GetCursorPos(state,&HorizPos,&VertPos); HorizPos = HorizPos*xscale+xoffset; VertPos = VertPos*yscale+yoffset; - + if (Height < 1) Height = 1; @@ -703,31 +711,44 @@ static void MouseMoved(ARMul_State *state,XMotionEvent *xmotion) { int xdiff, ydiff; - unsigned ScreenWidth = (VIDC.Horiz_DisplayEnd - VIDC.Horiz_DisplayStart) * 2; - unsigned ScreenHeight = VIDC.Vert_DisplayEnd - VIDC.Vert_DisplayStart; - /* Well the coordinates of the mouse cursor are now in xmotion->x and - xmotion->y, I'm going to compare those against the cursor position - and transmit the difference. This can't possibly take care of the OS's - hotspot offsets */ + if ( lastmousemode ) + { + xdiff=(xmotion->x-lastmousex)*4; + ydiff=(lastmousey-xmotion->y)*4; + lastmousex=xmotion->x; + lastmousey=xmotion->y; + } + else + { + unsigned ScreenWidth = (VIDC.Horiz_DisplayEnd - VIDC.Horiz_DisplayStart) * 2; + unsigned ScreenHeight = VIDC.Vert_DisplayEnd - VIDC.Vert_DisplayStart; - /* We are now only using differences from the reference position */ - if ((xmotion->x == ScreenWidth / 2) && (xmotion->y == ScreenHeight / 2)) - return; + /* Well the coordinates of the mouse cursor are now in xmotion->x and + xmotion->y, I'm going to compare those against the cursor position + and transmit the difference. This can't possibly take care of the OS's + hotspot offsets */ - /* Keep the mouse pointer under our window */ - XWarpPointer(PD.disp, - None, /* src window for relative coords (NOT USED) */ - PD.MainPane, /* Destination window to move cursor in */ - 0, 0, /* relative coords (NOT USED) */ - 9999, 9999, /* src width and height (NOT USED) */ - ScreenWidth / 2, ScreenHeight / 2); /* Coordinates in the destination window */ + /* We are now only using differences from the reference position */ + if ((xmotion->x == ScreenWidth / 2) && (xmotion->y == ScreenHeight / 2)) + return; + + /* Keep the mouse pointer under our window */ + XWarpPointer(PD.disp, + None, /* src window for relative coords (NOT USED) */ + PD.MainPane, /* Destination window to move cursor in */ + 0, 0, /* relative coords (NOT USED) */ + 9999, 9999, /* src width and height (NOT USED) */ + ScreenWidth / 2, ScreenHeight / 2); /* Coordinates in the destination window */ #ifdef DEBUG_MOUSEMOVEMENT - fprintf(stderr,"MouseMoved: CursorStart=%d xmotion->x=%d\n", - VIDC.Horiz_CursorStart,xmotion->x); + fprintf(stderr,"MouseMoved: CursorStart=%d xmotion->x=%d\n", + VIDC.Horiz_CursorStart,xmotion->x); #endif - xdiff = xmotion->x - ScreenWidth / 2; + xdiff = xmotion->x - ScreenWidth / 2; + ydiff = ScreenHeight / 2 - xmotion->y; + } + if (KBD.MouseXCount != 0) { if (KBD.MouseXCount & 64) { signed char tmpC; @@ -745,7 +766,6 @@ if (xdiff < -63) xdiff = -63; - ydiff = ScreenHeight / 2 - xmotion->y; if (KBD.MouseYCount & 64) { signed char tmpC; tmpC = KBD.MouseYCount | 128; /* Sign extend */ @@ -774,6 +794,8 @@ case EnterNotify: /*fprintf(stderr,"MainPane: Enter notify!\n"); */ hostdisplay_change_focus(TRUE); + lastmousex=e->xcrossing.x; + lastmousey=e->xcrossing.y; break; case LeaveNotify: @@ -966,7 +988,7 @@ static void *ecalloc(size_t n, const char *use) { void *p; - + p = emalloc(n, use); memset(p, 0, n); ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -- arcem-cvs mailing list arcem-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/arcem-cvs