mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
037c7a9279
This was attempted before infc9695e63b
, but it was reverted in1b7ce759b1
because it caused conflicts with other software watching the same keys (See #2041.) It seems like some PCs ship with OEM software that watches the volume keys without consuming key events and this causes them to be handled twice, once by mpv and once by the other software. In order to prevent conflicts like this, use the WM_APPCOMMAND message to handle media keys. Returning TRUE from the WM_APPCOMMAND handler should indicate to the operating system that we consumed the key event and it should not be propogated to the shell. Also, we now only listen for keys that are directly related to multimedia playback (eg. the APPCOMMAND_MEDIA_* keys.) Keys like APPCOMMAND_VOLUME_* are ignored, so they can be handled by the shell, or by other mixer software.
30 lines
960 B
C
30 lines
960 B
C
/*
|
|
* This file is part of mpv.
|
|
*
|
|
* mpv is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* mpv is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef MP_W32_KEYBOARD
|
|
#define MP_W32_KEYBOARD
|
|
|
|
#include <stdbool.h>
|
|
|
|
/* Convert a Windows virtual key code to an mpv key */
|
|
int mp_w32_vkey_to_mpkey(UINT vkey, bool extended);
|
|
|
|
/* Convert a WM_APPCOMMAND value to an mpv key */
|
|
int mp_w32_appcmd_to_mpkey(UINT appcmd);
|
|
|
|
#endif
|