[PATCH] toytoolkit: Handle the close button without upsetting state

Jason Ekstrand jason at jlekstrand.net
Fri Nov 1 02:49:35 CET 2013


This is a better fix than 4a7409a1 because it maintains proper state in the
frame in the case where the client actually has a close handler.  The other
would not properly reset the frame state and didn't check the last two
statusses
---
 clients/window.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index dd6a213..fca992b 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2390,15 +2390,6 @@ frame_handle_status(struct window_frame *frame, struct input *input,
 		frame_status_clear(frame->frame, FRAME_STATUS_MAXIMIZE);
 	}
 
-	if (status & FRAME_STATUS_CLOSE) {
-		if (window->close_handler)
-			window->close_handler(window->parent,
-					      window->user_data);
-		else
-			display_exit(window->display);
-		return;
-	}
-
 	if ((status & FRAME_STATUS_MOVE) && window->shell_surface) {
 		input_ungrab(input);
 		wl_shell_surface_move(window->shell_surface,
@@ -2419,6 +2410,16 @@ frame_handle_status(struct window_frame *frame, struct input *input,
 
 		frame_status_clear(frame->frame, FRAME_STATUS_RESIZE);
 	}
+
+	if (status & FRAME_STATUS_CLOSE) {
+		frame_status_clear(frame->frame, FRAME_STATUS_CLOSE);
+		if (window->close_handler)
+			window->close_handler(window->parent,
+					      window->user_data);
+		else
+			display_exit(window->display);
+		return;
+	}
 }
 
 static void
-- 
1.8.3.1



More information about the wayland-devel mailing list