diff options
author | Michał Cichoń <michcic@gmail.com> | 2019-05-03 17:02:47 +0200 |
---|---|---|
committer | Michał Cichoń <michcic@gmail.com> | 2019-05-03 17:02:47 +0200 |
commit | eaa10a3950ccd8fa2a5acada4c82d6627b6214f7 (patch) | |
tree | 3012531b45cfbaba4b4c0c66e157ad20795e54ee /src/hotkey.h | |
parent | cb6789b17f81d29c6884c27715c705083e09a5db (diff) | |
parent | c4b80765185944a5b89f3cc76568ba498bf5f3f4 (diff) | |
download | pianobar-windows-eaa10a3950ccd8fa2a5acada4c82d6627b6214f7.tar.gz pianobar-windows-eaa10a3950ccd8fa2a5acada4c82d6627b6214f7.tar.bz2 pianobar-windows-eaa10a3950ccd8fa2a5acada4c82d6627b6214f7.zip |
Merge branch 'release/2019.05.03'2019.05.03
Add support for hotkeys. #20
Hotkeys can be assigned to action in configuration file ex:
hk_<action_name> = g + shift + alt + ctrl
Diffstat (limited to 'src/hotkey.h')
-rw-r--r-- | src/hotkey.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/hotkey.h b/src/hotkey.h new file mode 100644 index 0000000..fb59bc0 --- /dev/null +++ b/src/hotkey.h @@ -0,0 +1,53 @@ +/* +Copyright (c) 2019 + Micha³ Cichoñ <thedmd@interia.pl> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +# pragma once + +#include "config.h" +#include <stdio.h> +#include <stdarg.h> +#include <stdbool.h> + +typedef enum { + BAR_HK_MOD_NONE = 0, + BAR_HK_MOD_SHIFT = 1, + BAR_HK_MOD_ALT = 2, + BAR_HK_MOD_CTRL = 4, + BAR_HK_MOD_WIN = 8 +} BarHotKeyMods_t; + +typedef struct { + int id; + char key; + BarHotKeyMods_t mods; +} BarHotKey_t; + +typedef void (*BarHotKeyHandler)(int, void *); + +void BarHotKeyInit (); +void BarHotKeyDestroy (); +void BarHotKeyPool (BarHotKeyHandler, void *); +bool BarHotKeyRegister (BarHotKey_t); +void BarHotKeyUnregister (int); +bool BarHotKeyParse (BarHotKey_t* result, const char* value); + |