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.
This commit is contained in:
Martin Herkt 2013-12-19 20:56:42 +01:00
parent 03e53ab430
commit d2e750ccd6
1 changed files with 17 additions and 12 deletions

View File

@ -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,