Подсказка при запуске
This commit is contained in:
@@ -9,10 +9,10 @@ void keyboard_key_handle(xkb_keycode_t kc, xkb_keysym_t ks, enum keyboard_key_st
|
||||
char buf[64];
|
||||
int n = xkb_keysym_to_utf8(ks, buf, sizeof(buf));
|
||||
|
||||
if (n > 0)
|
||||
printf("keyboard: symbol '%s' (keysym 0x%x) on surface:%p\n", buf, ks, window);
|
||||
else
|
||||
printf("keyboard: keysym 0x%x (no UTF-8 representation)\n", ks);
|
||||
// if (n > 0)
|
||||
// printf("keyboard: symbol '%s' (keysym 0x%x) on surface:%p\n", buf, ks, window);
|
||||
// else
|
||||
// printf("keyboard: keysym 0x%x (no UTF-8 representation)\n", ks);
|
||||
|
||||
if(state != KEYBOARD_KEY_STATE_RELEASED)
|
||||
{
|
||||
|
||||
@@ -70,14 +70,12 @@ static void keyboard_keymap(void *data, struct wl_keyboard *keyboard, uint32_t f
|
||||
|
||||
static void keyboard_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
|
||||
{
|
||||
printf("keyboard: enter serial=%u surface=%p\n", serial, surface);
|
||||
/* Сохраняем поверхность, которая получила фокус клавиатуры */
|
||||
focused_window = get_window_by_surface(surface);
|
||||
}
|
||||
|
||||
static void keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
|
||||
{
|
||||
printf("keyboard: leave serial=%u surface=%p\n", serial, surface);
|
||||
/* Если уходим с фокусной поверхности — сбросить фокус */
|
||||
if (focused_window && focused_window->wl_surface == surface)
|
||||
focused_window = NULL;
|
||||
@@ -100,7 +98,6 @@ static void keyboard_key(void *data, struct wl_keyboard *keyboard, uint32_t seri
|
||||
|
||||
static void keyboard_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
printf("keyboard: modifiers serial=%u depressed=%u latched=%u locked=%u group=%u\n", serial, mods_depressed, mods_latched, mods_locked, group);
|
||||
if (xkb_state)
|
||||
{
|
||||
xkb_state_update_mask(xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
|
||||
@@ -109,7 +106,6 @@ static void keyboard_modifiers(void *data, struct wl_keyboard *keyboard, uint32_
|
||||
|
||||
static void keyboard_repeat_info(void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay)
|
||||
{
|
||||
printf("keyboard: repeat rate=%d delay=%d\n", rate, delay);
|
||||
}
|
||||
|
||||
static const struct wl_keyboard_listener keyboard_listener = {
|
||||
|
||||
@@ -178,6 +178,20 @@ int32_t init_wayland(void)
|
||||
atomic_store(&g_shutdown, 0);
|
||||
atomic_store(&g_active_threads, 0);
|
||||
g_initialized = 1;
|
||||
|
||||
/* Print keyboard help to the console so users know available shortcuts and
|
||||
* behaviors. This mirrors the handling implemented in
|
||||
* `input-handle.c` and acts as a quick usage hint. */
|
||||
printf("\nKeyboard shortcuts and behavior:\n");
|
||||
printf(" - Enter: open a new window\n");
|
||||
printf(" - 1: switch to circle figure\n");
|
||||
printf(" - 2: switch to triangle figure\n");
|
||||
printf(" - 3: switch to square figure\n");
|
||||
printf(" - - : decrease animation speed (clamped, multiplicative)\n");
|
||||
printf(" - + or = : increase animation speed (clamped, multiplicative)\n");
|
||||
printf(" - Up arrow: increase figure radius (clamped to window bounds)\n");
|
||||
printf(" - Down arrow: decrease figure radius (minimum 1.0)\n");
|
||||
printf(" Note: actions are triggered on key press (not on release).\n\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user