From da14dbe4e5a40fccf9155f4cd87c97457f9439d6 Mon Sep 17 00:00:00 2001 From: William Hua Date: Mon, 22 Jun 2015 12:31:32 -0400 Subject: [PATCH] mir: fix toggling between maximized and restored --- gdk/mir/gdkmireventsource.c | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c index 6fe31974fc..c088ca4338 100644 --- a/gdk/mir/gdkmireventsource.c +++ b/gdk/mir/gdkmireventsource.c @@ -412,6 +412,7 @@ static void handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event) { GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); + MirSurfaceState state; switch (mir_surface_event_get_attribute (event)) { @@ -419,8 +420,43 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event) _gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event)); break; case mir_surface_attrib_state: - _gdk_mir_window_impl_set_surface_state (impl, mir_surface_event_get_attribute_value (event)); - // FIXME: notify + state = mir_surface_event_get_attribute_value (event); + _gdk_mir_window_impl_set_surface_state (impl, state); + + switch (state) + { + case mir_surface_state_restored: + case mir_surface_state_hidden: + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_ICONIFIED | + GDK_WINDOW_STATE_MAXIMIZED | + GDK_WINDOW_STATE_FULLSCREEN, + 0); + break; + case mir_surface_state_minimized: + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_MAXIMIZED | + GDK_WINDOW_STATE_FULLSCREEN, + GDK_WINDOW_STATE_ICONIFIED); + break; + case mir_surface_state_maximized: + case mir_surface_state_vertmaximized: + case mir_surface_state_horizmaximized: + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_ICONIFIED | + GDK_WINDOW_STATE_FULLSCREEN, + GDK_WINDOW_STATE_MAXIMIZED); + break; + case mir_surface_state_fullscreen: + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_ICONIFIED | + GDK_WINDOW_STATE_MAXIMIZED, + GDK_WINDOW_STATE_FULLSCREEN); + break; + default: + break; + } + break; case mir_surface_attrib_swapinterval: break;