mirror of https://github.com/mpv-player/mpv
win32: properly handle WM_XBUTTONUP and WM_XBUTTONDOWN
According to MS documentation, an application should return TRUE from
WM_XBUTTONUP and WM_XBUTTONDOWN if it processes these messages.
DefWindowProc generates the WM_APPCOMMAND message when it processes the
WM_XBUTTONUP message, so if an application properly handles WM_XBUTTONUP
messages, extra WM_APPCOMMAND messages won't be generated.
Because mpv doesn't properly handle these messages,
WM_XBUTTONUP causes APPCOMMAND_BROWSER_BACKWARD to be generated, resulting
in duplicated keys and improper fix 438ead7a
, which prevents the processing
of the appcommand from sources other than mouse clicks.
Fix this by following the documentation, and the back and forward
appcommands can be added.
This commit is contained in:
parent
4c47dbe22c
commit
79068baf43
|
@ -93,6 +93,8 @@ static const struct keymap appcmd_map[] = {
|
|||
{APPCOMMAND_LAUNCH_MAIL, MP_KEY_MAIL},
|
||||
{APPCOMMAND_BROWSER_FAVORITES, MP_KEY_FAVORITES},
|
||||
{APPCOMMAND_BROWSER_SEARCH, MP_KEY_SEARCH},
|
||||
{APPCOMMAND_BROWSER_BACKWARD, MP_KEY_GO_BACK},
|
||||
{APPCOMMAND_BROWSER_FORWARD, MP_KEY_GO_FORWARD},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -1480,11 +1480,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
handle_mouse_down(w32,
|
||||
HIWORD(wParam) == 1 ? MP_MBTN_BACK : MP_MBTN_FORWARD,
|
||||
GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
break;
|
||||
return TRUE;
|
||||
case WM_XBUTTONUP:
|
||||
handle_mouse_up(w32,
|
||||
HIWORD(wParam) == 1 ? MP_MBTN_BACK : MP_MBTN_FORWARD);
|
||||
break;
|
||||
return TRUE;
|
||||
case WM_DISPLAYCHANGE:
|
||||
force_update_display_info(w32);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue