summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/engine_wayland_shm.c80
1 files changed, 1 insertions, 79 deletions
diff --git a/src/bin/engine_wayland_shm.c b/src/bin/engine_wayland_shm.c
index 7ff17d2..55b9449 100644
--- a/src/bin/engine_wayland_shm.c
+++ b/src/bin/engine_wayland_shm.c
@@ -18,12 +18,9 @@ struct _engine_wayland_shm_display
18 struct wl_registry *registry; 18 struct wl_registry *registry;
19 struct wl_compositor *compositor; 19 struct wl_compositor *compositor;
20 struct wl_surface *surface; 20 struct wl_surface *surface;
21 struct wl_callback *frame_callback;
22 struct wl_shell *shell; 21 struct wl_shell *shell;
23 struct wl_shell_surface *shell_surface; 22 struct wl_shell_surface *shell_surface;
24 struct wl_shm *shm; 23 struct wl_shm *shm;
25 /* struct wl_buffer *buffer; */
26 void *data;
27 int width; 24 int width;
28 int height; 25 int height;
29}; 26};
@@ -43,14 +40,6 @@ static const struct wl_registry_listener _registry_listener =
43 NULL, /* global_remove */ 40 NULL, /* global_remove */
44}; 41};
45 42
46/* Frame handler */
47static void _surface_frame_handle_complete(void *data, struct wl_callback *callback, uint32_t time __UNUSED__);
48static const struct wl_callback_listener _surface_frame_listener =
49{
50 _surface_frame_handle_complete,
51};
52
53
54/* 43/*
55 * API 44 * API
56 */ 45 */
@@ -85,13 +74,6 @@ engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height)
85 wl.surface = wl_compositor_create_surface(wl.compositor); 74 wl.surface = wl_compositor_create_surface(wl.compositor);
86 wl.shell_surface = engine_wayland_create_shell_surface(wl.shell, wl.surface, "Expedite Wayland SHM"); 75 wl.shell_surface = engine_wayland_create_shell_surface(wl.shell, wl.surface, "Expedite Wayland SHM");
87 76
88 /* _engine_wayland_shm_create_buffer(width, height); */
89
90 /* assert(wl.buffer != NULL); */
91 /* assert(wl.data != NULL); */
92
93 /* wl_surface_attach(wl.surface, wl.buffer, 0, 0); */
94
95 einfo->info.wl_shm = wl.shm; 77 einfo->info.wl_shm = wl.shm;
96 einfo->info.wl_surface = wl.surface; 78 einfo->info.wl_surface = wl.surface;
97 if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) 79 if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
@@ -103,25 +85,19 @@ engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height)
103 wl.width = width; 85 wl.width = width;
104 wl.height = height; 86 wl.height = height;
105 87
106 _surface_frame_handle_complete(NULL, NULL, 0);
107
108 return EINA_TRUE; 88 return EINA_TRUE;
109} 89}
110 90
111void 91void
112engine_wayland_shm_loop(void) 92engine_wayland_shm_loop(void)
113{ 93{
114 assert(wl_display_dispatch(wl.display) != -1); 94 assert(wl_display_dispatch_pending(wl.display) != -1);
115} 95}
116 96
117 97
118void 98void
119engine_wayland_shm_shutdown(void) 99engine_wayland_shm_shutdown(void)
120{ 100{
121 if (wl.frame_callback)
122 wl_callback_destroy(wl.frame_callback);
123
124 /* wl_buffer_destroy(wl.buffer); */
125 wl_shell_surface_destroy(wl.shell_surface); 101 wl_shell_surface_destroy(wl.shell_surface);
126 wl_surface_destroy(wl.surface); 102 wl_surface_destroy(wl.surface);
127 wl_shm_destroy(wl.shm); 103 wl_shm_destroy(wl.shm);
@@ -147,57 +123,3 @@ _registry_handle_global(void *data __UNUSED__, struct wl_registry *registry, uns
147 else if (!strcmp(interface, "wl_shm")) 123 else if (!strcmp(interface, "wl_shm"))
148 wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); 124 wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
149} 125}
150
151/* static void */
152/* _engine_wayland_shm_create_buffer(int width, int height) */
153/* { */
154/* struct wl_shm_pool *pool; */
155/* int fd, size, stride; */
156/* char tmp[PATH_MAX]; */
157
158/* stride = width * 4; */
159/* size = stride * height; */
160
161/* strcpy(tmp, "/tmp/expedite-wayland_shm-XXXXXX"); */
162/* if ((fd = mkstemp(tmp)) < 0) */
163/* { */
164/* fprintf(stderr, "Could not create temporary file.\n"); */
165/* return; */
166/* } */
167
168/* if (ftruncate(fd, size) < 0) */
169/* { */
170/* fprintf(stderr, "Could not truncate temporary file.\n"); */
171/* goto end; */
172/* } */
173
174/* wl.data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); */
175/* if (wl.data == MAP_FAILED) */
176/* { */
177/* wl.data = NULL; */
178/* fprintf(stderr, "mmap failed\n"); */
179/* goto end; */
180/* } */
181
182/* pool = wl_shm_create_pool(wl.shm, fd, size); */
183/* wl.buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, WL_SHM_FORMAT_XRGB8888); */
184/* wl_shm_pool_destroy(pool); */
185
186/* end: */
187/* close(fd); */
188/* } */
189
190static void
191_surface_frame_handle_complete(void *data __UNUSED__, struct wl_callback *callback __UNUSED__, uint32_t time __UNUSED__)
192{
193 wl_surface_damage(wl.surface, 0, 0, wl.width, wl.height);
194
195 if (wl.frame_callback)
196 wl_callback_destroy(wl.frame_callback);
197
198 wl.frame_callback = wl_surface_frame(wl.surface);
199 wl_callback_add_listener(wl.frame_callback, &_surface_frame_listener, NULL);
200
201 wl_surface_commit(wl.surface);
202}
203