diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2013-12-19 20:56:42 +0100 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2013-12-19 21:04:10 +0100 |
commit | d2e750ccd62c144c6714c4086be6191833bff003 (patch) | |
tree | f360c3601d19e487c7b557a74aea6462260c06db /video/out/w32_common.c | |
parent | 03e53ab4301db94abc02059f29faab5c4ef40f5b (diff) | |
download | mpv-d2e750ccd62c144c6714c4086be6191833bff003.tar.bz2 mpv-d2e750ccd62c144c6714c4086be6191833bff003.tar.xz |
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.
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r-- | video/out/w32_common.c | 29 |
1 files 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, |