[PATCH 16/18] shell: Do not crash when hiding input_panel

Jan Arne Petersen jpetersen at openismus.com
Wed Jan 16 12:26:53 PST 2013


From: Jan Arne Petersen <jpetersen at openismus.com>

Allow an input panel to attach a NULL-buffer for hiding.

Signed-off-by: Jan Arne Petersen <jpetersen at openismus.com>
---
 src/shell.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 1bc6142..0f25663 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3223,11 +3223,17 @@ bind_screensaver(struct wl_client *client,
 static void
 input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 {
-	struct weston_mode *mode = surface->output->current;
+	struct weston_mode *mode;
 	int32_t width = weston_surface_buffer_width(surface);
 	int32_t height = weston_surface_buffer_height(surface);
-	float x = (mode->width - width) / 2;
-	float y = mode->height - height;
+	float x, y;
+
+	if (!weston_surface_is_mapped(surface))
+		return;
+
+	mode = surface->output->current;
+	x = (mode->width - width) / 2;
+	y = mode->height - height;
 
 	/* Don't map the input panel here, wait for
 	 * show_input_panels signal. */
-- 
1.8.1



More information about the wayland-devel mailing list