[waffle] [PATCH 07/10] waffle: add full screen window request

Frank Henigman fjhenigman at google.com
Mon Mar 30 12:12:47 PDT 2015


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 <fjhenigman at google.com>
---
 include/waffle/waffle.h        |  1 +
 src/waffle/api/waffle_window.c | 69 ++++++++++++++++++++++--------------------
 src/waffle/glx/glx_window.c    | 12 ++++++--
 src/waffle/xegl/xegl_window.c  | 13 ++++++--
 4 files changed, 59 insertions(+), 36 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/src/waffle/api/waffle_window.c b/src/waffle/api/waffle_window.c
index 9ab63ca..10004c0 100644
--- a/src/waffle/api/waffle_window.c
+++ b/src/waffle/api/waffle_window.c
@@ -42,6 +42,7 @@ waffle_window_create2(
     struct wcore_config *wc_config = wcore_config(config);
     intptr_t *attrib_list_filtered = NULL;
     intptr_t width = 0, height = 0;
+    intptr_t unused;
 
     const struct api_object *obj_list[] = {
         wc_config ? &wc_config->api : NULL,
@@ -53,38 +54,42 @@ waffle_window_create2(
 
     attrib_list_filtered = wcore_attrib_list_copy(attrib_list);
 
-    if (!wcore_attrib_list_pop(attrib_list_filtered,
-                               WAFFLE_WINDOW_WIDTH, &width)) {
-        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)) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "required attribute WAFFLE_WINDOW_HEIGHT is missing");
-        goto done;
-    }
-
-    if (width <= 0) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "WAFFLE_WINDOW_WIDTH is not positive");
-        goto done;
-    } else if (width > INT32_MAX) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "WAFFLE_WINDOW_WIDTH is greater than INT32_MAX");
-        goto done;
-    }
-
-    if (height <= 0) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "WAFFLE_WINDOW_HEIGHT is not positive");
-        goto done;
-    } else if (height > INT32_MAX) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "WAFFLE_WINDOW_HEIGHT is greater than INT32_MAX");
-        goto done;
+    if (!wcore_attrib_list_get(attrib_list_filtered,
+                               WAFFLE_WINDOW_FULLSCREEN, &unused)) {
+
+        if (!wcore_attrib_list_pop(attrib_list_filtered,
+                                   WAFFLE_WINDOW_WIDTH, &width)) {
+            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)) {
+            wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
+                         "required attribute WAFFLE_WINDOW_HEIGHT is missing");
+            goto done;
+        }
+
+        if (width <= 0) {
+            wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
+                         "WAFFLE_WINDOW_WIDTH is not positive");
+            goto done;
+        } else if (width > INT32_MAX) {
+            wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
+                         "WAFFLE_WINDOW_WIDTH is greater than INT32_MAX");
+            goto done;
+        }
+
+        if (height <= 0) {
+            wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
+                         "WAFFLE_WINDOW_HEIGHT is not positive");
+            goto done;
+        } else if (height > INT32_MAX) {
+            wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
+                         "WAFFLE_WINDOW_HEIGHT is greater than INT32_MAX");
+            goto done;
+        }
     }
 
     wc_self = api_platform->vtbl->window.create(api_platform,
diff --git a/src/waffle/glx/glx_window.c b/src/waffle/glx/glx_window.c
index 331bb51..8be188c 100644
--- a/src/waffle/glx/glx_window.c
+++ b/src/waffle/glx/glx_window.c
@@ -61,9 +61,17 @@ glx_window_create(struct wcore_platform *wc_plat,
     struct glx_display *dpy = glx_display(wc_config->display);
     struct glx_config *config = glx_config(wc_config);
     bool ok = true;
+    intptr_t unused;
+    size_t expect = 0;
 
-    if (wcore_attrib_list_length(attrib_list) > 0) {
-        wcore_error_bad_attribute(attrib_list[0]);
+    if (wcore_attrib_list_get(attrib_list, WAFFLE_WINDOW_FULLSCREEN, &unused)) {
+        width = DisplayWidth(dpy->x11.xlib, dpy->x11.screen);
+        height = DisplayHeight(dpy->x11.xlib, dpy->x11.screen);
+        expect = 1;
+    }
+
+    if (wcore_attrib_list_length(attrib_list) > expect) {
+        wcore_error_bad_attribute(attrib_list[expect]);
         return NULL;
     }
 
diff --git a/src/waffle/xegl/xegl_window.c b/src/waffle/xegl/xegl_window.c
index ab66314..511158a 100644
--- a/src/waffle/xegl/xegl_window.c
+++ b/src/waffle/xegl/xegl_window.c
@@ -66,9 +66,18 @@ xegl_window_create(struct wcore_platform *wc_plat,
     struct wegl_platform *plat = wegl_platform(wc_plat);
     xcb_visualid_t visual;
     bool ok = true;
+    intptr_t unused;
+    size_t expect = 0;
+
+    if (wcore_attrib_list_get(attrib_list, WAFFLE_WINDOW_FULLSCREEN, &unused))
+ {
+        width = DisplayWidth(dpy->x11.xlib, dpy->x11.screen);
+        height = DisplayHeight(dpy->x11.xlib, dpy->x11.screen);
+        expect = 1;
+    }
 
-    if (wcore_attrib_list_length(attrib_list) > 0) {
-        wcore_error_bad_attribute(attrib_list[0]);
+    if (wcore_attrib_list_length(attrib_list) > expect) {
+        wcore_error_bad_attribute(attrib_list[expect]);
         return NULL;
     }
 
-- 
2.2.0.rc0.207.ga3a616c



More information about the waffle mailing list