Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7637

WM_MOUSEMOVE gets wrong coordinate in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.6.0
    • Core: Event loop
    • None
    • 234e849cfc85d5618d2f703bb92701042993d2de

    Description

      On Win32, when compressing the WM_MOUSEMOVE events, sometimes the wrong coordinate is used. This happens when another app, is simulating events to the Qt Widget by using PostMessage() to post WM_MOUSEMOVE events to the application. The LPARAM has the correct coordinates.

      Here is a patch to resolve the issue:

      --- src\gui\kernel\qapplication_win.cpp 2010-01-26 07:26:26.348949500 -0800
      +++ src\gui\kernel\qapplication_win.cpp_ 2010-01-26 07:30:52.175529500 -0800
      @@ -2943,6 +2943,15 @@
                       MSG *msgPtr = (MSG *)(&msg);
                       // Update the passed in MSG structure with the
                       // most recent one.
      +                // NOTE: The pt in the MSG structure received from
      +                // PeekMessage is sometimes incorrect.  Specifically
      +                // if the WM_MOUSEMOVE messages are being posted
      +                // from a different process.  The LPARAM seems
      +                // to always be correct though, so use that
      +                // to update the pt.x and pt.y fields.
      +                mouseMsg.pt.x = GET_X_LPARAM(mouseMsg.lParam);
      +                mouseMsg.pt.y = GET_Y_LPARAM(mouseMsg.lParam);
      +                ClientToScreen(mouseMsg.hwnd, &mouseMsg.pt);
                       msgPtr->lParam = mouseMsg.lParam;
                       msgPtr->wParam = mouseMsg.wParam;
                       msgPtr->pt = mouseMsg.pt;
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pullatti Prasanth Ullattil
            jnewlin John Newlin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes