![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include <cassert>#include <cctype>#include <chrono>#include <climits>#include <cmath>#include <condition_variable>#include <csignal>#include <cstdio>#include <cstdlib>#include <cstring>#include <ctime>#include <iomanip>#include <iostream>#include <map>#include <mutex>#include <queue>#include <set>#include <sstream>#include <string>#include <thread>#include <utility>#include <sys/select.h>#include "compat/time.h"#include "debug.h"#include "host.h"#include "keyboard_control.h"#include "messaging.h"#include "module.h"#include "types.h"#include "utils/color_out.h"#include "utils/thread.h"#include "video.h"#include <conio.h>
Go to the source code of this file.
Classes | |
| class | keyboard_control::impl |
| struct | keyboard_control::impl::m_mod |
Macros | |
| #define | CHECK_EOF(x) |
| #define | CONFIG_FILE "ug-key-map.txt" |
| #define | G(key) |
| #define | GETCH getch |
| #define | MOD_NAME "[key control] " |
Functions | |
| ADD_TO_PARAM ("disable-keyboard-control", "* disable-keyboard-control[=no]\n" " disables keyboard control (usable mainly for non-interactive runs)\n") | |
| static int | count_utf8_bytes (unsigned int i) |
| static int64_t | get_ansi_code () |
| void | get_keycode_name (int64_t ch, char *buf, size_t buflen) |
| static string | get_keycode_representation (int64_t ch) |
| static int64_t | get_utf8_code (int c) |
| static string | get_utf8_representation (int64_t ch) |
| static bool | is_utf8 (int64_t ch) |
| bool | keycontrol_register_key (struct module *receiver_mod, int64_t key, const char *message, const char *description) |
| Registers callback message for given key. | |
| void | keycontrol_send_key (struct module *root, int64_t key) |
| static void | print_start_elapsed_time (time_t start_time) |
| void | restore_old_tio (void) |
| static bool | set_tio () |
With code taken from Olivier Mehani (set_tio()).
Definition in file keyboard_control.cpp.
| #define CHECK_EOF | ( | x | ) |
Definition at line 319 of file keyboard_control.cpp.
Referenced by get_ansi_code(), keyboard_control::impl::get_next_key(), and get_utf8_code().
| #define CONFIG_FILE "ug-key-map.txt" |
Definition at line 102 of file keyboard_control.cpp.
Referenced by keyboard_control::impl::exec_local_command(), and keyboard_control::impl::load_config_map().
| #define G | ( | key | ) |
Definition at line 808 of file keyboard_control.cpp.
| #define GETCH getch |
Definition at line 316 of file keyboard_control.cpp.
Referenced by get_ansi_code(), keyboard_control::impl::get_next_key(), and get_utf8_code().
| #define MOD_NAME "[key control] " |
Definition at line 103 of file keyboard_control.cpp.
| ADD_TO_PARAM | ( | "disable-keyboard-control" | , |
| "* disable-keyboard-control\n" " disables keyboard control (usable mainly for non-interactive runs)\n" | [=no] ) |
|
static |
Definition at line 380 of file keyboard_control.cpp.
References count.
Referenced by get_utf8_code().
|
static |
Tries to parse at least some small subset of ANSI control sequences not to be ArrowUp interpreted as '\033', '[' and 'A' individually.
| <0 | on error |
Definition at line 340 of file keyboard_control.cpp.
References CHECK_EOF, debug_msg, GETCH, K_ALT, LOG, LOG_LEVEL_WARNING, and MOD_NAME.
Referenced by keyboard_control::impl::get_next_key().
| void get_keycode_name | ( | int64_t | ch, |
| char * | buf, | ||
| size_t | buflen ) |
Definition at line 1063 of file keyboard_control.cpp.
References get_keycode_representation(), and name.
Referenced by gl_show_help(), and glfw_key_callback().

|
static |
Definition at line 453 of file keyboard_control.cpp.
References get_utf8_representation(), is_utf8(), K_CTRL_DOWN, K_CTRL_UP, K_DOWN, K_LEFT, K_PGDOWN, K_PGUP, K_RIGHT, and K_UP.
Referenced by keyboard_control::impl::exec_local_command(), get_keycode_name(), keyboard_control::impl::run(), and keyboard_control::impl::usage().

|
static |
| <0 | on error |
Definition at line 390 of file keyboard_control.cpp.
References CHECK_EOF, count_utf8_bytes(), debug_msg, GETCH, LOG, LOG_LEVEL_WARNING, and MOD_NAME.
Referenced by keyboard_control::impl::get_next_key().

|
static |
Definition at line 443 of file keyboard_control.cpp.
Referenced by get_keycode_representation().
|
static |
Definition at line 426 of file keyboard_control.cpp.
Referenced by get_keycode_representation().
| bool keycontrol_register_key | ( | struct module * | receiver_mod, |
| int64_t | key, | ||
| const char * | message, | ||
| const char * | description ) |
Registers callback message for given key.
message_universal message type is always sent
| [in] | sender_mod | module that should receive the message for key |
| [in] | message | text that will be passed back to receiver_mod if key was pressed |
| [in] | description | optional decription that will be displayed in keyboard control help (may be NULL) |
Definition at line 1041 of file keyboard_control.cpp.
References description, free_response(), get_root_module(), key, LOG_LEVEL_ERROR, log_msg(), MOD_NAME, module_get_path_str(), new_message(), response_get_status(), RESPONSE_OK, SEND_MESSAGE_FLAG_NO_STORE, SEND_MESSAGE_FLAG_QUIET, send_message_sync(), and msg_universal::text.
Referenced by display_gl_init(), display_sdl2_init(), display_sdl_init(), and playback_register_keyboard_ctl().

| void keycontrol_send_key | ( | struct module * | root, |
| int64_t | key ) |
Definition at line 1024 of file keyboard_control.cpp.
References free_response(), key, LOG_LEVEL_ERROR, log_msg(), MOD_NAME, new_message(), response_get_status(), RESPONSE_OK, SEND_MESSAGE_FLAG_NO_STORE, SEND_MESSAGE_FLAG_QUIET, send_message_sync(), and msg_universal::text.
Referenced by display_sdl2_run(), and glfw_key_callback().

|
static |
Definition at line 696 of file keyboard_control.cpp.
References gmtime_s, localtime_s, keyboard_control::start(), start_time, and TBOLD.
Referenced by keyboard_control::impl::info().

| void restore_old_tio | ( | void | ) |
Definition at line 188 of file keyboard_control.cpp.
Referenced by crash_signal_handler(), keyboard_control::impl::read_command(), and keyboard_control::impl::start().
|
static |
From http://shtrom.ssji.net/skb/getc.html
Definition at line 982 of file keyboard_control.cpp.
Referenced by keyboard_control::impl::read_command(), and keyboard_control::impl::start().