exampleClient: add keyboard repeat info handler, intialize xkb_context 84/241784/1
authorSung-Jin Park <sj76.park@samsung.com>
Tue, 11 Aug 2020 12:13:27 +0000 (21:13 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:10:42 +0000 (19:10 +0900)
Change-Id: I873528fc2af4df77def400bf6e61604d32980e27
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
samples/exampleClient.c

index dc6d708..8a9edd0 100644 (file)
@@ -99,7 +99,7 @@ keyboard_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int f
 
        printf("...WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1=%d, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP=%d\n",
                        WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP);
-       printf("... format=%d, fd=%d, size=%d\n",  format, fd, size);
+       printf("[Keyboard Keymap] ... format=%d, fd=%d, size=%d\n",  format, fd, size);
 
        if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
        {
@@ -139,7 +139,7 @@ keyboard_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct
        (void) surface;
        (void) keys;
 
-       printf("... serial=%d\n",  serial);
+       printf("[Keyboard Enter] ... serial=%d\n",  serial);
 }
 
 static void
@@ -150,7 +150,7 @@ keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct
        (void) serial;
        (void) surface;
 
-       printf("... serial=%d\n",  serial);
+       printf("[Keyboard Leave] ... serial=%d\n",  serial);
 }
 
 static void
@@ -163,7 +163,7 @@ keyboard_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t
        (void) key;
        (void) state;
 
-       printf("... serial=%d, time=%d, key=%d, state=%d\n", serial, time, key, state);
+       printf("[Keyboard Key]... serial=%d, time=%d, key=%d, state=%d\n", serial, time, key, state);
 }
 
 static void
@@ -177,7 +177,16 @@ keyboard_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, ui
        (void) mods_locked;
        (void) group;
 
-       printf("... serial=%d, mods_depressed=%d, mods_latched=%d, mods_locked=%d, group=%d\n", serial, mods_depressed, mods_latched, mods_locked, group);
+       printf("[Keyboard Modifiers]... serial=%d, mods_depressed=%d, mods_latched=%d, mods_locked=%d, group=%d\n", serial, mods_depressed, mods_latched, mods_locked, group);
+}
+
+ static void
+keyboard_repeatinfo(void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay)
+{
+       (void) data;
+       (void) keyboard;
+
+       printf("... repeat rate=%u, repeat delay=%u\n", rate, delay);
 }
 
 static void
@@ -260,7 +269,8 @@ static const struct wl_keyboard_listener keyboard_listener = {
        keyboard_enter,
        keyboard_leave,
        keyboard_key,
-       keyboard_modifiers
+       keyboard_modifiers,
+       keyboard_repeatinfo
 };
 
 static void
@@ -479,6 +489,8 @@ _zxdg_v6_shell_surface_create(struct wl_surface *surface)
 
 int main(int argc, char **argv) {
 
+       xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+
        display = wl_display_connect(NULL);
 
        if (display == NULL)