/usr/include/obs/obs-hotkey.h is in libobs-dev 21.0.2+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | /******************************************************************************
Copyright (C) 2014-2015 by Ruwen Hahn <palana@stunned.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef size_t obs_hotkey_id;
typedef size_t obs_hotkey_pair_id;
#ifndef SWIG
#define OBS_INVALID_HOTKEY_ID (~(obs_hotkey_id)0)
#define OBS_INVALID_HOTKEY_PAIR_ID (~(obs_hotkey_pair_id)0)
#else
const size_t OBS_INVALID_HOTKEY_ID = (size_t)-1;
const size_t OBS_INVALID_HOTKEY_PAIR_ID = (size_t)-1;
#endif
enum obs_key {
#define OBS_HOTKEY(x) x,
#include "obs-hotkeys.h"
#undef OBS_HOTKEY
OBS_KEY_LAST_VALUE //not an actual key
};
typedef enum obs_key obs_key_t;
struct obs_key_combination {
uint32_t modifiers;
obs_key_t key;
};
typedef struct obs_key_combination obs_key_combination_t;
typedef struct obs_hotkey obs_hotkey_t;
typedef struct obs_hotkey_binding obs_hotkey_binding_t;
enum obs_hotkey_registerer_type {
OBS_HOTKEY_REGISTERER_FRONTEND,
OBS_HOTKEY_REGISTERER_SOURCE,
OBS_HOTKEY_REGISTERER_OUTPUT,
OBS_HOTKEY_REGISTERER_ENCODER,
OBS_HOTKEY_REGISTERER_SERVICE,
};
typedef enum obs_hotkey_registerer_type obs_hotkey_registerer_t;
EXPORT obs_hotkey_id obs_hotkey_get_id(const obs_hotkey_t *key);
EXPORT const char *obs_hotkey_get_name(const obs_hotkey_t *key);
EXPORT const char *obs_hotkey_get_description(const obs_hotkey_t *key);
EXPORT obs_hotkey_registerer_t obs_hotkey_get_registerer_type(
const obs_hotkey_t *key);
EXPORT void *obs_hotkey_get_registerer(const obs_hotkey_t *key);
EXPORT obs_hotkey_id obs_hotkey_get_pair_partner_id(const obs_hotkey_t *key);
EXPORT obs_key_combination_t obs_hotkey_binding_get_key_combination(
obs_hotkey_binding_t *binding);
EXPORT obs_hotkey_id obs_hotkey_binding_get_hotkey_id(
obs_hotkey_binding_t *binding);
EXPORT obs_hotkey_t *obs_hotkey_binding_get_hotkey(
obs_hotkey_binding_t *binding);
#ifndef SWIG
struct obs_hotkeys_translations {
const char *insert;
const char *del;
const char *home;
const char *end;
const char *page_up;
const char *page_down;
const char *num_lock;
const char *scroll_lock;
const char *caps_lock;
const char *backspace;
const char *tab;
const char *print;
const char *pause;
const char *left;
const char *right;
const char *up;
const char *down;
const char *shift;
const char *alt;
const char *control;
const char *meta; /* windows/super key */
const char *menu;
const char *space;
const char *numpad_num; /* For example, "Numpad %1" */
const char *numpad_divide;
const char *numpad_multiply;
const char *numpad_minus;
const char *numpad_plus;
const char *numpad_decimal;
const char *apple_keypad_num; /* For example, "%1 (Keypad)" */
const char *apple_keypad_divide;
const char *apple_keypad_multiply;
const char *apple_keypad_minus;
const char *apple_keypad_plus;
const char *apple_keypad_decimal;
const char *apple_keypad_equal;
const char *mouse_num; /* For example, "Mouse %1" */
};
/* This function is an optional way to provide translations for specific keys
* that may not have translations. If the operating system can provide
* translations for these keys, it will use the operating system's translation
* over these translations. If no translations are specified, it will use
* the default English translations for that specific operating system. */
EXPORT void obs_hotkeys_set_translations_s(
struct obs_hotkeys_translations *translations, size_t size);
#endif
#define obs_hotkeys_set_translations(translations) \
obs_hotkeys_set_translations_s(translations, \
sizeof(struct obs_hotkeys_translations))
EXPORT void obs_hotkeys_set_audio_hotkeys_translations(
const char *mute, const char *unmute,
const char *push_to_mute, const char *push_to_talk);
EXPORT void obs_hotkeys_set_sceneitem_hotkeys_translations(
const char *show, const char *hide);
/* registering hotkeys (giving hotkeys a name and a function) */
typedef void (*obs_hotkey_func)(void *data,
obs_hotkey_id id, obs_hotkey_t *hotkey, bool pressed);
EXPORT obs_hotkey_id obs_hotkey_register_frontend(const char *name,
const char *description, obs_hotkey_func func, void *data);
EXPORT obs_hotkey_id obs_hotkey_register_encoder(obs_encoder_t *encoder,
const char *name, const char *description,
obs_hotkey_func func, void *data);
EXPORT obs_hotkey_id obs_hotkey_register_output(obs_output_t *output,
const char *name, const char *description,
obs_hotkey_func func, void *data);
EXPORT obs_hotkey_id obs_hotkey_register_service(obs_service_t *service,
const char *name, const char *description,
obs_hotkey_func func, void *data);
EXPORT obs_hotkey_id obs_hotkey_register_source(obs_source_t *source,
const char *name, const char *description,
obs_hotkey_func func, void *data);
typedef bool (*obs_hotkey_active_func)(void *data,
obs_hotkey_pair_id id, obs_hotkey_t *hotkey, bool pressed);
EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_frontend(
const char *name0, const char *description0,
const char *name1, const char *description1,
obs_hotkey_active_func func0, obs_hotkey_active_func func1,
void *data0, void *data1);
EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_encoder(
obs_encoder_t *encoder,
const char *name0, const char *description0,
const char *name1, const char *description1,
obs_hotkey_active_func func0, obs_hotkey_active_func func1,
void *data0, void *data1);
EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_output(
obs_output_t *output,
const char *name0, const char *description0,
const char *name1, const char *description1,
obs_hotkey_active_func func0, obs_hotkey_active_func func1,
void *data0, void *data1);
EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_service(
obs_service_t *service,
const char *name0, const char *description0,
const char *name1, const char *description1,
obs_hotkey_active_func func0, obs_hotkey_active_func func1,
void *data0, void *data1);
EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_source(
obs_source_t *source,
const char *name0, const char *description0,
const char *name1, const char *description1,
obs_hotkey_active_func func0, obs_hotkey_active_func func1,
void *data0, void *data1);
EXPORT void obs_hotkey_unregister(obs_hotkey_id id);
EXPORT void obs_hotkey_pair_unregister(obs_hotkey_pair_id id);
/* loading hotkeys (associating a hotkey with a physical key and modifiers) */
EXPORT void obs_hotkey_load_bindings(obs_hotkey_id id,
obs_key_combination_t *combinations, size_t num);
EXPORT void obs_hotkey_load(obs_hotkey_id id, obs_data_array_t *data);
EXPORT void obs_hotkeys_load_encoder(obs_encoder_t *encoder,
obs_data_t *hotkeys);
EXPORT void obs_hotkeys_load_output(obs_output_t *output, obs_data_t *hotkeys);
EXPORT void obs_hotkeys_load_service(obs_service_t *service,
obs_data_t *hotkeys);
EXPORT void obs_hotkeys_load_source(obs_source_t *source, obs_data_t *hotkeys);
EXPORT void obs_hotkey_pair_load(obs_hotkey_pair_id id, obs_data_array_t *data0,
obs_data_array_t *data1);
EXPORT obs_data_array_t *obs_hotkey_save(obs_hotkey_id id);
EXPORT obs_data_t *obs_hotkeys_save_encoder(obs_encoder_t *encoder);
EXPORT obs_data_t *obs_hotkeys_save_output(obs_output_t *output);
EXPORT obs_data_t *obs_hotkeys_save_service(obs_service_t *service);
EXPORT obs_data_t *obs_hotkeys_save_source(obs_source_t *source);
/* enumerating hotkeys */
typedef bool (*obs_hotkey_enum_func)(void *data,
obs_hotkey_id id, obs_hotkey_t *key);
EXPORT void obs_enum_hotkeys(obs_hotkey_enum_func func, void *data);
/* enumerating bindings */
typedef bool (*obs_hotkey_binding_enum_func)(void *data,
size_t idx, obs_hotkey_binding_t* binding);
EXPORT void obs_enum_hotkey_bindings(obs_hotkey_binding_enum_func func,
void *data);
/* hotkey event control */
EXPORT void obs_hotkey_inject_event(obs_key_combination_t hotkey, bool pressed);
EXPORT void obs_hotkey_enable_background_press(bool enable);
EXPORT void obs_hotkey_enable_strict_modifiers(bool enable);
/* hotkey callback routing (trigger callbacks through e.g. a UI thread) */
typedef void (*obs_hotkey_callback_router_func)(void *data,
obs_hotkey_id id, bool pressed);
EXPORT void obs_hotkey_set_callback_routing_func(obs_hotkey_callback_router_func
func, void *data);
EXPORT void obs_hotkey_trigger_routed_callback(obs_hotkey_id id, bool pressed);
/* hotkey callbacks won't be processed if callback rerouting is enabled and no
* router func is set */
EXPORT void obs_hotkey_enable_callback_rerouting(bool enable);
/* misc */
typedef void (*obs_hotkey_atomic_update_func)(void *);
EXPORT void obs_hotkey_update_atomic(obs_hotkey_atomic_update_func func,
void *data);
struct dstr;
EXPORT void obs_key_to_str(obs_key_t key, struct dstr *str);
EXPORT void obs_key_combination_to_str(obs_key_combination_t key,
struct dstr *str);
EXPORT obs_key_t obs_key_from_virtual_key(int code);
EXPORT int obs_key_to_virtual_key(obs_key_t key);
EXPORT const char *obs_key_to_name(obs_key_t key);
EXPORT obs_key_t obs_key_from_name(const char *name);
static inline bool obs_key_combination_is_empty(obs_key_combination_t combo)
{
return !combo.modifiers && combo.key == OBS_KEY_NONE;
}
#ifdef __cplusplus
}
#endif
|