summaryrefslogtreecommitdiffstats
path: root/meta-ivi/recipes-graphics/wayland/weston-1.6.0/0012-clients-support-ivi-application.xml-for-clients-wind.patch
blob: 17544d526d7c93470e79bf2b47e0f48344fb76e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
From df22893f76fe2a101c659e53f4594121176fa174 Mon Sep 17 00:00:00 2001
From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Date: Wed, 15 Oct 2014 12:13:52 +0900
Subject: [PATCH 12/15] clients: support ivi-application.xml for
 clients/window.c

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

remove NULL entry in listener

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

-----------------------------------------------------
clients: window, remove visibility listener.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

-----------------------------------------------------

clients: window, don't reindent, but just do

if (!display->xdg_shell) return;

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

-----------------------------------------------------
clients: window, remove unnecesary roundtrip

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

-----------------------------------------------------
clients: window.c,
surface->toysurface->destroy(surface->toysurface);

        if (surface->window->display->ivi_application)
        {
        ivi_surface_destroy(surface->window->ivi_surface);
        ivi_application_destroy(surface->window->display->ivi_application);

I don't think this is the right place to destroy ivi_application. This
means that the ivi_application is destroyed when the first window is
destroyed, which prevents opening any new windows.

Maybe it would be best to replace this hunk with just:

if (surface->window->ivi_surface)
ivi_surface_destroy(surface->window->ivi_surface);

Note, that your destruction order is also funny: the wl_surface gets
destroyed before the ivi_surface. Maybe that should be the other way
around?

Finally, I think this is the wrong place to destroy ivi_surface
altogether. ivi_surface is a shell surface, and it should be destroyed
with the window, just like xdg_surface is. That is, in window_destroy(),
in similar way as xdg_surface_destroy() is called.

ivi_surface is similar to xdg_surface here, not wl_surface.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

-----------------------------------------------------
clients: window.c, This is in the wrong place. ivi_surface should be
created with the window, not with the underlying wl_surface or buffers.

        if (!surface->toysurface) {
        uint32_t id_ivisurf = IVI_SURFACE_ID + (uint32_t)getpid();
        surface->window->ivi_surface =
        ivi_application_surface_create(display->ivi_application,
        id_ivisurf, surface->surface);
        if (surface->window->ivi_surface == NULL) {
        fprintf(stderr, "Failed to create ivi_client_surface\n");
        abort();
        } +
        ivi_surface_add_listener(surface->window->ivi_surface,
        &ivi_surface_listener, surface->window);
        }
        }

This is in the wrong place. ivi_surface should be created with the
window, not with the underlying wl_surface or buffers.

This code should be in window_create(), the same place as
xdg_shell_get_xdg_surface() is used. Make sure you cannot create both
xdg_surface and ivi_surface, if both xdg_shell and ivi_shell are
advertised by the compositor.

When you create ivi_surface in window_create(), that automatically means
that window_create_custom() will not create a ivi_surface. That should
finally fix the virtual keyboard application, so that you do not need
the strcmp(surface->window->title,"Virtual keyboard") hack.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

---------------------------------------------------------
clients: window.c, clean up code

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

---------------------------------------------------------
clients: window.c, jsut call fail_on_null(window->ivi_surface)

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

---------------------------------------------------------
clients: window.c, off a bit to struct ivi_surface *ivi_surface

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
---
 clients/window.c |   67 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 57 insertions(+), 10 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index e44d65c..2f05351 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -72,6 +72,10 @@ typedef void *EGLContext;
 
 #include "window.h"
 
+#include <sys/types.h>
+#include "ivi-application-client-protocol.h"
+#define IVI_SURFACE_ID 9000
+
 struct shm_pool;
 
 struct global {
@@ -133,6 +137,7 @@ struct display {
 
 	int has_rgb565;
 	int seat_version;
+	struct ivi_application *ivi_application;
 };
 
 struct window_output {
@@ -249,6 +254,8 @@ struct window {
 	struct window *parent;
 	struct wl_surface *last_parent_surface;
 
+	struct ivi_surface *ivi_surface;
+
 	struct window_frame *frame;
 
 	/* struct surface::link, contains also main_surface */
@@ -1379,6 +1386,19 @@ window_get_display(struct window *window)
 }
 
 static void
+handle_ivi_surface_configure(void *data, struct ivi_surface *ivi_surface,
+                             int32_t width, int32_t height)
+{
+	struct window *window = data;
+
+	window_schedule_resize(window, width, height);
+}
+
+static const struct ivi_surface_listener ivi_surface_listener = {
+        handle_ivi_surface_configure,
+};
+
+static void
 surface_create_surface(struct surface *surface, uint32_t flags)
 {
 	struct display *display = surface->window->display;
@@ -1501,7 +1521,7 @@ window_destroy(struct window *window)
 
 	wl_list_remove(&window->redraw_task.link);
 
-	wl_list_for_each(input, &display->input_list, link) {	  
+	wl_list_for_each(input, &display->input_list, link) {
 		if (input->touch_focus == window)
 			input->touch_focus = NULL;
 		if (input->pointer_focus == window)
@@ -1526,6 +1546,9 @@ window_destroy(struct window *window)
 	if (window->xdg_popup)
 		xdg_popup_destroy(window->xdg_popup);
 
+	if (window->ivi_surface)
+		ivi_surface_destroy(window->ivi_surface);
+
 	surface_destroy(window->main_surface);
 
 	wl_list_remove(&window->link);
@@ -3051,7 +3074,7 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
 			wl_list_insert(&input->touch_point_list, &tp->link);
 
 			if (widget->touch_down_handler)
-				(*widget->touch_down_handler)(widget, input, 
+				(*widget->touch_down_handler)(widget, input,
 							      serial, time, id,
 							      sx, sy,
 							      widget->user_data);
@@ -4489,7 +4512,7 @@ window_create_internal(struct display *display, int custom)
 	surface = surface_create(window);
 	window->main_surface = surface;
 
-	assert(custom || display->xdg_shell);
+	assert(custom || display->xdg_shell || display->ivi_application);
 
 	window->custom = custom;
 	window->preferred_format = WINDOW_PREFERRED_FORMAT_NONE;
@@ -4509,17 +4532,30 @@ struct window *
 window_create(struct display *display)
 {
 	struct window *window;
+	uint32_t id_ivisurf;
 
 	window = window_create_internal(display, 0);
 
-	window->xdg_surface =
-		xdg_shell_get_xdg_surface(window->display->xdg_shell,
-					  window->main_surface->surface);
-	fail_on_null(window->xdg_surface);
+	if (window->display->xdg_shell) {
+		window->xdg_surface =
+			xdg_shell_get_xdg_surface(window->display->xdg_shell,
+						  window->main_surface->surface);
+		fail_on_null(window->xdg_surface);
 
-	xdg_surface_set_user_data(window->xdg_surface, window);
-	xdg_surface_add_listener(window->xdg_surface,
-				 &xdg_surface_listener, window);
+		xdg_surface_set_user_data(window->xdg_surface, window);
+		xdg_surface_add_listener(window->xdg_surface,
+					 &xdg_surface_listener, window);
+	} else if (display->ivi_application) {
+		/* auto generation of ivi_id based on process id + basement of id */
+		id_ivisurf = IVI_SURFACE_ID + (uint32_t)getpid();
+		window->ivi_surface =
+			ivi_application_surface_create(display->ivi_application,
+						       id_ivisurf, window->main_surface->surface);
+		fail_on_null(window->ivi_surface);
+
+		ivi_surface_add_listener(window->ivi_surface,
+					 &ivi_surface_listener, window);
+	}
 
 	return window;
 }
@@ -4772,6 +4808,9 @@ window_show_menu(struct display *display,
 
 	frame_interior(menu->frame, &ix, &iy, NULL, NULL);
 
+	if (!display->xdg_shell)
+		return;
+
 	window->xdg_popup = xdg_shell_get_xdg_popup(display->xdg_shell,
 						    window->main_surface->surface,
 						    parent->main_surface->surface,
@@ -5231,6 +5270,11 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
 			wl_registry_bind(registry, id,
 					 &wl_subcompositor_interface, 1);
 	}
+	else if (strcmp(interface, "ivi_application") == 0) {
+		d->ivi_application =
+			wl_registry_bind(registry, id,
+					 &ivi_application_interface, 1);
+	}
 
 	if (d->global_handler)
 		d->global_handler(d, id, interface, version, d->user_data);
@@ -5529,6 +5573,9 @@ display_destroy(struct display *display)
 	if (display->xdg_shell)
 		xdg_shell_destroy(display->xdg_shell);
 
+	if (display->ivi_application)
+		ivi_application_destroy(display->ivi_application);
+
 	if (display->shm)
 		wl_shm_destroy(display->shm);
 
-- 
1.7.9.5