static obs_hotkey_pair_t *create_hotkey_pair(struct obs_context_data *context, obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, void *data1) { if ((obs->hotkeys.next_pair_id + 1) == OBS_INVALID_HOTKEY_PAIR_ID) blog(LOG_WARNING, "obs-hotkey: Available hotkey pair ids " "exhausted"); obs_hotkey_pair_t *base_addr = obs->hotkeys.hotkey_pairs.array; obs_hotkey_pair_t *pair = da_push_back_new(obs->hotkeys.hotkey_pairs); pair->pair_id = obs->hotkeys.next_pair_id++; pair->func[0] = func0; pair->func[1] = func1; pair->id[0] = OBS_INVALID_HOTKEY_ID; pair->id[1] = OBS_INVALID_HOTKEY_ID; pair->data[0] = data0; pair->data[1] = data1; if (context) da_push_back(context->hotkey_pairs, &pair->pair_id); if (base_addr != obs->hotkeys.hotkey_pairs.array) fixup_pair_pointers(); return pair; }
void gs_viewport_push(void) { if (!thread_graphics) return; struct gs_rect *rect = da_push_back_new( thread_graphics->viewport_stack); gs_getviewport(rect); }
static inline void create_binding(obs_hotkey_t *hotkey, obs_key_combination_t combo) { obs_hotkey_binding_t *binding = da_push_back_new(obs->hotkeys.bindings); if (!binding) return; binding->key = combo; binding->hotkey_id = hotkey->id; binding->hotkey = hotkey; }
bool cf_lexer_lex(struct cf_lexer *lex, const char *str, const char *file) { struct cf_token token; struct cf_token *last_token = NULL; cf_lexer_free(lex); if (!str || !*str) return false; if (file) lex->file = bstrdup(file); lexer_start(&lex->base_lexer, str); cf_token_clear(&token); lex->reformatted = bmalloc(strlen(str) + 1); lex->reformatted[0] = 0; lex->write_offset = lex->reformatted; while (cf_lexer_nexttoken(lex, &token)) { if (last_token && is_space_or_tab(*last_token->str.array) && is_space_or_tab(*token.str.array)) { cf_token_add(last_token, &token); continue; } token.lex = lex; last_token = da_push_back_new(lex->tokens); memcpy(last_token, &token, sizeof(struct cf_token)); } cf_token_clear(&token); token.str.array = lex->write_offset; token.unmerged_str.array = lex->base_lexer.offset; token.lex = lex; da_push_back(lex->tokens, &token); return !lex->unexpected_eof; }
static inline obs_hotkey_id obs_hotkey_register_internal( obs_hotkey_registerer_t type, void *registerer, struct obs_context_data *context, const char *name, const char *description, obs_hotkey_func func, void *data) { if ((obs->hotkeys.next_id + 1) == OBS_INVALID_HOTKEY_ID) blog(LOG_WARNING, "obs-hotkey: Available hotkey ids exhausted"); obs_hotkey_t *base_addr = obs->hotkeys.hotkeys.array; obs_hotkey_id result = obs->hotkeys.next_id++; obs_hotkey_t *hotkey = da_push_back_new(obs->hotkeys.hotkeys); hotkey->id = result; hotkey->name = bstrdup(name); hotkey->description = bstrdup(description); hotkey->func = func; hotkey->data = data; hotkey->registerer_type = type; hotkey->registerer = registerer; hotkey->pair_partner_id = OBS_INVALID_HOTKEY_PAIR_ID; if (context) { obs_data_array_t *data = obs_data_get_array(context->hotkey_data, name); load_bindings(hotkey, data); obs_data_array_release(data); context_add_hotkey(context, result); } if (base_addr != obs->hotkeys.hotkeys.array) fixup_pointers(); hotkey_signal("hotkey_register", hotkey); return result; }