[waffle] [PATCH 12/17] core: Add attrib_list param to func (v2) wcore_platform::window::create

Chad Versace chad.versace at intel.com
Sun Jan 4 14:03:05 PST 2015


This prepares for adding waffle_window_create2() to Waffle's public API,
which will have an attrib_list parameter.

No attributes are supported yet.  Therefore this patch validates, at the
top of each ${PLATFORM}_window_create(), that the attrib_list is empty.

Signed-off-by: Chad Versace <chad.versace at intel.com>
---

v2:
    - Add missing #include in droid_window.h. [emil]
    - Move an #include from .h to .c file. [emil]

 src/waffle/android/droid_window.c   |  8 +++++++-
 src/waffle/api/waffle_window.c      |  3 ++-
 src/waffle/cgl/cgl_window.h         |  3 ++-
 src/waffle/cgl/cgl_window.m         |  9 ++++++++-
 src/waffle/core/wcore_platform.h    |  3 ++-
 src/waffle/gbm/wgbm_window.c        |  9 ++++++++-
 src/waffle/gbm/wgbm_window.h        |  3 ++-
 src/waffle/glx/glx_window.c         |  9 ++++++++-
 src/waffle/glx/glx_window.h         |  5 +++--
 src/waffle/wayland/wayland_window.c | 11 +++++++++--
 src/waffle/wayland/wayland_window.h |  3 ++-
 src/waffle/wgl/wgl_window.c         |  9 ++++++++-
 src/waffle/wgl/wgl_window.h         |  3 ++-
 src/waffle/xegl/xegl_window.c       |  9 ++++++++-
 src/waffle/xegl/xegl_window.h       |  5 +++--
 15 files changed, 74 insertions(+), 18 deletions(-)

diff --git a/src/waffle/android/droid_window.c b/src/waffle/android/droid_window.c
index 98e8d2d..20a566f 100644
--- a/src/waffle/android/droid_window.c
+++ b/src/waffle/android/droid_window.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "wegl_config.h"
@@ -38,13 +39,18 @@ struct wcore_window*
 droid_window_create(struct wcore_platform *wc_plat,
                     struct wcore_config *wc_config,
                     int32_t width,
-                    int32_t height)
+                    int32_t height,
+                    const intptr_t attrib_list[])
 {
     struct droid_window *self;
     struct wegl_config *config = wegl_config(wc_config);
     struct droid_display *dpy = droid_display(wc_config->display);
     bool ok = true;
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+    }
+
     self = wcore_calloc(sizeof(*self));
     if (self == NULL)
         return NULL;
diff --git a/src/waffle/api/waffle_window.c b/src/waffle/api/waffle_window.c
index e0ccebe..34ecc4a 100644
--- a/src/waffle/api/waffle_window.c
+++ b/src/waffle/api/waffle_window.c
@@ -50,7 +50,8 @@ waffle_window_create(
     wc_self = api_platform->vtbl->window.create(api_platform,
                                                 wc_config,
                                                 width,
-                                                height);
+                                                height,
+                                                NULL /*attrib_list*/);
     if (!wc_self)
         return NULL;
 
diff --git a/src/waffle/cgl/cgl_window.h b/src/waffle/cgl/cgl_window.h
index ee6fa67..b565d58 100644
--- a/src/waffle/cgl/cgl_window.h
+++ b/src/waffle/cgl/cgl_window.h
@@ -49,7 +49,8 @@ struct wcore_window*
 cgl_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
                   int32_t width,
-                  int32_t height);
+                  int32_t height,
+                  const intptr_t attrib_list[]);
 
 bool
 cgl_window_destroy(struct wcore_window *wc_self);
diff --git a/src/waffle/cgl/cgl_window.m b/src/waffle/cgl/cgl_window.m
index 32049f8..5ff1ec7 100644
--- a/src/waffle/cgl/cgl_window.m
+++ b/src/waffle/cgl/cgl_window.m
@@ -26,6 +26,7 @@
 #import <Cocoa/Cocoa.h>
 #import <OpenGL/OpenGL.h>
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "cgl_config.h"
@@ -95,11 +96,17 @@ struct wcore_window*
 cgl_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
                   int32_t width,
-                  int32_t height)
+                  int32_t height,
+                  const intptr_t attrib_list[])
 {
     struct cgl_window *self;
     bool ok = true;
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+        return NULL;
+    }
+
     self = wcore_calloc(sizeof(*self));
     if (!self)
         return NULL;
diff --git a/src/waffle/core/wcore_platform.h b/src/waffle/core/wcore_platform.h
index 381db5c..2f9b9f8 100644
--- a/src/waffle/core/wcore_platform.h
+++ b/src/waffle/core/wcore_platform.h
@@ -115,7 +115,8 @@ struct wcore_platform_vtbl {
         (*create)(struct wcore_platform *platform,
                   struct wcore_config *config,
                   int32_t width,
-                  int32_t height);
+                  int32_t height,
+                  const intptr_t attrib_list[]);
         bool
         (*destroy)(struct wcore_window *window);
 
diff --git a/src/waffle/gbm/wgbm_window.c b/src/waffle/gbm/wgbm_window.c
index 748e72d..9fbf1be 100644
--- a/src/waffle/gbm/wgbm_window.c
+++ b/src/waffle/gbm/wgbm_window.c
@@ -30,6 +30,7 @@
 
 #include "waffle_gbm.h"
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "wegl_config.h"
@@ -60,7 +61,8 @@ struct wcore_window*
 wgbm_window_create(struct wcore_platform *wc_plat,
                    struct wcore_config *wc_config,
                    int32_t width,
-                   int32_t height)
+                   int32_t height,
+                   const intptr_t attrib_list[])
 {
     struct wgbm_display *dpy = wgbm_display(wc_config->display);
     struct wgbm_platform *plat = wgbm_platform(wegl_platform(wc_plat));
@@ -68,6 +70,11 @@ wgbm_window_create(struct wcore_platform *wc_plat,
     uint32_t gbm_format;
     bool ok = true;
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+        return NULL;
+    }
+
     self = wcore_calloc(sizeof(*self));
     if (self == NULL)
         return NULL;
diff --git a/src/waffle/gbm/wgbm_window.h b/src/waffle/gbm/wgbm_window.h
index 47a75c4..7827823 100644
--- a/src/waffle/gbm/wgbm_window.h
+++ b/src/waffle/gbm/wgbm_window.h
@@ -53,7 +53,8 @@ struct wcore_window*
 wgbm_window_create(struct wcore_platform *wc_plat,
                    struct wcore_config *wc_config,
                    int32_t width,
-                   int32_t height);
+                   int32_t height,
+                   const intptr_t attrib_list[]);
 
 bool
 wgbm_window_destroy(struct wcore_window *wc_self);
diff --git a/src/waffle/glx/glx_window.c b/src/waffle/glx/glx_window.c
index 5adf632..331bb51 100644
--- a/src/waffle/glx/glx_window.c
+++ b/src/waffle/glx/glx_window.c
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <xcb/xcb.h>
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "glx_config.h"
@@ -53,13 +54,19 @@ struct wcore_window*
 glx_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
                   int32_t width,
-                  int32_t height)
+                  int32_t height,
+                  const intptr_t attrib_list[])
 {
     struct glx_window *self;
     struct glx_display *dpy = glx_display(wc_config->display);
     struct glx_config *config = glx_config(wc_config);
     bool ok = true;
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+        return NULL;
+    }
+
     self = wcore_calloc(sizeof(*self));
     if (self == NULL)
         return NULL;
diff --git a/src/waffle/glx/glx_window.h b/src/waffle/glx/glx_window.h
index 5aed497..b4fd7f9 100644
--- a/src/waffle/glx/glx_window.h
+++ b/src/waffle/glx/glx_window.h
@@ -46,8 +46,9 @@ DEFINE_CONTAINER_CAST_FUNC(glx_window,
 struct wcore_window*
 glx_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
-                  int width,
-                  int height);
+                  int32_t width,
+                  int32_t height,
+                  const intptr_t attrib_list[]);
 
 bool
 glx_window_destroy(struct wcore_window *wc_self);
diff --git a/src/waffle/wayland/wayland_window.c b/src/waffle/wayland/wayland_window.c
index f32e995..4ac9c16 100644
--- a/src/waffle/wayland/wayland_window.c
+++ b/src/waffle/wayland/wayland_window.c
@@ -33,6 +33,7 @@
 
 #include "waffle_wayland.h"
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "wegl_config.h"
@@ -96,13 +97,19 @@ static const struct wl_shell_surface_listener shell_surface_listener = {
 struct wcore_window*
 wayland_window_create(struct wcore_platform *wc_plat,
                       struct wcore_config *wc_config,
-                      int width,
-                      int height)
+                      int32_t width,
+                      int32_t height,
+                      const intptr_t attrib_list[])
 {
     struct wayland_window *self;
     struct wayland_display *dpy = wayland_display(wc_config->display);
     bool ok = true;
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+        return NULL;
+    }
+
     self = wcore_calloc(sizeof(*self));
     if (self == NULL)
         return NULL;
diff --git a/src/waffle/wayland/wayland_window.h b/src/waffle/wayland/wayland_window.h
index 3e4dbfb..11e6791 100644
--- a/src/waffle/wayland/wayland_window.h
+++ b/src/waffle/wayland/wayland_window.h
@@ -60,7 +60,8 @@ struct wcore_window*
 wayland_window_create(struct wcore_platform *wc_plat,
                       struct wcore_config *wc_config,
                       int32_t width,
-                      int32_t height);
+                      int32_t height,
+                      const intptr_t attrib_list[]);
 
 bool
 wayland_window_destroy(struct wcore_window *wc_self);
diff --git a/src/waffle/wgl/wgl_window.c b/src/waffle/wgl/wgl_window.c
index ad8cf6f..99dd194 100644
--- a/src/waffle/wgl/wgl_window.c
+++ b/src/waffle/wgl/wgl_window.c
@@ -25,6 +25,7 @@
 
 #include <windows.h>
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "wgl_config.h"
@@ -69,13 +70,19 @@ struct wcore_window*
 wgl_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
                   int32_t width,
-                  int32_t height)
+                  int32_t height,
+                  const intptr_t attrib_list[])
 {
     struct wgl_config *config = wgl_config(wc_config);
     bool ok;
 
     assert(config->window);
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+        return NULL;
+    }
+
     // Currently we do not allow multiple windows per config.
     // Neither piglit nor the waffle examples do that yet, so just
     // return NULL in case that ever changes.
diff --git a/src/waffle/wgl/wgl_window.h b/src/waffle/wgl/wgl_window.h
index 34beac8..9b11509 100644
--- a/src/waffle/wgl/wgl_window.h
+++ b/src/waffle/wgl/wgl_window.h
@@ -58,7 +58,8 @@ struct wcore_window*
 wgl_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
                   int32_t width,
-                  int32_t height);
+                  int32_t height,
+                  const intptr_t attrib_list[]);
 
 bool
 wgl_window_destroy(struct wcore_window *wc_self);
diff --git a/src/waffle/xegl/xegl_window.c b/src/waffle/xegl/xegl_window.c
index 9a20f75..ab66314 100644
--- a/src/waffle/xegl/xegl_window.c
+++ b/src/waffle/xegl/xegl_window.c
@@ -28,6 +28,7 @@
 
 #include <xcb/xcb.h>
 
+#include "wcore_attrib_list.h"
 #include "wcore_error.h"
 
 #include "wegl_config.h"
@@ -56,7 +57,8 @@ struct wcore_window*
 xegl_window_create(struct wcore_platform *wc_plat,
                    struct wcore_config *wc_config,
                    int32_t width,
-                   int32_t height)
+                   int32_t height,
+                   const intptr_t attrib_list[])
 {
     struct xegl_window *self;
     struct xegl_display *dpy = xegl_display(wc_config->display);
@@ -65,6 +67,11 @@ xegl_window_create(struct wcore_platform *wc_plat,
     xcb_visualid_t visual;
     bool ok = true;
 
+    if (wcore_attrib_list_length(attrib_list) > 0) {
+        wcore_error_bad_attribute(attrib_list[0]);
+        return NULL;
+    }
+
     self = wcore_calloc(sizeof(*self));
     if (self == NULL)
         return NULL;
diff --git a/src/waffle/xegl/xegl_window.h b/src/waffle/xegl/xegl_window.h
index 1f963ba..e59c02f 100644
--- a/src/waffle/xegl/xegl_window.h
+++ b/src/waffle/xegl/xegl_window.h
@@ -56,8 +56,9 @@ xegl_window(struct wcore_window *wc_self)
 struct wcore_window*
 xegl_window_create(struct wcore_platform *wc_plat,
                    struct wcore_config *wc_config,
-                   int width,
-                   int height);
+                   int32_t width,
+                   int32_t height,
+                   const intptr_t attrib_list[]);
 
 bool
 xegl_window_destroy(struct wcore_window *wc_self);
-- 
2.2.0



More information about the waffle mailing list