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: Frank Henigman <[email protected]> --- v2 - value, not mere presence, of WAFFLE_WINDOW_FULLSCREEN attribute determines full screen request - process all size attributes in waffle_window_create2() so the platforms don't have to - return an error from all platforms that don't support full screen - NOTE: I HAVE NOT EVEN COMPILED MOST OF THESE - update wcore_enum_to_string() - update documentation include/waffle/waffle.h | 1 + man/waffle_enum.3.xml | 1 + man/waffle_window.3.xml | 10 ++++++---- src/waffle/android/droid_window.c | 6 ++++++ src/waffle/api/waffle_window.c | 27 ++++++++++++++++++++++++--- src/waffle/cgl/cgl_window.m | 6 ++++++ src/waffle/core/wcore_util.c | 1 + src/waffle/gbm/wgbm_window.c | 6 ++++++ src/waffle/glx/glx_window.c | 5 +++++ src/waffle/nacl/nacl_window.c | 6 ++++++ src/waffle/wayland/wayland_window.c | 6 ++++++ src/waffle/wgl/wgl_window.c | 6 ++++++ src/waffle/xegl/xegl_window.c | 5 +++++ 13 files changed, 79 insertions(+), 7 deletions(-) diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h index 297a487..df0218e 100644 --- a/include/waffle/waffle.h +++ b/include/waffle/waffle.h @@ -172,6 +172,7 @@ enum waffle_enum { WAFFLE_WINDOW_WIDTH = 0x0310, WAFFLE_WINDOW_HEIGHT = 0x0311, + WAFFLE_WINDOW_FULLSCREEN = 0x0312, }; const char* diff --git a/man/waffle_enum.3.xml b/man/waffle_enum.3.xml index 4874fe7..cff1ee6 100644 --- a/man/waffle_enum.3.xml +++ b/man/waffle_enum.3.xml @@ -149,6 +149,7 @@ enum waffle_enum { WAFFLE_WINDOW_WIDTH = 0x0310, WAFFLE_WINDOW_HEIGHT = 0x0311, + WAFFLE_WINDOW_FULLSCREEN = 0x0312, }; ]]> </programlisting> diff --git a/man/waffle_window.3.xml b/man/waffle_window.3.xml index 795152a..96fe08b 100644 --- a/man/waffle_window.3.xml +++ b/man/waffle_window.3.xml @@ -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 + <= <constant>INT32_MAX</constant>, + or with the attribute + <constant>WAFFLE_WINDOW_FULLSCREEN</constant> equal to true(1). </para> </listitem> </varlistentry> diff --git a/src/waffle/android/droid_window.c b/src/waffle/android/droid_window.c index b826ff9..048a2bb 100644 --- a/src/waffle/android/droid_window.c +++ b/src/waffle/android/droid_window.c @@ -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]); } diff --git a/src/waffle/api/waffle_window.c b/src/waffle/api/waffle_window.c index 9ab63ca..d26797f 100644 --- a/src/waffle/api/waffle_window.c +++ b/src/waffle/api/waffle_window.c @@ -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, diff --git a/src/waffle/cgl/cgl_window.m b/src/waffle/cgl/cgl_window.m index 5ff1ec7..91273c5 100644 --- a/src/waffle/cgl/cgl_window.m +++ b/src/waffle/cgl/cgl_window.m @@ -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; diff --git a/src/waffle/core/wcore_util.c b/src/waffle/core/wcore_util.c index b7809a3..c563fae 100644 --- a/src/waffle/core/wcore_util.c +++ b/src/waffle/core/wcore_util.c @@ -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; diff --git a/src/waffle/gbm/wgbm_window.c b/src/waffle/gbm/wgbm_window.c index b75b5e3..313304b 100644 --- a/src/waffle/gbm/wgbm_window.c +++ b/src/waffle/gbm/wgbm_window.c @@ -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; diff --git a/src/waffle/glx/glx_window.c b/src/waffle/glx/glx_window.c index 331bb51..52efb61 100644 --- a/src/waffle/glx/glx_window.c +++ b/src/waffle/glx/glx_window.c @@ -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; diff --git a/src/waffle/nacl/nacl_window.c b/src/waffle/nacl/nacl_window.c index dc8d49c..1191f51 100644 --- a/src/waffle/nacl/nacl_window.c +++ b/src/waffle/nacl/nacl_window.c @@ -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; diff --git a/src/waffle/wayland/wayland_window.c b/src/waffle/wayland/wayland_window.c index b5eeaa3..2c4ebc8 100644 --- a/src/waffle/wayland/wayland_window.c +++ b/src/waffle/wayland/wayland_window.c @@ -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; diff --git a/src/waffle/wgl/wgl_window.c b/src/waffle/wgl/wgl_window.c index 99dd194..316fb1d 100644 --- a/src/waffle/wgl/wgl_window.c +++ b/src/waffle/wgl/wgl_window.c @@ -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; diff --git a/src/waffle/xegl/xegl_window.c b/src/waffle/xegl/xegl_window.c index ab66314..cd2be46 100644 --- a/src/waffle/xegl/xegl_window.c +++ b/src/waffle/xegl/xegl_window.c @@ -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; -- 2.2.0.rc0.207.ga3a616c _______________________________________________ waffle mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/waffle

