Commit 2dc50c9a authored by Frank Henigman's avatar Frank Henigman Committed by Chad Versace

waffle: add full screen window request

You can now put WAFFLE_WINDOW_FULLSCREEN in the attribute list passed
to waffle_window_create2() and get a full screen window.
Only glx and x11_egl implemented so far.
Signed-off-by: default avatarFrank Henigman <fjhenigman@google.com>
Reviewed-by: default avatarChad Versace <chad.versace@intel.com>
parent cfb9a4e0
......@@ -172,6 +172,7 @@ enum waffle_enum {
WAFFLE_WINDOW_WIDTH = 0x0310,
WAFFLE_WINDOW_HEIGHT = 0x0311,
WAFFLE_WINDOW_FULLSCREEN = 0x0312,
};
const char*
......
......@@ -149,6 +149,7 @@ enum waffle_enum {
WAFFLE_WINDOW_WIDTH = 0x0310,
WAFFLE_WINDOW_HEIGHT = 0x0311,
WAFFLE_WINDOW_FULLSCREEN = 0x0312,
};
]]>
</programlisting>
......
......@@ -121,11 +121,13 @@ struct waffle_window;
<parameter>config</parameter> and
<parameter>attrib_list</parameter>.
<parameter>attrib_list</parameter> must contain the attributes
<parameter>attrib_list</parameter> must specify the window size
either with the attributes
<constant>WAFFLE_WINDOW_WIDTH</constant> and
<constant>WAFFLE_WINDOW_HEIGHT</constant>,
whose values must be positive
and no greater than <constant>INT32_MAX</constant>.
<constant>WAFFLE_WINDOW_HEIGHT</constant> having positive values
&lt;= <constant>INT32_MAX</constant>,
or with the attribute
<constant>WAFFLE_WINDOW_FULLSCREEN</constant> equal to true(1).
</para>
</listitem>
</varlistentry>
......
......@@ -49,6 +49,12 @@ droid_window_create(struct wcore_platform *wc_plat,
(void) wc_plat;
if (width == -1 && height == -1) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"fullscreen window not supported");
return NULL;
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
}
......
......@@ -41,7 +41,9 @@ waffle_window_create2(
struct wcore_window *wc_self = NULL;
struct wcore_config *wc_config = wcore_config(config);
intptr_t *attrib_list_filtered = NULL;
intptr_t width = 0, height = 0;
intptr_t width = 1, height = 1;
bool need_size = true;
intptr_t fullscreen = WAFFLE_DONT_CARE;
const struct api_object *obj_list[] = {
wc_config ? &wc_config->api : NULL,
......@@ -53,15 +55,31 @@ waffle_window_create2(
attrib_list_filtered = wcore_attrib_list_copy(attrib_list);
wcore_attrib_list_pop(attrib_list_filtered,
WAFFLE_WINDOW_FULLSCREEN, &fullscreen);
if (fullscreen == WAFFLE_DONT_CARE)
fullscreen = 0; // default
if (fullscreen == 1) {
need_size = false;
} else if (fullscreen != 0) {
// Same error message as in wcore_config_attrs.c.
wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
"WAFFLE_WINDOW_FULLSCREEN has bad value 0x%x. "
"Must be true(1), false(0), or WAFFLE_DONT_CARE(-1)",
fullscreen);
goto done;
}
if (!wcore_attrib_list_pop(attrib_list_filtered,
WAFFLE_WINDOW_WIDTH, &width)) {
WAFFLE_WINDOW_WIDTH, &width) && need_size) {
wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
"required attribute WAFFLE_WINDOW_WIDTH is missing");
goto done;
}
if (!wcore_attrib_list_pop(attrib_list_filtered,
WAFFLE_WINDOW_HEIGHT, &height)) {
WAFFLE_WINDOW_HEIGHT, &height) && need_size) {
wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
"required attribute WAFFLE_WINDOW_HEIGHT is missing");
goto done;
......@@ -87,6 +105,9 @@ waffle_window_create2(
goto done;
}
if (fullscreen)
width = height = -1;
wc_self = api_platform->vtbl->window.create(api_platform,
wc_config,
(int32_t) width,
......
......@@ -102,6 +102,12 @@ cgl_window_create(struct wcore_platform *wc_plat,
struct cgl_window *self;
bool ok = true;
if (width == -1 && height == -1) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"fullscreen window not supported");
return NULL;
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
......@@ -113,6 +113,7 @@ wcore_enum_to_string(int32_t e)
CASE(WAFFLE_DL_OPENGL_ES3);
CASE(WAFFLE_WINDOW_WIDTH);
CASE(WAFFLE_WINDOW_HEIGHT);
CASE(WAFFLE_WINDOW_FULLSCREEN);
default: return NULL;
......
......@@ -70,6 +70,12 @@ wgbm_window_create(struct wcore_platform *wc_plat,
uint32_t gbm_format;
bool ok = true;
if (width == -1 && height == -1) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"fullscreen window not supported");
return NULL;
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
......@@ -62,6 +62,11 @@ glx_window_create(struct wcore_platform *wc_plat,
struct glx_config *config = glx_config(wc_config);
bool ok = true;
if (width == -1 && height == -1) {
width = DisplayWidth(dpy->x11.xlib, dpy->x11.screen);
height = DisplayHeight(dpy->x11.xlib, dpy->x11.screen);
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
......@@ -56,6 +56,12 @@ nacl_window_create(struct wcore_platform *wc_plat,
struct nacl_platform *nplat = nacl_platform(wc_plat);
bool ok = true;
if (width == -1 && height == -1) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"fullscreen window not supported");
return NULL;
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
......@@ -111,6 +111,12 @@ wayland_window_create(struct wcore_platform *wc_plat,
struct wayland_display *dpy = wayland_display(wc_config->display);
bool ok = true;
if (width == -1 && height == -1) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"fullscreen window not supported");
return NULL;
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
......@@ -78,6 +78,12 @@ wgl_window_create(struct wcore_platform *wc_plat,
assert(config->window);
if (width == -1 && height == -1) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"fullscreen window not supported");
return NULL;
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
......@@ -67,6 +67,11 @@ xegl_window_create(struct wcore_platform *wc_plat,
xcb_visualid_t visual;
bool ok = true;
if (width == -1 && height == -1) {
width = DisplayWidth(dpy->x11.xlib, dpy->x11.screen);
height = DisplayHeight(dpy->x11.xlib, dpy->x11.screen);
}
if (wcore_attrib_list_length(attrib_list) > 0) {
wcore_error_bad_attribute(attrib_list[0]);
return NULL;
......
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