X11 backend: fix window behavior with multiple show() calls
[platform/upstream/libwlmessage.git] / toytoolkit / text-protocol.c
1 /* 
2  * Copyright © 2012, 2013 Intel Corporation
3  * 
4  * Permission to use, copy, modify, distribute, and sell this
5  * software and its documentation for any purpose is hereby granted
6  * without fee, provided that the above copyright notice appear in
7  * all copies and that both that copyright notice and this permission
8  * notice appear in supporting documentation, and that the name of
9  * the copyright holders not be used in advertising or publicity
10  * pertaining to distribution of the software without specific,
11  * written prior permission.  The copyright holders make no
12  * representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied
14  * warranty.
15  * 
16  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
23  * THIS SOFTWARE.
24  */
25
26 #include <stdlib.h>
27 #include <stdint.h>
28 #include "wayland-util.h"
29
30 extern const struct wl_interface wl_seat_interface;
31 extern const struct wl_interface wl_surface_interface;
32 extern const struct wl_interface wl_seat_interface;
33 extern const struct wl_interface wl_surface_interface;
34 extern const struct wl_interface wl_text_input_interface;
35
36 static const struct wl_interface *types[] = {
37         NULL,
38         NULL,
39         NULL,
40         NULL,
41         NULL,
42         &wl_seat_interface,
43         &wl_surface_interface,
44         &wl_seat_interface,
45         &wl_surface_interface,
46         &wl_text_input_interface,
47 };
48
49 static const struct wl_message wl_text_input_requests[] = {
50         { "activate", "oo", types + 5 },
51         { "deactivate", "o", types + 7 },
52         { "show_input_panel", "", types + 0 },
53         { "hide_input_panel", "", types + 0 },
54         { "reset", "", types + 0 },
55         { "set_surrounding_text", "suu", types + 0 },
56         { "set_content_type", "uu", types + 0 },
57         { "set_cursor_rectangle", "iiii", types + 0 },
58         { "set_preferred_language", "s", types + 0 },
59         { "commit_state", "u", types + 0 },
60         { "invoke_action", "uu", types + 0 },
61 };
62
63 static const struct wl_message wl_text_input_events[] = {
64         { "enter", "o", types + 8 },
65         { "leave", "", types + 0 },
66         { "modifiers_map", "a", types + 0 },
67         { "input_panel_state", "u", types + 0 },
68         { "preedit_string", "uss", types + 0 },
69         { "preedit_styling", "uuu", types + 0 },
70         { "preedit_cursor", "i", types + 0 },
71         { "commit_string", "us", types + 0 },
72         { "cursor_position", "ii", types + 0 },
73         { "delete_surrounding_text", "iu", types + 0 },
74         { "keysym", "uuuuu", types + 0 },
75         { "language", "us", types + 0 },
76         { "text_direction", "uu", types + 0 },
77 };
78
79 WL_EXPORT const struct wl_interface wl_text_input_interface = {
80         "wl_text_input", 1,
81         11, wl_text_input_requests,
82         13, wl_text_input_events,
83 };
84
85 static const struct wl_message wl_text_input_manager_requests[] = {
86         { "create_text_input", "n", types + 9 },
87 };
88
89 WL_EXPORT const struct wl_interface wl_text_input_manager_interface = {
90         "wl_text_input_manager", 1,
91         1, wl_text_input_manager_requests,
92         0, NULL,
93 };
94