From d2e750ccd62c144c6714c4086be6191833bff003 Mon Sep 17 00:00:00 2001 From: Martin Herkt Date: Thu, 19 Dec 2013 20:56:42 +0100 Subject: w32_common: fix mouse clicks Apparently this has been broken for a year or so. The were three reasons for the breakage here: 1. The window dragging hack prevented any DOWN event from passing through since it always returned before we even got the button. 2. The window style had CS_DBLCLKS in its flags, so we did not get any DOWN events when the OS had detected a double click (instead expecting us to handle a DBL event). 3. We never sent any mouse buttons when mouse movement handling was disabled. --- video/out/w32_common.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index c4fb227601..66c540a99b 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -279,19 +279,24 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, break; } - if (mouse_button && vo->opts->enable_mouse_movements) { - int x = GET_X_LPARAM(lParam); - int y = GET_Y_LPARAM(lParam); + if (mouse_button) { mouse_button |= mod_state(vo); - if (mouse_button == (MP_MOUSE_BTN0 | MP_KEY_STATE_DOWN) && - !vo->opts->fullscreen && !mp_input_test_dragging(vo->input_ctx, x, y)) - { - // Window dragging hack - ReleaseCapture(); - SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); - return 0; - } mp_input_put_key(vo->input_ctx, mouse_button); + + if (vo->opts->enable_mouse_movements) { + int x = GET_X_LPARAM(lParam); + int y = GET_Y_LPARAM(lParam); + + if (mouse_button == (MP_MOUSE_BTN0 | MP_KEY_STATE_DOWN) && + !vo->opts->fullscreen && + !mp_input_test_dragging(vo->input_ctx, x, y)) + { + // Window dragging hack + ReleaseCapture(); + SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); + return 0; + } + } } return DefWindowProcW(hWnd, message, wParam, lParam); @@ -609,7 +614,7 @@ int vo_w32_init(struct vo *vo) WNDCLASSEXW wcex = { .cbSize = sizeof wcex, - .style = CS_OWNDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, + .style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW, .lpfnWndProc = WndProc, .hInstance = hInstance, .hIcon = mplayerIcon, -- cgit v1.2.3