[PATCH] clients: simple-egl: Restore window size when un-maximized

Tomohiro Komagata tomohiro.komagata.aj at gmail.com
Mon Jun 26 16:01:39 UTC 2017


The window position was correct but the window size was wrong
when simple-egl returns from maximized window to un-maximized.
Its size should be restored to original size.

Signed-off-by: Tomohiro Komagata <tomohiro.komagata.aj at gmail.com>
---
  clients/simple-egl.c | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index dad0f09..c2c6a1f 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -100,7 +100,7 @@ struct window {
      struct ivi_surface *ivi_surface;
      EGLSurface egl_surface;
      struct wl_callback *callback;
-    int fullscreen, opaque, buffer_size, frame_sync, delay;
+    int fullscreen, maximized, opaque, buffer_size, frame_sync, delay;
      bool wait_for_configure;
  };

@@ -317,9 +317,14 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
      uint32_t *p;

      window->fullscreen = 0;
+    window->maximized = 0;
+
      wl_array_for_each(p, states) {
          uint32_t state = *p;
          switch (state) {
+        case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
+            window->maximized = 1;
+            break;
          case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
              window->fullscreen = 1;
              break;
@@ -327,13 +332,13 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
      }

      if (width > 0 && height > 0) {
-        if (!window->fullscreen) {
+        if (!window->fullscreen && !window->maximized) {
              window->window_size.width = width;
              window->window_size.height = height;
          }
          window->geometry.width = width;
          window->geometry.height = height;
-    } else if (!window->fullscreen) {
+    } else if (!window->fullscreen && !window->maximized) {
          window->geometry = window->window_size;
      }

-- 
2.7.4



More information about the wayland-devel mailing list