From 65ae4ac8844bd1eb0baab85dd210929ffd34e2b8 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Fri, 13 Feb 2015 17:14:47 +0100 Subject: [PATCH] X11 backend: fix window behavior with multiple show() calls When libwlmessage was called multiple times within a single program (with the X11 backend), the first window would not disappear after validation because the main loop was being exited without a proper destroy call. This also prevented other windows from showing up. Fixed. Change-Id: I07836b1de1ca8725a941b9d988e525c11e7740e3 Signed-off-by: Manuel Bachmann --- libwlmessage-x11.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libwlmessage-x11.c b/libwlmessage-x11.c index 5714334..df2646b 100644 --- a/libwlmessage-x11.c +++ b/libwlmessage-x11.c @@ -664,6 +664,7 @@ wlmessage_show (struct wlmessage *wlmessage, char **input_text) struct message_window *message_window = wlmessage->message_window; Widget form, label, entry, form_b; + XEvent ev; XWindowChanges wc; XSizeHints sh; WMHints wm_hints; @@ -804,6 +805,11 @@ form: /* main loop */ XtAppMainLoop (wlmessage->app); + /* last iteration to destroy the window */ + XtUnrealizeWidget (message_window->window); + XtAppNextEvent (wlmessage->app, &ev); + XtDispatchEvent (&ev); + if (entry) { XawTextBlock buffer; XawTextSourceRead (XawTextGetSource(entry), 0, &buffer, 30); -- 2.7.4