[mutter] cogl: fix a compile warning



commit 7c036c58969ff2b7b8cd6234fcdd2a0d06923544
Author: Thomas Hindoe Paaboel Andersen <phomes gmail com>
Date:   Sat Oct 26 18:52:44 2019 +0200

    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

 cogl/cogl/winsys/cogl-winsys-egl-x11.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
index a87d0c110..47fb9676a 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]