summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-12-24 11:13:02 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-12-24 11:13:02 +0100
commitb26db74dd0be8e4f4728e976144cb15e64b677a5 (patch)
treea6e8766f7c8118b0a8910f1126bb87ba063e630a
parente7eac09cf8c4fc9ad307ea8dbacccee4d74f330b (diff)
Fix for "Fatal error while communicating with the Wayland server" (#610)
This commit should fix: once the mouse leaves the app window area and returns back to it (app loses focus and gets it again) the crash happens.
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 560756870..09a0feb1a 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -450,7 +450,7 @@ void Fl_Wayland_Window_Driver::hide() {
wld_win->frame = NULL;
wld_win->xdg_surface = NULL;
} else {
- if (wld_win->kind == POPUP) {
+ if (wld_win->kind == POPUP && wld_win->xdg_popup) {
popup_done(wld_win, wld_win->xdg_popup);
wld_win->xdg_popup = NULL;
}
@@ -904,6 +904,12 @@ static void popup_done(void *data, struct xdg_popup *xdg_popup) {
}
#endif
xdg_popup_destroy(xdg_popup);
+ // The sway compositor calls popup_done directly and hides the menu
+ // when the app looses focus.
+ // Thus, we hide the window so FLTK and Wayland are in matching states.
+ struct wld_window *window = (struct wld_window*)data;
+ window->xdg_popup = NULL;
+ window->fl_win->hide();
}
static const struct xdg_popup_listener popup_listener = {