4 #include "npv/c_fixing.h"
5 /* NotoSansSymbols2 is the only one with the play and pause symbols */
6 STATIC u8
*npv_faces
[] = {
7 "/share/fonts/noto/NotoMono-Regular.ttf",
8 "/share/fonts/noto/NotoSansSymbols-Regular.ttf",
9 "/share/fonts/noto/NotoSansSymbols2-Regular.ttf",
10 "/usr/share/fonts/truetype/noto/NotoMono-Regular.ttf",
11 "/usr/share/fonts/truetype/noto/NotoSansSymbols-Regular.ttf",
12 "/usr/share/fonts/truetype/noto/NotoSansSymbols2-Regular.ttf",
15 /* we don't use a xkb state machine, only bear 8bits truncated raw keycodes */
16 /*----------------------------------------------------------------------------*/
17 STATIC
void npv_cmd_quit(void);
18 STATIC
void npv_cmd_rewind(void);
19 STATIC
void npv_cmd_fastforward(void);
20 STATIC
void npv_cmd_rewind_big(void);
21 STATIC
void npv_cmd_fastforward_big(void);
22 STATIC
void npv_cmd_vol_up(void);
23 STATIC
void npv_cmd_vol_down(void);
24 STATIC
void npv_cmd_mute(void);
25 STATIC
void npv_cmd_osd_timer_toggle(void);
26 STATIC
void npv_cmd_pause(void);
27 STATIC
void npv_cmd_fullscreen_toggle(void);
28 /*----------------------------------------------------------------------------*/
29 /* for documentation and example */
30 #define LINUX_KEY_ESC 0x01
31 #define LINUX_KEY_SPACE 0x39
32 /* x11 keycodes do offset linux keycodes by 8 */
33 #define X11_KEYCODE_ESC (LINUX_KEY_ESC + 8)
34 #define X11_KEYCODE_SPACE (LINUX_KEY_SPACE + 8)
35 /*----------------------------------------------------------------------------*/
36 struct npv_x11_bind_t
{
37 u8 keycode
; /* the 8bits truncated raw keycode */
38 u8
*name
; /* friendly name */
39 void (*cmd
)(void); /* bound cmd */
41 #define X11_BIND(x, y, z) {.keycode = x, .name = y, .cmd = z}
42 struct npv_x11_bind_t npv_x11_binds
[] = {
43 X11_BIND(X11_KEYCODE_ESC
, "escape", npv_cmd_quit
),
44 X11_BIND(X11_KEYCODE_SPACE
, "space", npv_cmd_pause
),
45 X11_BIND(0x71, "arrow left", npv_cmd_rewind
),
46 X11_BIND(0x72, "arrow right", npv_cmd_fastforward
),
47 X11_BIND(0x6e, "home", npv_cmd_rewind_big
),
48 X11_BIND(0x73, "end", npv_cmd_fastforward_big
),
49 X11_BIND(0x6f, "arrow up", npv_cmd_vol_up
),
50 X11_BIND(0x74, "arrow down", npv_cmd_vol_down
),
51 X11_BIND(0x48, "f6", npv_cmd_mute
),
52 X11_BIND(0x43, "f1", npv_cmd_osd_timer_toggle
),
53 X11_BIND(0x5f, "f11", npv_cmd_fullscreen_toggle
)
57 #undef LINUX_KEY_SPACE
58 #undef X11_KEYCODE_ESC
59 #undef X11_KEYCODE_SPACE
60 /*----------------------------------------------------------------------------*/
61 #define VOL_DELTA 0.1 /* from 0.0 to 1.0 */
62 #define SEEK_DELTA INT64_C(10) /* 10 seconds */
63 #define SEEK_DELTA_BIG (INT64_C(4) * INT64_C(60)) /* 4 minutes */