cogl: fix a compile warning

In find_onscreen_for_xid() we want to loop over the framebuffers
and skip any that is not onscreen.

The code today does this by negating the framebuffer type variable
and skipping if that equals COGL_FRAMEBUFFER_TYPE_ONSCREEN. This
actually works as the enum used will function as a boolean:

typedef enum _CoglFramebufferType {
  COGL_FRAMEBUFFER_TYPE_ONSCREEN,
  COGL_FRAMEBUFFER_TYPE_OFFSCREEN
} CoglFramebufferType;

But it is a bit weird logic and fragile if more types are added.
(not that I can think of any different type...)

To simplify this, and to silence a warning in clang this patch just
changes it to a != test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/905
This commit is contained in:
Thomas Hindoe Paaboel Andersen 2019-10-26 18:52:44 +02:00 committed by Georges Basile Stavracas Neto
parent 793c2ac58d
commit 7c036c5896

View File

@ -81,7 +81,7 @@ find_onscreen_for_xid (CoglContext *context, uint32_t xid)
CoglOnscreenEGL *egl_onscreen;
CoglOnscreenXlib *xlib_onscreen;
if (!framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN)
if (framebuffer->type != COGL_FRAMEBUFFER_TYPE_ONSCREEN)
continue;
egl_onscreen = COGL_ONSCREEN (framebuffer)->winsys;