aboutsummaryrefslogtreecommitdiffstats
path: root/meta-ivi/recipes-graphics/wayland/weston-1.6.0/0010-clients-support-ivi-application.xml-for-clients-simp.patch
blob: 5f0220d9bc1cadae39947aa67daeb2e4c75816c2 (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
From 7fb2e8ec7eba02a6802c73f5d1d766a5de9308af Mon Sep 17 00:00:00 2001
From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Date: Wed, 15 Oct 2014 12:09:35 +0900
Subject: [PATCH 10/15] clients: support ivi-application.xml for
 clients/simple-shm.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: simple-shm, remove visibility listener.

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

-----------------------------------------------
clients: simple-shm, remove unnecesary roundtrip

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

-----------------------------------------------
clients: simple-shm, Opening brace needs to be on the previous line.

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

-----------------------------------------------
clients:simple-shm, Indent with spaces, should be tabs.

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

-----------------------------------------------
clients:simple-shm, simple-shm is not resizable

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

-----------------------------------------------
clients:simple-shm, remove unnecesary addition

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
---
 Makefile.am          |    4 +++-
 clients/simple-shm.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 89b7025..df67cbc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -410,7 +410,9 @@ nodist_weston_simple_shm_SOURCES =		\
 	protocol/xdg-shell-protocol.c		\
 	protocol/xdg-shell-client-protocol.h	\
 	protocol/fullscreen-shell-protocol.c	\
-	protocol/fullscreen-shell-client-protocol.h
+	protocol/fullscreen-shell-client-protocol.h	\
+	protocol/ivi-application-protocol.c		\
+	protocol/ivi-application-client-protocol.h
 weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
 weston_simple_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
 
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index c1cb386..e6025aa 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -37,6 +37,10 @@
 #include "xdg-shell-client-protocol.h"
 #include "fullscreen-shell-client-protocol.h"
 
+#include <sys/types.h>
+#include "ivi-application-client-protocol.h"
+#define IVI_SURFACE_ID 9000
+
 struct display {
 	struct wl_display *display;
 	struct wl_registry *registry;
@@ -45,6 +49,7 @@ struct display {
 	struct _wl_fullscreen_shell *fshell;
 	struct wl_shm *shm;
 	uint32_t formats;
+	struct ivi_application *ivi_application;
 };
 
 struct buffer {
@@ -58,6 +63,7 @@ struct window {
 	int width, height;
 	struct wl_surface *surface;
 	struct xdg_surface *xdg_surface;
+	struct ivi_surface *ivi_surface;
 	struct buffer buffers[2];
 	struct buffer *prev_buffer;
 	struct wl_callback *callback;
@@ -134,6 +140,17 @@ static const struct xdg_surface_listener xdg_surface_listener = {
 	handle_delete,
 };
 
+static void
+handle_ivi_surface_configure(void *data, struct ivi_surface *ivi_surface,
+			     int32_t width, int32_t height)
+{
+	/* Simple-shm is resizable */
+}
+
+static const struct ivi_surface_listener ivi_surface_listener = {
+	handle_ivi_surface_configure,
+};
+
 static struct window *
 create_window(struct display *display, int width, int height)
 {
@@ -160,11 +177,25 @@ create_window(struct display *display, int width, int height)
 					 &xdg_surface_listener, window);
 
 		xdg_surface_set_title(window->xdg_surface, "simple-shm");
+
 	} else if (display->fshell) {
 		_wl_fullscreen_shell_present_surface(display->fshell,
 						     window->surface,
 						     _WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT,
 						     NULL);
+	} else if (display->ivi_application ) {
+		uint32_t id_ivisurf = IVI_SURFACE_ID + (uint32_t)getpid();
+		window->ivi_surface =
+			ivi_application_surface_create(display->ivi_application,
+						       id_ivisurf, window->surface);
+		if (window->ivi_surface == NULL) {
+			fprintf(stderr, "Failed to create ivi_client_surface\n");
+			abort();
+		}
+
+		ivi_surface_add_listener(window->ivi_surface,
+					 &ivi_surface_listener, window);
+
 	} else {
 		assert(0);
 	}
@@ -350,6 +381,11 @@ registry_handle_global(void *data, struct wl_registry *registry,
 					  id, &wl_shm_interface, 1);
 		wl_shm_add_listener(d->shm, &shm_listener, d);
 	}
+	else if (strcmp(interface, "ivi_application") == 0) {
+		d->ivi_application =
+			wl_registry_bind(registry, id,
+					 &ivi_application_interface, 1);
+	}
 }
 
 static void
@@ -451,6 +487,12 @@ main(int argc, char **argv)
 		ret = wl_display_dispatch(display->display);
 
 	fprintf(stderr, "simple-shm exiting\n");
+
+	if (window->display->ivi_application) {
+		ivi_surface_destroy(window->ivi_surface);
+		ivi_application_destroy(window->display->ivi_application);
+	}
+
 	destroy_window(window);
 	destroy_display(display);
 
-- 
1.7.9.5