[PATCH weston] clients: fix incorrect format handling in simple-shm
Pekka Paalanen
ppaalanen at gmail.com
Wed Mar 16 09:18:52 UTC 2016
On Tue, 15 Mar 2016 21:41:14 +0000
Murray Calavera <murray.calavera at gmail.com> wrote:
> 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 at gmail.com>
> ---
> clients/simple-shm.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/clients/simple-shm.c b/clients/simple-shm.c
> index 6d8f608..68b307f 100644
> --- a/clients/simple-shm.c
> +++ b/clients/simple-shm.c
> @@ -50,7 +50,7 @@ struct display {
> struct xdg_shell *shell;
> struct zwp_fullscreen_shell_v1 *fshell;
> struct wl_shm *shm;
> - uint32_t formats;
> + bool has_xrgb;
> 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;
>
> - d->formats |= (1 << format);
> + if(format == WL_SHM_FORMAT_XRGB8888)
> + d->has_xrgb = true;
> }
>
> struct wl_shm_listener shm_listener = {
> @@ -414,7 +415,7 @@ create_display(void)
> display->display = wl_display_connect(NULL);
> assert(display->display);
>
> - display->formats = 0;
> + display->has_xrgb = false;
> display->registry = wl_display_get_registry(display->display);
> wl_registry_add_listener(display->registry,
> ®istry_listener, display);
> @@ -466,7 +467,7 @@ create_display(void)
> * technique.
> */
>
> - if (!(display->formats & (1 << WL_SHM_FORMAT_XRGB8888))) {
> + if (!display->has_xrgb) {
> fprintf(stderr, "WL_SHM_FORMAT_XRGB32 not available\n");
> exit(1);
> }
Hi,
indeed. I fixed one whitespace issue in shm_format() and pushed:
f72df1d..1ddb8dd master -> master
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160316/0144aa25/attachment.sig>
More information about the wayland-devel
mailing list