2 /* Protocol XML file : wayland-extension/input-method.xml */
4 #ifndef __DS_INPUT_METHOD_PROTOCOL_H__
5 #define __DS_INPUT_METHOD_PROTOCOL_H__
7 #include "wayland-server-core.h"
8 #include "input-method-server-protocol.h"
15 #ifndef WAYLAND_VERSION_CHECK
16 #define WAYLAND_VERSION_CHECK(major, minor, micro) \
17 ((WAYLAND_VERSION_MAJOR > (major)) || \
18 (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
19 (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
23 namespace DSWaylandServer {
24 class wl_input_method_context
27 wl_input_method_context(struct ::wl_client *client, uint32_t id, int version);
28 wl_input_method_context(struct ::wl_display *display, int version);
29 wl_input_method_context(struct ::wl_resource *resource);
30 wl_input_method_context();
32 virtual ~wl_input_method_context();
37 Resource() : input_method_context_object(NULL), handle(NULL) {}
38 virtual ~Resource() {}
40 wl_input_method_context *input_method_context_object;
41 wl_input_method_context *object() { return input_method_context_object; }
42 struct ::wl_resource *handle;
44 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
45 int version() const { return wl_resource_get_version(handle); }
47 static Resource *fromResource(struct ::wl_resource *resource);
50 void init(struct ::wl_client *client, uint32_t id, int version);
51 void init(struct ::wl_display *display, int version);
52 void init(struct ::wl_resource *resource);
54 Resource *add(struct ::wl_client *client, int version);
55 Resource *add(struct ::wl_client *client, uint32_t id, int version);
56 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
58 Resource *resource() { return m_resource; }
59 const Resource *resource() const { return m_resource; }
61 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
62 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
64 bool isGlobal() const { return m_global != NULL; }
65 bool isResource() const { return m_resource != NULL; }
67 static const struct ::wl_interface *interface();
68 static std::string interfaceName() { return interface()->name; }
69 static int interfaceVersion() { return interface()->version; }
73 void send_reset(struct ::wl_resource *resource);
74 void send_content_type(uint32_t hint, uint32_t purpose);
75 void send_content_type(struct ::wl_resource *resource, uint32_t hint, uint32_t purpose);
76 void send_invoke_action(uint32_t button, uint32_t index);
77 void send_invoke_action(struct ::wl_resource *resource, uint32_t button, uint32_t index);
78 void send_commit_state(uint32_t serial);
79 void send_commit_state(struct ::wl_resource *resource, uint32_t serial);
80 void send_preferred_language(const std::string &language);
81 void send_preferred_language(struct ::wl_resource *resource, const std::string &language);
82 void send_return_key_type(uint32_t return_key_type);
83 void send_return_key_type(struct ::wl_resource *resource, uint32_t return_key_type);
84 void send_return_key_disabled(uint32_t return_key_disabled);
85 void send_return_key_disabled(struct ::wl_resource *resource, uint32_t return_key_disabled);
86 void send_input_panel_data(const std::string &input_panel_data, uint32_t input_panel_data_length);
87 void send_input_panel_data(struct ::wl_resource *resource, const std::string &input_panel_data, uint32_t input_panel_data_length);
88 void send_bidi_direction(uint32_t direction);
89 void send_bidi_direction(struct ::wl_resource *resource, uint32_t direction);
90 void send_cursor_position(uint32_t cursor_position);
91 void send_cursor_position(struct ::wl_resource *resource, uint32_t cursor_position);
92 void send_process_input_device_event(uint32_t event_type, const std::string &event_data, uint32_t event_length);
93 void send_process_input_device_event(struct ::wl_resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length);
94 void send_filter_key_event(uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
95 void send_filter_key_event(struct ::wl_resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
96 void send_capital_mode(uint32_t mode);
97 void send_capital_mode(struct ::wl_resource *resource, uint32_t mode);
98 void send_prediction_hint(const std::string &text);
99 void send_prediction_hint(struct ::wl_resource *resource, const std::string &text);
100 void send_mime_type(const std::string &type);
101 void send_mime_type(struct ::wl_resource *resource, const std::string &type);
102 void send_finalized_content(const std::string &text, uint32_t cursor_position);
103 void send_finalized_content(struct ::wl_resource *resource, const std::string &text, uint32_t cursor_position);
104 void send_prediction_hint_data(const std::string &key, const std::string &value);
105 void send_prediction_hint_data(struct ::wl_resource *resource, const std::string &key, const std::string &value);
106 void send_input_panel_enabled(uint32_t enabled);
107 void send_input_panel_enabled(struct ::wl_resource *resource, uint32_t enabled);
110 virtual Resource *input_method_context_allocate();
112 virtual void input_method_context_bind_resource(Resource *resource);
113 virtual void input_method_context_destroy_resource(Resource *resource);
115 virtual void input_method_context_destroy(Resource *resource);
116 virtual void input_method_context_commit_string(Resource *resource, uint32_t serial, const std::string &text);
117 virtual void input_method_context_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit);
118 virtual void input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style);
119 virtual void input_method_context_preedit_cursor(Resource *resource, int32_t index);
120 virtual void input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length);
121 virtual void input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor);
122 virtual void input_method_context_modifiers_map(Resource *resource, struct ::wl_array *map);
123 virtual void input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers);
124 virtual void input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard);
125 virtual void input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
126 virtual void input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
127 virtual void input_method_context_language(Resource *resource, uint32_t serial, const std::string &language);
128 virtual void input_method_context_text_direction(Resource *resource, uint32_t serial, uint32_t direction);
129 virtual void input_method_context_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end);
130 virtual void input_method_context_private_command(Resource *resource, uint32_t serial, const std::string &command);
131 virtual void input_method_context_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length);
132 virtual void input_method_context_hide_input_panel(Resource *resource, uint32_t serial);
133 virtual void input_method_context_get_selection_text(Resource *resource, int32_t fd);
134 virtual void input_method_context_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd);
135 virtual void input_method_context_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state);
136 virtual void input_method_context_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
137 virtual void input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit);
138 virtual void input_method_context_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value);
139 virtual void input_method_context_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types);
140 virtual void input_method_context_update_candidate_state(Resource *resource, uint32_t state);
141 virtual void input_method_context_reshow_input_panel(Resource *resource);
144 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
145 static void destroy_func(struct ::wl_resource *client_resource);
146 static void display_destroy_func(struct ::wl_listener *listener, void *data);
148 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
149 Resource *bind(struct ::wl_resource *handle);
151 static const struct ::wl_input_method_context_interface m_wl_input_method_context_interface;
153 static void handle_destroy(
155 struct wl_resource *resource);
156 static void handle_commit_string(
158 struct wl_resource *resource,
161 static void handle_preedit_string(
163 struct wl_resource *resource,
167 static void handle_preedit_styling(
169 struct wl_resource *resource,
173 static void handle_preedit_cursor(
175 struct wl_resource *resource,
177 static void handle_delete_surrounding_text(
179 struct wl_resource *resource,
182 static void handle_cursor_position(
184 struct wl_resource *resource,
187 static void handle_modifiers_map(
189 struct wl_resource *resource,
190 struct ::wl_array *map);
191 static void handle_keysym(
193 struct wl_resource *resource,
199 static void handle_grab_keyboard(
201 struct wl_resource *resource,
203 static void handle_key(
205 struct wl_resource *resource,
210 static void handle_modifiers(
212 struct wl_resource *resource,
214 uint32_t mods_depressed,
215 uint32_t mods_latched,
216 uint32_t mods_locked,
218 static void handle_language(
220 struct wl_resource *resource,
222 const char *language);
223 static void handle_text_direction(
225 struct wl_resource *resource,
228 static void handle_selection_region(
230 struct wl_resource *resource,
234 static void handle_private_command(
236 struct wl_resource *resource,
238 const char *command);
239 static void handle_update_input_panel_data(
241 struct wl_resource *resource,
243 const char *input_panel_data,
244 uint32_t input_panel_data_length);
245 static void handle_hide_input_panel(
247 struct wl_resource *resource,
249 static void handle_get_selection_text(
251 struct wl_resource *resource,
253 static void handle_get_surrounding_text(
255 struct wl_resource *resource,
256 uint32_t maxlen_before,
257 uint32_t maxlen_after,
259 static void handle_filter_key_event_done(
261 struct wl_resource *resource,
264 static void handle_update_ise_geometry(
266 struct wl_resource *resource,
272 static void handle_recapture_string(
274 struct wl_resource *resource,
279 const char *preedit_commit,
281 static void handle_input_panel_event(
283 struct wl_resource *resource,
287 static void handle_commit_content(
289 struct wl_resource *resource,
292 const char *description,
293 const char *mime_types);
294 static void handle_update_candidate_state(
296 struct wl_resource *resource,
298 static void handle_reshow_input_panel(
300 struct wl_resource *resource);
302 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
303 Resource *m_resource;
304 struct ::wl_global *m_global;
305 uint32_t m_globalVersion;
306 struct DisplayDestroyedListener : ::wl_listener {
307 wl_input_method_context *parent;
308 DisplayDestroyedListener(): parent(NULL) {}
310 DisplayDestroyedListener m_displayDestroyedListener;
313 class wl_input_method
316 wl_input_method(struct ::wl_client *client, uint32_t id, int version);
317 wl_input_method(struct ::wl_display *display, int version);
318 wl_input_method(struct ::wl_resource *resource);
321 virtual ~wl_input_method();
326 Resource() : input_method_object(NULL), handle(NULL) {}
327 virtual ~Resource() {}
329 wl_input_method *input_method_object;
330 wl_input_method *object() { return input_method_object; }
331 struct ::wl_resource *handle;
333 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
334 int version() const { return wl_resource_get_version(handle); }
336 static Resource *fromResource(struct ::wl_resource *resource);
339 void init(struct ::wl_client *client, uint32_t id, int version);
340 void init(struct ::wl_display *display, int version);
341 void init(struct ::wl_resource *resource);
343 Resource *add(struct ::wl_client *client, int version);
344 Resource *add(struct ::wl_client *client, uint32_t id, int version);
345 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
347 Resource *resource() { return m_resource; }
348 const Resource *resource() const { return m_resource; }
350 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
351 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
353 bool isGlobal() const { return m_global != NULL; }
354 bool isResource() const { return m_resource != NULL; }
356 static const struct ::wl_interface *interface();
357 static std::string interfaceName() { return interface()->name; }
358 static int interfaceVersion() { return interface()->version; }
361 void send_activate(struct ::wl_resource *id, uint32_t text_input_id, uint32_t focus_in_event);
362 void send_activate(struct ::wl_resource *resource, struct ::wl_resource *id, uint32_t text_input_id, uint32_t focus_in_event);
363 void send_deactivate(struct ::wl_resource *context, uint32_t focus_out_event);
364 void send_deactivate(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t focus_out_event);
365 void send_destroy(struct ::wl_resource *context);
366 void send_destroy(struct ::wl_resource *resource, struct ::wl_resource *context);
367 void send_show_input_panel(struct ::wl_resource *context);
368 void send_show_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context);
369 void send_hide_input_panel(struct ::wl_resource *context);
370 void send_hide_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context);
373 virtual Resource *input_method_allocate();
375 virtual void input_method_bind_resource(Resource *resource);
376 virtual void input_method_destroy_resource(Resource *resource);
379 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
380 static void destroy_func(struct ::wl_resource *client_resource);
381 static void display_destroy_func(struct ::wl_listener *listener, void *data);
383 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
384 Resource *bind(struct ::wl_resource *handle);
386 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
387 Resource *m_resource;
388 struct ::wl_global *m_global;
389 uint32_t m_globalVersion;
390 struct DisplayDestroyedListener : ::wl_listener {
391 wl_input_method *parent;
392 DisplayDestroyedListener(): parent(NULL) {}
394 DisplayDestroyedListener m_displayDestroyedListener;
400 wl_input_panel(struct ::wl_client *client, uint32_t id, int version);
401 wl_input_panel(struct ::wl_display *display, int version);
402 wl_input_panel(struct ::wl_resource *resource);
405 virtual ~wl_input_panel();
410 Resource() : input_panel_object(NULL), handle(NULL) {}
411 virtual ~Resource() {}
413 wl_input_panel *input_panel_object;
414 wl_input_panel *object() { return input_panel_object; }
415 struct ::wl_resource *handle;
417 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
418 int version() const { return wl_resource_get_version(handle); }
420 static Resource *fromResource(struct ::wl_resource *resource);
423 void init(struct ::wl_client *client, uint32_t id, int version);
424 void init(struct ::wl_display *display, int version);
425 void init(struct ::wl_resource *resource);
427 Resource *add(struct ::wl_client *client, int version);
428 Resource *add(struct ::wl_client *client, uint32_t id, int version);
429 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
431 Resource *resource() { return m_resource; }
432 const Resource *resource() const { return m_resource; }
434 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
435 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
437 bool isGlobal() const { return m_global != NULL; }
438 bool isResource() const { return m_resource != NULL; }
440 static const struct ::wl_interface *interface();
441 static std::string interfaceName() { return interface()->name; }
442 static int interfaceVersion() { return interface()->version; }
446 virtual Resource *input_panel_allocate();
448 virtual void input_panel_bind_resource(Resource *resource);
449 virtual void input_panel_destroy_resource(Resource *resource);
451 virtual void input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
454 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
455 static void destroy_func(struct ::wl_resource *client_resource);
456 static void display_destroy_func(struct ::wl_listener *listener, void *data);
458 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
459 Resource *bind(struct ::wl_resource *handle);
461 static const struct ::wl_input_panel_interface m_wl_input_panel_interface;
463 static void handle_get_input_panel_surface(
465 struct wl_resource *resource,
467 struct ::wl_resource *surface);
469 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
470 Resource *m_resource;
471 struct ::wl_global *m_global;
472 uint32_t m_globalVersion;
473 struct DisplayDestroyedListener : ::wl_listener {
474 wl_input_panel *parent;
475 DisplayDestroyedListener(): parent(NULL) {}
477 DisplayDestroyedListener m_displayDestroyedListener;
480 class wl_input_panel_surface
483 wl_input_panel_surface(struct ::wl_client *client, uint32_t id, int version);
484 wl_input_panel_surface(struct ::wl_display *display, int version);
485 wl_input_panel_surface(struct ::wl_resource *resource);
486 wl_input_panel_surface();
488 virtual ~wl_input_panel_surface();
493 Resource() : input_panel_surface_object(NULL), handle(NULL) {}
494 virtual ~Resource() {}
496 wl_input_panel_surface *input_panel_surface_object;
497 wl_input_panel_surface *object() { return input_panel_surface_object; }
498 struct ::wl_resource *handle;
500 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
501 int version() const { return wl_resource_get_version(handle); }
503 static Resource *fromResource(struct ::wl_resource *resource);
506 void init(struct ::wl_client *client, uint32_t id, int version);
507 void init(struct ::wl_display *display, int version);
508 void init(struct ::wl_resource *resource);
510 Resource *add(struct ::wl_client *client, int version);
511 Resource *add(struct ::wl_client *client, uint32_t id, int version);
512 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
514 Resource *resource() { return m_resource; }
515 const Resource *resource() const { return m_resource; }
517 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
518 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
520 bool isGlobal() const { return m_global != NULL; }
521 bool isResource() const { return m_resource != NULL; }
523 static const struct ::wl_interface *interface();
524 static std::string interfaceName() { return interface()->name; }
525 static int interfaceVersion() { return interface()->version; }
529 position_center_bottom = 0,
533 virtual Resource *input_panel_surface_allocate();
535 virtual void input_panel_surface_bind_resource(Resource *resource);
536 virtual void input_panel_surface_destroy_resource(Resource *resource);
538 virtual void input_panel_surface_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position);
539 virtual void input_panel_surface_set_overlay_panel(Resource *resource);
540 virtual void input_panel_surface_set_ready(Resource *resource, uint32_t state);
541 virtual void input_panel_surface_set_floating_panel(Resource *resource, uint32_t state);
542 virtual void input_panel_surface_set_floating_drag_enabled(Resource *resource, uint32_t enabled);
545 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
546 static void destroy_func(struct ::wl_resource *client_resource);
547 static void display_destroy_func(struct ::wl_listener *listener, void *data);
549 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
550 Resource *bind(struct ::wl_resource *handle);
552 static const struct ::wl_input_panel_surface_interface m_wl_input_panel_surface_interface;
554 static void handle_set_toplevel(
556 struct wl_resource *resource,
557 struct ::wl_resource *output,
559 static void handle_set_overlay_panel(
561 struct wl_resource *resource);
562 static void handle_set_ready(
564 struct wl_resource *resource,
566 static void handle_set_floating_panel(
568 struct wl_resource *resource,
570 static void handle_set_floating_drag_enabled(
572 struct wl_resource *resource,
575 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
576 Resource *m_resource;
577 struct ::wl_global *m_global;
578 uint32_t m_globalVersion;
579 struct DisplayDestroyedListener : ::wl_listener {
580 wl_input_panel_surface *parent;
581 DisplayDestroyedListener(): parent(NULL) {}
583 DisplayDestroyedListener m_displayDestroyedListener;