From 48e525efacd518e1372a18662c06f737a84fa0c1 Mon Sep 17 00:00:00 2001 From: Olli Werwolff Date: Tue, 12 Jul 2011 14:44:50 +0200 Subject: Fixed compilation of qfiledialog_win.cpp Change-Id: I2c84d8f55df5a35b1cc335fdb59a27f2d3d3bad6 Reviewed-on: http://codereview.qt.nokia.com/2962 Reviewed-by: Qt Sanity Bot Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog_win.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfiledialog_win.cpp b/src/widgets/dialogs/qfiledialog_win.cpp index cdf8cd39cf..8c3b3cfda7 100644 --- a/src/widgets/dialogs/qfiledialog_win.cpp +++ b/src/widgets/dialogs/qfiledialog_win.cpp @@ -243,7 +243,20 @@ static void qt_win_clean_up_OFN(OPENFILENAME **ofn) *ofn = 0; } -extern void qt_win_eatMouseMove(); +void qt_win_eatMouseMove() +{ + // after closing a windows dialog with a double click (i.e. open a file) + // the message queue still contains a dubious WM_MOUSEMOVE message where + // the left button is reported to be down (wParam != 0). + // remove all those messages (usually 1) and post the last one with a + // reset button state + + MSG msg = {0, 0, 0, 0, 0, {0, 0} }; + while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) + ; + if (msg.message == WM_MOUSEMOVE) + PostMessage(msg.hwnd, msg.message, 0, msg.lParam); +} QString qt_win_get_open_file_name(const QFileDialogArgs &args, QString *initialDirectory, -- cgit v1.2.3