Commit 73227a11 authored by Chad Versace's avatar Chad Versace

core: Add attrib_list param to func wcore_platform::window::create

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: default avatarChad Versace <chad.versace@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com> (msvc/wgl)
Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.l.velikov@gmail.com>
parent d2594d1e
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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.
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment