[patch 6/8] Cygwin update to enqueue pointer motion event on mouse movement

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 16 21:46:31 PDT 2008


On Thu, Oct 16, 2008 at 01:10:03PM +0100, jon.turney at dronecode.org.uk wrote:
> Apparently we shouldn't need this, something else is wrong...

no, I was wrong in the previous email, confusing the intention of the code
here. Am I right that this is the interface between X and the windows API? 

In that case winEnqueueMotion should do the same as xf86PostMotionEventP, minus
the DGA stuff I guess.

ACK, though untested.

 
> ---
>  xserver/hw/xwin/win.h                     |    3 +++
>  xserver/hw/xwin/winmouse.c                |   26 ++++++++++++++++++++++++++
>  xserver/hw/xwin/winmultiwindowwndproc.c   |    6 +++---
>  xserver/hw/xwin/winwin32rootlesswndproc.c |    6 +++---
>  xserver/hw/xwin/winwndproc.c              |    8 +++-----
>  5 files changed, 38 insertions(+), 11 deletions(-)
> 
> Index: xorg-git/xserver/hw/xwin/win.h
> ===================================================================
> --- xorg-git.orig/xserver/hw/xwin/win.h
> +++ xorg-git/xserver/hw/xwin/win.h
> @@ -1006,6 +1006,9 @@ winMouseButtonsHandle (ScreenPtr pScreen
>  		       int iEventType, int iButton,
>  		       WPARAM wParam);
>  
> +void
> +winEnqueueMotion(int x, int y);
> +
>  #ifdef XWIN_NATIVEGDI
>  /*
>   * winnativegdi.c
> Index: xorg-git/xserver/hw/xwin/winmouse.c
> ===================================================================
> --- xorg-git.orig/xserver/hw/xwin/winmouse.c
> +++ xorg-git/xserver/hw/xwin/winmouse.c
> @@ -344,3 +344,29 @@ winMouseButtonsHandle (ScreenPtr pScreen
>  
>    return 0;
>  }
> +
> +/**
> + * Enqueue a motion event.
> + *
> + *  XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer)
> + *
> + */
> +void winEnqueueMotion(int x, int y)
> +{
> +  miPointerSetPosition(g_pwinPointer, &x, &y);
> +  g_c32LastInputEventTime = GetTickCount();
> +
> +  int i, nevents;
> +  int valuators[2];
> +
> +  EventListPtr events;
> +  GetEventList(&events);
> +
> +  valuators[0] = x;
> +  valuators[1] = y;
> +  nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0,
> +			     POINTER_ABSOLUTE, 0, 2, valuators);
> +
> +  for (i = 0; i < nevents; i++)
> +    mieqEnqueue(g_pwinPointer, events[i].event);
> +}
> Index: xorg-git/xserver/hw/xwin/winmultiwindowwndproc.c
> ===================================================================
> --- xorg-git.orig/xserver/hw/xwin/winmultiwindowwndproc.c
> +++ xorg-git/xserver/hw/xwin/winmultiwindowwndproc.c
> @@ -535,9 +535,9 @@ winTopLevelWindowProc (HWND hwnd, UINT m
>  	}
>  
>        /* Deliver absolute cursor position to X Server */
> -      miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset,
> -			       ptMouse.y - s_pScreenInfo->dwYOffset,
> -			       g_c32LastInputEventTime = GetTickCount ());
> +      winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset,
> +		       ptMouse.y - s_pScreenInfo->dwYOffset);
> +
>        return 0;
>        
>      case WM_NCMOUSEMOVE:
> Index: xorg-git/xserver/hw/xwin/winwin32rootlesswndproc.c
> ===================================================================
> --- xorg-git.orig/xserver/hw/xwin/winwin32rootlesswndproc.c
> +++ xorg-git/xserver/hw/xwin/winwin32rootlesswndproc.c
> @@ -571,9 +571,9 @@ winMWExtWMWindowProc (HWND hwnd, UINT me
>  	}
>  
>        /* Deliver absolute cursor position to X Server */
> -      miPointerAbsoluteCursor (ptMouse.x - pScreenInfo->dwXOffset,
> -			       ptMouse.y - pScreenInfo->dwYOffset,
> -			       g_c32LastInputEventTime = GetTickCount ());
> +      winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset,
> +		       ptMouse.y - pScreenInfo->dwYOffset);
> +
>        return 0;
>        
>      case WM_NCMOUSEMOVE:
> Index: xorg-git/xserver/hw/xwin/winwndproc.c
> ===================================================================
> --- xorg-git.orig/xserver/hw/xwin/winwndproc.c
> +++ xorg-git/xserver/hw/xwin/winwndproc.c
> @@ -764,9 +764,8 @@ winWindowProc (HWND hwnd, UINT message, 
>  	}
>        
>        /* Deliver absolute cursor position to X Server */
> -      miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
> -			       GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset,
> -			       g_c32LastInputEventTime = GetTickCount ());
> +      winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
> +		       GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
>        return 0;
>  
>      case WM_NCMOUSEMOVE:
> @@ -929,8 +928,7 @@ winWindowProc (HWND hwnd, UINT message, 
>  	    point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
>  	    
>  	    /* Deliver absolute cursor position to X Server */
> -	    miPointerAbsoluteCursor (point.x, point.y,
> -				     g_c32LastInputEventTime = GetTickCount());
> +	    winEnqueueMotion(point.x , point.y);
>  
>  	    /* Check if a button was released but we didn't see it */
>  	    GetCursorPos (&point);
> 
> -- 



More information about the xorg mailing list