summaryrefslogtreecommitdiffstats
path: root/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0009-ivi-shell-added-libweston-desktop-api_implementation.patch
blob: 6a72f15d8c4d4c52d4d557c794db31cbee3f1b90 (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
index 84db2c97..e797e4f9 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -489,6 +489,162 @@ shell_add_bindings(struct weston_compositor *compositor,
 					    shell);
 }
 
+/*
+ * libweston-desktop
+ */
+
+static void
+desktop_surface_ping_timeout(struct weston_desktop_client *client,
+			     void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_ping_timeout is not supported\n");
+}
+
+static void
+desktop_surface_pong(struct weston_desktop_client *client,
+		     void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_pong is not supported\n");
+}
+
+static void
+desktop_surface_added(struct weston_desktop_surface *surface,
+		      void *user_data)
+{
+	struct ivi_shell *shell = (struct ivi_shell *) user_data;
+	struct ivi_layout_surface *layout_surface;
+	struct ivi_shell_surface *ivisurf;
+	struct weston_surface *weston_surf =
+			weston_desktop_surface_get_surface(surface);
+
+	layout_surface = ivi_layout_desktop_surface_create(weston_surf,
+						       IVI_INVALID_ID);
+	if (!layout_surface) {
+		return;
+	}
+
+	layout_surface->weston_desktop_surface = surface;
+
+	ivisurf = zalloc(sizeof *ivisurf);
+	if (!ivisurf) {
+		return;
+	}
+
+	ivisurf->shell = shell;
+	ivisurf->id_surface = IVI_INVALID_ID;
+
+	ivisurf->width = 0;
+	ivisurf->height = 0;
+	ivisurf->layout_surface = layout_surface;
+	ivisurf->surface = weston_surf;
+
+	weston_desktop_surface_set_user_data(surface, ivisurf);
+}
+
+static void
+desktop_surface_removed(struct weston_desktop_surface *surface,
+			void *user_data)
+{
+	struct ivi_shell_surface *ivisurf = (struct ivi_shell_surface *)
+			weston_desktop_surface_get_user_data(surface);
+
+	assert(ivisurf != NULL);
+
+	if (ivisurf->layout_surface)
+		layout_surface_cleanup(ivisurf);
+}
+
+static void
+desktop_surface_committed(struct weston_desktop_surface *surface,
+			  int32_t sx, int32_t sy, void *user_data)
+{
+	struct ivi_shell_surface *ivisurf = (struct ivi_shell_surface *)
+			weston_desktop_surface_get_user_data(surface);
+	struct weston_surface *weston_surf =
+			weston_desktop_surface_get_surface(surface);
+
+	if(!ivisurf)
+		return;
+
+	if (weston_surf->width == 0 || weston_surf->height == 0)
+		return;
+
+	if (ivisurf->width != weston_surf->width ||
+	    ivisurf->height != weston_surf->height) {
+		ivisurf->width  = weston_surf->width;
+		ivisurf->height = weston_surf->height;
+
+		ivi_layout_desktop_surface_configure(ivisurf->layout_surface,
+						 weston_surf->width,
+						 weston_surf->height);
+	}
+}
+
+static void
+desktop_surface_move(struct weston_desktop_surface *surface,
+		     struct weston_seat *seat, uint32_t serial, void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_move is not supported\n");
+}
+
+static void
+desktop_surface_resize(struct weston_desktop_surface *surface,
+		       struct weston_seat *seat, uint32_t serial,
+		       enum weston_desktop_surface_edge edges, void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_resize is not supported\n");
+}
+
+static void
+desktop_surface_fullscreen_requested(struct weston_desktop_surface *surface,
+				     bool fullscreen,
+				     struct weston_output *output,
+				     void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_fullscreen_requested is not supported\n");
+}
+
+static void
+desktop_surface_maximized_requested(struct weston_desktop_surface *surface,
+				    bool maximized, void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_maximized_requested is not supported\n");
+}
+
+static void
+desktop_surface_minimized_requested(struct weston_desktop_surface *surface,
+				    void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_minimized_requested is not supported\n");
+}
+
+static void
+desktop_surface_set_xwayland_position(struct weston_desktop_surface *surface,
+				      int32_t x, int32_t y, void *user_data)
+{
+	weston_log("ivi-shell: desktop_surface_set_xwayland_position is not supported\n");
+}
+
+static const struct weston_desktop_api shell_desktop_api = {
+	.struct_size = sizeof(struct weston_desktop_api),
+	.ping_timeout = desktop_surface_ping_timeout,
+	.pong = desktop_surface_pong,
+	.surface_added = desktop_surface_added,
+	.surface_removed = desktop_surface_removed,
+	.committed = desktop_surface_committed,
+
+	.move = desktop_surface_move,
+	.resize = desktop_surface_resize,
+	.fullscreen_requested = desktop_surface_fullscreen_requested,
+	.maximized_requested = desktop_surface_maximized_requested,
+	.minimized_requested = desktop_surface_minimized_requested,
+	.set_xwayland_position = desktop_surface_set_xwayland_position,
+};
+
+/*
+ * end of libweston-desktop
+ */
+
 /*
  * Initialization of ivi-shell.
  */