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

wrong MSG structure reconstruction in QWindowsContext::windowsProc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.3.0
    • 5.2.0
    • GUI: Window management
    • None
    • Found using Microsoft Visual Studio 2012.
    • b87106811e8a087b8c4ee36cd9d7929b57808132 (dev, 23.1.2014, 5.3)

    Description

      Look at the file ..\src\plugins\platforms\windows\qwindowscontext.cpp, function
      QWindowsContext::windowsProc

      in the beginning of this function there is a code that re-creates MSG structure.

      MSG msg;
      msg.hwnd = hwnd; // re-create MSG structure
      msg.message = message; // time and pt fields ignored
      msg.wParam = wParam;
      msg.lParam = lParam;
      msg.pt.x = GET_X_LPARAM(lParam);
      msg.pt.y = GET_Y_LPARAM(lParam);

      the code is correct only when message is Mouse Input Notification(WM_LBUTTONDOWN for example, see full list: http://msdn.microsoft.com/en-us/library/windows/desktop/ff468877%28v=vs.85%29.aspx)

      In other cases msg.pt contains wrong coordinates because lParam for other messages (for example Keyboard Input Notifications (WM_KEYDOWN), see:http://msdn.microsoft.com/en-us/library/windows/desktop/ff468861%28v=vs.85%29.aspx) does not contain information about cursor coordinates.

      So my proposal is either replace

      msg.pt.x = GET_X_LPARAM(lParam);
      msg.pt.y = GET_Y_LPARAM(lParam);

      with
      GetCursorPos(&msg.pt)

      or call GetCursorPos(&msg.pt) when message is not equal to one of the Mouse Input Notification.

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            maruda Sergey Maruda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes