7 #include <wayland-client.h>
8 #include <xkbcommon/xkbcommon.h>
9 #include <linux/input.h>
11 #include <input-method-client-protocol.h>
12 #include <text-client-protocol.h>
18 KEYBOARD_STATE_DEFAULT,
19 KEYBOARD_STATE_UPPERCASE,
20 KEYBOARD_STATE_SYMBOLS
25 struct wl_display *display;
26 struct wl_registry *registry;
27 struct wl_compositor *compositor;
28 struct wl_event_queue *queue;
36 struct zwp_input_method_manager_v1 *input_method_mgr;
37 struct zwp_input_method_v1 *input_method;
38 struct zwp_input_method_context_v1 *context;
41 uint32_t preedit_style;
43 xkb_mod_mask_t shift_mask;
46 uint32_t content_hint;
47 int32_t content_purpose;
48 char *preferred_language;
49 char *surrounding_text;
50 uint32_t surrounding_cursor;
51 enum keyboard_state state; //struct keyboard *keyboard;
53 //struct zwp_input_panel_surface_v1 *ips;
57 const struct key *keys;
64 uint32_t text_direction;
83 enum key_type key_type;
92 static const struct key normal_keys[] = {
93 { keytype_default, "q", "Q", "1", 1},
94 { keytype_default, "w", "W", "2", 1},
95 { keytype_default, "e", "E", "3", 1},
96 { keytype_default, "r", "R", "4", 1},
97 { keytype_default, "t", "T", "5", 1},
98 { keytype_default, "y", "Y", "6", 1},
99 { keytype_default, "u", "U", "7", 1},
100 { keytype_default, "i", "I", "8", 1},
101 { keytype_default, "o", "O", "9", 1},
102 { keytype_default, "p", "P", "0", 1},
103 { keytype_backspace, "<--", "<--", "<--", 2},
105 { keytype_tab, "->|", "->|", "->|", 1},
106 { keytype_default, "a", "A", "-", 1},
107 { keytype_default, "s", "S", "@", 1},
108 { keytype_default, "d", "D", "*", 1},
109 { keytype_default, "f", "F", "^", 1},
110 { keytype_default, "g", "G", ":", 1},
111 { keytype_default, "h", "H", ";", 1},
112 { keytype_default, "j", "J", "(", 1},
113 { keytype_default, "k", "K", ")", 1},
114 { keytype_default, "l", "L", "~", 1},
115 { keytype_enter, "Enter", "Enter", "Enter", 2},
117 { keytype_switch, "ABC", "abc", "ABC", 2},
118 { keytype_default, "z", "Z", "/", 1},
119 { keytype_default, "x", "X", "\'", 1},
120 { keytype_default, "c", "C", "\"", 1},
121 { keytype_default, "v", "V", "+", 1},
122 { keytype_default, "b", "B", "=", 1},
123 { keytype_default, "n", "N", "?", 1},
124 { keytype_default, "m", "M", "!", 1},
125 { keytype_default, ",", ",", "\\", 1},
126 { keytype_default, ".", ".", "|", 1},
127 { keytype_switch, "ABC", "abc", "ABC", 1},
129 { keytype_symbols, "?123", "?123", "abc", 1},
130 { keytype_space, "", "", "", 5},
131 { keytype_arrow_up, "/\\", "/\\", "/\\", 1},
132 { keytype_arrow_left, "<", "<", "<", 1},
133 { keytype_arrow_right, ">", ">", ">", 1},
134 { keytype_arrow_down, "\\/", "\\/", "\\/", 1},
135 { keytype_style, "", "", "", 2}
138 static const struct key numeric_keys[] = {
139 { keytype_default, "1", "1", "1", 1},
140 { keytype_default, "2", "2", "2", 1},
141 { keytype_default, "3", "3", "3", 1},
142 { keytype_default, "4", "4", "4", 1},
143 { keytype_default, "5", "5", "5", 1},
144 { keytype_default, "6", "6", "6", 1},
145 { keytype_default, "7", "7", "7", 1},
146 { keytype_default, "8", "8", "8", 1},
147 { keytype_default, "9", "9", "9", 1},
148 { keytype_default, "0", "0", "0", 1},
149 { keytype_backspace, "<--", "<--", "<--", 2},
151 { keytype_space, "", "", "", 4},
152 { keytype_enter, "Enter", "Enter", "Enter", 2},
153 { keytype_arrow_up, "/\\", "/\\", "/\\", 1},
154 { keytype_arrow_left, "<", "<", "<", 1},
155 { keytype_arrow_right, ">", ">", ">", 1},
156 { keytype_arrow_down, "\\/", "\\/", "\\/", 1},
157 { keytype_style, "", "", "", 2}
160 static const struct layout normal_layout = {
162 sizeof(normal_keys) / sizeof(*normal_keys),
166 WL_TEXT_INPUT_TEXT_DIRECTION_LTR
169 static const struct layout numeric_layout = {
171 sizeof(numeric_keys) / sizeof(*numeric_keys),
175 WL_TEXT_INPUT_TEXT_DIRECTION_LTR
178 struct display data_wl;
180 request_key(uint32_t time, const struct key *key, enum wl_pointer_button_state state);
185 printf(" This is virtual keyboard. (refer to weston/clients/keyboard.c)\n");
189 static const struct layout *
190 get_current_layout(void)
192 switch (data_wl.content_purpose) {
193 case WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS:
194 case WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER:
195 return &numeric_layout;
197 return &normal_layout;
205 char buf[MAX_STR] = {0, }, *tmp, *buf_ptr;
207 static uint32_t time = 12345;
208 const struct layout *layout;
209 uint32_t key_type = 0, key_idx = 0;
211 while ((c = getchar()) != EOF) {
212 if (c == '\n') break;
213 if (count >= MAX_STR) break;
220 tmp = strtok_r(buf, " ", &buf_ptr);
223 if (!strncmp(buf, "q", MAX_STR) || !strncmp(buf, "quit", MAX_STR)) {
225 } else if (!strncmp(buf, "help", MAX_STR)) {
227 } else if (!strncmp(buf, "log", MAX_STR)) {
228 if (data_wl.enable_log)
229 printf("Disable detailed logs\n");
231 printf("Enable detailed logs\n");
233 data_wl.enable_log = !data_wl.enable_log;
234 } else if (!strncmp(tmp, "key", MAX_STR)) {
236 tmp = strtok_r(NULL, " ", &buf_ptr);
243 key_type = atoi(tmp);
251 if (data_wl.enable_log)
252 printf("request key() key_idx:%u, key_type:%u\n", key_idx, key_type);
254 layout = get_current_layout();
255 request_key(time++, &layout->keys[key_idx], key_type);
258 printf("Invalid arguments\n");
264 prev_utf8_char(const char *s, const char *p)
266 for (--p; p >= s; --p) {
267 if ((*p & 0xc0) != 0x80)
274 delete_before_cursor(void)
276 const char *start, *end;
278 if (!data_wl.surrounding_text) {
279 printf("delete_before_cursor: No surrounding text available\n");
283 start = prev_utf8_char(data_wl.surrounding_text,
284 data_wl.surrounding_text + data_wl.surrounding_cursor);
286 printf("delete_before_cursor: No previous character to delete\n");
290 end = data_wl.surrounding_text + data_wl.surrounding_cursor;
292 zwp_input_method_context_v1_delete_surrounding_text(data_wl.context,
293 (start - data_wl.surrounding_text) - data_wl.surrounding_cursor,
295 zwp_input_method_context_v1_commit_string(data_wl.context,
299 /* Update surrounding text */
300 data_wl.surrounding_cursor = start - data_wl.surrounding_text;
301 data_wl.surrounding_text[data_wl.surrounding_cursor] = '\0';
303 memmove(data_wl.surrounding_text + data_wl.surrounding_cursor, end, strlen(end));
307 append(char *s1, const char *s2)
314 s = realloc(s1, len1 + len2 + 1);
316 printf("alloc fail");
319 memcpy(s + len1, s2, len2);
320 s[len1 + len2] = '\0';
326 request_preedit(int32_t cursor)
328 printf("request_preedit() preedit_string:%s\n", data_wl.preedit_string);
329 uint32_t index = strlen(data_wl.preedit_string);
331 if (!data_wl.context) return;
333 if (data_wl.preedit_style)
334 zwp_input_method_context_v1_preedit_styling(data_wl.context,
336 strlen(data_wl.preedit_string),
337 data_wl.preedit_style);
340 zwp_input_method_context_v1_preedit_cursor(data_wl.context,
342 zwp_input_method_context_v1_preedit_string(data_wl.context,
344 data_wl.preedit_string,
345 data_wl.preedit_string);
349 insert_text(const char *text, uint32_t offset, const char *insert)
351 int tlen = strlen(text), ilen = strlen(insert);
352 char *new_text = NULL;
354 new_text = malloc(tlen + ilen + 1);
355 if (new_text == NULL) {
356 printf("alloc fail");
360 memcpy(new_text, text, offset);
361 memcpy(new_text + offset, insert, ilen);
362 memcpy(new_text + offset + ilen, text + offset, tlen - offset);
363 new_text[tlen + ilen] = '\0';
369 request_commit_string(void)
371 char *surrounding_text;
373 printf("request_commit_string()\n");
375 if (!data_wl.preedit_string ||
376 strlen(data_wl.preedit_string) == 0)
378 printf("request_commit_string() preedit_string:%s\n", data_wl.preedit_string);
380 if (!data_wl.context) return;
382 zwp_input_method_context_v1_cursor_position(data_wl.context,
384 zwp_input_method_context_v1_commit_string(data_wl.context,
386 data_wl.preedit_string);
388 if (data_wl.surrounding_text) {
389 surrounding_text = insert_text(data_wl.surrounding_text,
390 data_wl.surrounding_cursor,
391 data_wl.preedit_string);
392 free(data_wl.surrounding_text);
393 data_wl.surrounding_text = surrounding_text;
394 data_wl.surrounding_cursor += strlen(data_wl.preedit_string);
396 data_wl.surrounding_text = strdup(data_wl.preedit_string);
397 data_wl.surrounding_cursor = strlen(data_wl.preedit_string);
400 free(data_wl.preedit_string);
401 data_wl.preedit_string = strdup("");
405 request_key(uint32_t time, const struct key *key, enum wl_pointer_button_state state)
407 const char *label = NULL;
408 static uint32_t serial = 9999;
410 switch(data_wl.state) {
411 case KEYBOARD_STATE_DEFAULT :
414 case KEYBOARD_STATE_UPPERCASE :
415 label = key->uppercase;
417 case KEYBOARD_STATE_SYMBOLS :
425 xkb_mod_mask_t mod_mask = data_wl.state == KEYBOARD_STATE_DEFAULT ? 0 : data_wl.keysym.shift_mask;
426 uint32_t key_state = (state == WL_POINTER_BUTTON_STATE_PRESSED) ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED;
428 printf("request_key() data_wl.state:%d, key->key_type:%d, pressed:%u, label:%s\n", data_wl.state, key->key_type, key_state, label);
429 switch (key->key_type) {
430 case keytype_default:
431 if (state != WL_POINTER_BUTTON_STATE_PRESSED)
434 printf("request_key() keytype_default. append label(%s) to preedit_string(%s)\n", label, data_wl.preedit_string);
435 data_wl.preedit_string =
436 append(data_wl.preedit_string,
440 case keytype_backspace:
441 if (state != WL_POINTER_BUTTON_STATE_PRESSED)
444 if (strlen(data_wl.preedit_string) == 0) {
445 delete_before_cursor();
447 data_wl.preedit_string[strlen(data_wl.preedit_string) - 1] = '\0';
452 request_commit_string();
454 if (!data_wl.context) break;
455 zwp_input_method_context_v1_keysym(data_wl.context,
458 XKB_KEY_Return, key_state, mod_mask);
461 if (state != WL_POINTER_BUTTON_STATE_PRESSED)
463 data_wl.preedit_string =
464 append(data_wl.preedit_string, " ");
465 request_commit_string();
468 if (state != WL_POINTER_BUTTON_STATE_PRESSED)
470 switch(data_wl.state) {
471 case KEYBOARD_STATE_DEFAULT:
472 data_wl.state = KEYBOARD_STATE_UPPERCASE;
474 case KEYBOARD_STATE_UPPERCASE:
475 data_wl.state = KEYBOARD_STATE_DEFAULT;
477 case KEYBOARD_STATE_SYMBOLS:
478 data_wl.state = KEYBOARD_STATE_UPPERCASE;
482 case keytype_symbols:
483 if (state != WL_POINTER_BUTTON_STATE_PRESSED)
485 switch(data_wl.state) {
486 case KEYBOARD_STATE_DEFAULT:
487 data_wl.state = KEYBOARD_STATE_SYMBOLS;
489 case KEYBOARD_STATE_UPPERCASE:
490 data_wl.state = KEYBOARD_STATE_SYMBOLS;
492 case KEYBOARD_STATE_SYMBOLS:
493 data_wl.state = KEYBOARD_STATE_DEFAULT;
498 request_commit_string();
499 if (!data_wl.context) break;
500 zwp_input_method_context_v1_keysym(data_wl.context,
503 XKB_KEY_Tab, key_state, mod_mask);
505 case keytype_arrow_up:
506 request_commit_string();
507 if (!data_wl.context) break;
508 zwp_input_method_context_v1_keysym(data_wl.context,
511 XKB_KEY_Up, key_state, mod_mask);
513 case keytype_arrow_left:
514 request_commit_string();
515 if (!data_wl.context) break;
516 zwp_input_method_context_v1_keysym(data_wl.context,
519 XKB_KEY_Left, key_state, mod_mask);
521 case keytype_arrow_right:
522 request_commit_string();
523 if (!data_wl.context) break;
524 zwp_input_method_context_v1_keysym(data_wl.context,
527 XKB_KEY_Right, key_state, mod_mask);
529 case keytype_arrow_down:
530 request_commit_string();
531 if (!data_wl.context) break;
532 zwp_input_method_context_v1_keysym(data_wl.context,
535 XKB_KEY_Down, key_state, mod_mask);
538 if (state != WL_POINTER_BUTTON_STATE_PRESSED)
540 data_wl.preedit_style = (data_wl.preedit_style + 1) % 8; /* TODO */
547 im_context_cb_surrounding_text (void *data, struct zwp_input_method_context_v1 *im_ctx, const char *text, uint32_t cursor, uint32_t anchor)
549 printf("im_context_cb_surrounding_text\n");
550 free(data_wl.surrounding_text);
551 data_wl.surrounding_text = strdup(text);
553 data_wl.surrounding_cursor = cursor;
557 im_context_cb_reset (void *data, struct zwp_input_method_context_v1 *im_ctx)
559 printf("im_context_cb_reset\n");
561 if (strlen(data_wl.preedit_string)) {
562 free(data_wl.preedit_string);
563 data_wl.preedit_string = strdup("");
568 im_context_cb_content_type (void *data, struct zwp_input_method_context_v1 *im_ctx, uint32_t hint, uint32_t purpose)
570 printf("im_context_cb_content_type\n");
572 data_wl.content_hint = hint;
573 data_wl.content_purpose = purpose;
577 im_context_cb_invoke_action (void *data, struct zwp_input_method_context_v1 *im_ctx, uint32_t button, uint32_t index)
579 printf("im_context_cb_invoke_action\n");
581 if (button != BTN_LEFT)
584 request_preedit(index);
588 im_context_cb_commit_state (void *data, struct zwp_input_method_context_v1 *context, uint32_t serial)
590 printf("im_context_cb_commit_state\n");
592 const struct layout *layout;
594 data_wl.serial = serial;
596 layout = get_current_layout();
598 if (data_wl.surrounding_text)
599 printf("Surrounding text updated: %s\n", data_wl.surrounding_text);
601 if (!context) return;
602 zwp_input_method_context_v1_language(context,
605 zwp_input_method_context_v1_text_direction(context,
607 layout->text_direction);
611 im_context_cb_preferred_language (void *data, struct zwp_input_method_context_v1 *context, const char *language)
613 printf("im_context_cb_preferred_language\n");
615 if (data_wl.preferred_language)
616 free(data_wl.preferred_language);
618 data_wl.preferred_language = NULL;
621 data_wl.preferred_language = strdup(language);
624 static const struct zwp_input_method_context_v1_listener input_method_context_cb_listener = {
625 .surrounding_text = im_context_cb_surrounding_text,
626 .reset = im_context_cb_reset,
627 .content_type = im_context_cb_content_type,
628 .invoke_action = im_context_cb_invoke_action,
629 .commit_state = im_context_cb_commit_state,
630 .preferred_language = im_context_cb_preferred_language,
632 .return_key_type = NULL,
633 .return_key_disabled = NULL,
634 .input_panel_data = NULL,
635 .bidi_direction = NULL,
636 .cursor_position = NULL,
637 .process_input_device_event = NULL,
638 .filter_key_event = NULL,
639 .capital_mode = NULL,
640 .prediction_hint = NULL,
642 .finalized_content = NULL,
643 .prediction_hint_data = NULL,
644 .input_panel_enabled = NULL,
648 keysym_modifiers_add(struct wl_array *modifiers_map,
651 size_t len = strlen(name) + 1;
654 p = wl_array_add(modifiers_map, len);
659 strncpy(p, name, len);
662 static xkb_mod_index_t
663 keysym_modifiers_get_index(struct wl_array *modifiers_map,
666 xkb_mod_index_t index = 0;
667 char *p = modifiers_map->data;
669 while ((const char *)p < (const char *)(modifiers_map->data + modifiers_map->size)) {
670 if (strcmp(p, name) == 0)
677 return XKB_MOD_INVALID;
681 keysym_modifiers_get_mask(struct wl_array *modifiers_map,
684 xkb_mod_index_t index = keysym_modifiers_get_index(modifiers_map, name);
686 if (index == XKB_MOD_INVALID)
687 return XKB_MOD_INVALID;
693 im_cb_activate (void *data, struct zwp_input_method_v1 *input_method, struct zwp_input_method_context_v1 *context)
695 printf("im_cb_activate\n");
697 struct wl_array modifiers_map;
698 const struct layout *layout;
701 zwp_input_method_context_v1_destroy(data_wl.context);
703 if (data_wl.preedit_string)
704 free(data_wl.preedit_string);
706 data_wl.preedit_style = 0;
707 data_wl.preedit_string = strdup("");
708 data_wl.content_hint = 0;
709 data_wl.content_purpose = 0;
710 free(data_wl.preferred_language);
711 data_wl.preferred_language = NULL;
712 free(data_wl.surrounding_text);
713 data_wl.surrounding_text = NULL;
717 data_wl.context = context;
718 zwp_input_method_context_v1_add_listener(context,
719 &input_method_context_cb_listener,
722 wl_array_init(&modifiers_map);
723 keysym_modifiers_add(&modifiers_map, "Shift");
724 keysym_modifiers_add(&modifiers_map, "Control");
725 keysym_modifiers_add(&modifiers_map, "Mod1");
726 zwp_input_method_context_v1_modifiers_map(context, &modifiers_map);
727 data_wl.keysym.shift_mask = keysym_modifiers_get_mask(&modifiers_map, "Shift");
728 wl_array_release(&modifiers_map);
730 layout = get_current_layout();
732 zwp_input_method_context_v1_language(context,
735 zwp_input_method_context_v1_text_direction(context,
737 layout->text_direction);
740 im_cb_deactivate (void *data, struct zwp_input_method_v1 *input_method, struct zwp_input_method_context_v1 *im_ctx)
742 printf("im_cb_deactivate\n");
744 if (!data_wl.context)
747 zwp_input_method_context_v1_destroy(data_wl.context);
748 data_wl.context = NULL;
752 im_cb_destroy (void *data, struct zwp_input_method_v1 *input_method, struct zwp_input_method_context_v1 *im_ctx)
754 printf("im_cb_destroy\n");
755 zwp_input_method_v1_destroy(data_wl.input_method);
756 data_wl.input_method = NULL;
759 static const struct zwp_input_method_v1_listener input_method_cb_listener = {
760 .activate = im_cb_activate,
761 .deactivate = im_cb_deactivate,
763 .destroy = im_cb_destroy,
764 .show_input_panel = NULL,
765 .hide_input_panel = NULL,
766 .open_connection = NULL,
767 .close_connection = NULL,
768 .set_text_input_id = NULL,
772 registry_handle_global(void * data, struct wl_registry * registry, uint32_t id,
773 const char * interface, uint32_t version)
775 if (strcmp(interface, "wl_compositor") == 0) {
776 data_wl.compositor = wl_registry_bind(registry, id,
777 &wl_compositor_interface, version);
778 if (!data_wl.compositor) {
779 printf("Failed to bind compositor.\n");
782 if (data_wl.enable_log)
783 printf("Success to bind compositor.\n");
784 } else if (!strcmp(interface, "zwp_input_method_manager_v1")) {
785 data_wl.input_method_mgr = wl_registry_bind(registry, id,
786 &zwp_input_method_manager_v1_interface, version);
787 } else if (!strcmp(interface, "zwp_input_method_v1")) {
788 data_wl.input_method = wl_registry_bind(registry, id,
789 &zwp_input_method_v1_interface, version);
790 zwp_input_method_v1_add_listener(data_wl.input_method,
791 &input_method_cb_listener,
794 //TODO: delte this code. this job should be done in cb_activate
795 data_wl.preedit_string = strdup("");
796 data_wl.content_hint = 0;
797 data_wl.content_purpose = 0;
798 free(data_wl.preferred_language);
799 data_wl.preferred_language = NULL;
800 free(data_wl.surrounding_text);
801 data_wl.surrounding_text = NULL;
807 registry_handle_global_remove(void * data, struct wl_registry * registry, uint32_t id)
809 if (data_wl.enable_log)
810 printf("registry is removed. id: %d !\n", id);
813 static const struct wl_registry_listener _registry_listener = {
814 registry_handle_global,
815 registry_handle_global_remove
821 memset(&data_wl, 0, sizeof(struct display));
823 data_wl.display = wl_display_connect(NULL);
824 if (!data_wl.display) {
825 printf("Failed to connect wayland display\n");
829 data_wl.queue = wl_display_create_queue(data_wl.display);
830 if (!data_wl.queue) {
831 printf("Failed to create queue\n");
835 data_wl.registry = wl_display_get_registry(data_wl.display);
836 if (!data_wl.registry) {
837 printf("Failed to get registry\n");
841 wl_proxy_set_queue((struct wl_proxy*)data_wl.registry, data_wl.queue);
842 wl_registry_add_listener(data_wl.registry, &_registry_listener, NULL);
844 if (wl_display_dispatch_queue(data_wl.display, data_wl.queue) == -1) {
845 printf("Failed to dispatch display\n");
848 if (wl_display_roundtrip_queue(data_wl.display, data_wl.queue) == -1) {
849 printf("Failed to roundtrip display\n");
859 if (data_wl.enable_log)
860 printf("Shutdown wayland system\n");
862 if (data_wl.queue) wl_event_queue_destroy(data_wl.queue);
863 if (data_wl.display) {
864 if (data_wl.input_method)
865 zwp_input_method_v1_destroy(data_wl.input_method);
866 zwp_input_method_manager_v1_destroy(data_wl.input_method_mgr);
867 wl_registry_destroy(data_wl.registry);
868 wl_display_flush(data_wl.display);
869 wl_display_disconnect(data_wl.display);
876 struct epoll_event ep[2];
878 data_wl.fd_epoll = epoll_create(SIZE_EPOLL);
879 if (data_wl.fd_epoll <= 0) {
880 printf("Failed to epoll create: %d\n", SIZE_EPOLL);
884 data_wl.fd_display = wl_display_get_fd(data_wl.display);
886 memset(ep, 0, sizeof(struct epoll_event)*2);
888 ep[0].events = EPOLLIN | EPOLLERR | EPOLLHUP;
889 ep[0].data.fd = data_wl.fd_display;
890 epoll_ctl(data_wl.fd_epoll, EPOLL_CTL_ADD, data_wl.fd_display, &ep[0]);
891 ep[1].events = EPOLLIN | EPOLLERR | EPOLLHUP;
892 ep[1].data.fd = STDIN_FILENO;
893 epoll_ctl(data_wl.fd_epoll, EPOLL_CTL_ADD, 0, &ep[1]);
901 struct epoll_event ep[SIZE_EPOLL];
906 printf("Failed to init epoll\n");
911 while (data_wl.run) {
912 res = wl_display_dispatch_queue_pending(data_wl.display, data_wl.queue);
914 printf("Failed to dispatch pending. result: %d\n", res);
918 res = wl_display_flush(data_wl.display);
920 printf("Failed to flush display. result: %d\n", res);
925 count = epoll_wait(data_wl.fd_epoll, ep, SIZE_EPOLL, -1);
926 for (i = 0; i < count; i++) {
927 if (ep[i].events & EPOLLIN) {
928 if (ep[i].data.fd == data_wl.fd_display) {
929 wl_display_dispatch_queue(data_wl.display, data_wl.queue);
934 if (ep[i].events & EPOLLERR) {
937 if (ep[i].events & EPOLLHUP) {
945 main(int argc, char **argv)
949 res = wayland_init();