clients: simple-egl: Restore window size when un-maximized

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@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Tomohiro Komagata 7 years ago committed by Daniel Stone
parent 43c5a65b03
commit 7861fa9151
  1. 10
      clients/simple-egl.c

@ -100,7 +100,7 @@ struct window {
struct ivi_surface *ivi_surface; struct ivi_surface *ivi_surface;
EGLSurface egl_surface; EGLSurface egl_surface;
struct wl_callback *callback; 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; bool wait_for_configure;
}; };
@ -317,23 +317,27 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
uint32_t *p; uint32_t *p;
window->fullscreen = 0; window->fullscreen = 0;
window->maximized = 0;
wl_array_for_each(p, states) { wl_array_for_each(p, states) {
uint32_t state = *p; uint32_t state = *p;
switch (state) { switch (state) {
case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
window->fullscreen = 1; window->fullscreen = 1;
break; break;
case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
window->maximized = 1;
break;
} }
} }
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
if (!window->fullscreen) { if (!window->fullscreen && !window->maximized) {
window->window_size.width = width; window->window_size.width = width;
window->window_size.height = height; window->window_size.height = height;
} }
window->geometry.width = width; window->geometry.width = width;
window->geometry.height = height; window->geometry.height = height;
} else if (!window->fullscreen) { } else if (!window->fullscreen && !window->maximized) {
window->geometry = window->window_size; window->geometry = window->window_size;
} }

Loading…
Cancel
Save