clients: fix incorrect format handling in simple-shm

the `shm_format` function seems to assume the `wl_shm_format`
enum has bit-exclusive enumerations which is not true.

Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
[Pekka: fix whitespace with an 'if'.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Murray Calavera 9 years ago committed by Pekka Paalanen
parent f72df1dfe1
commit 1ddb8dd8f1
  1. 9
      clients/simple-shm.c

@ -50,7 +50,7 @@ struct display {
struct xdg_shell *shell; struct xdg_shell *shell;
struct zwp_fullscreen_shell_v1 *fshell; struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm; struct wl_shm *shm;
uint32_t formats; bool has_xrgb;
struct ivi_application *ivi_application; struct ivi_application *ivi_application;
}; };
@ -337,7 +337,8 @@ shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
{ {
struct display *d = data; struct display *d = data;
d->formats |= (1 << format); if (format == WL_SHM_FORMAT_XRGB8888)
d->has_xrgb = true;
} }
struct wl_shm_listener shm_listener = { struct wl_shm_listener shm_listener = {
@ -414,7 +415,7 @@ create_display(void)
display->display = wl_display_connect(NULL); display->display = wl_display_connect(NULL);
assert(display->display); assert(display->display);
display->formats = 0; display->has_xrgb = false;
display->registry = wl_display_get_registry(display->display); display->registry = wl_display_get_registry(display->display);
wl_registry_add_listener(display->registry, wl_registry_add_listener(display->registry,
&registry_listener, display); &registry_listener, display);
@ -466,7 +467,7 @@ create_display(void)
* technique. * technique.
*/ */
if (!(display->formats & (1 << WL_SHM_FORMAT_XRGB8888))) { if (!display->has_xrgb) {
fprintf(stderr, "WL_SHM_FORMAT_XRGB32 not available\n"); fprintf(stderr, "WL_SHM_FORMAT_XRGB32 not available\n");
exit(1); exit(1);
} }

Loading…
Cancel
Save