diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-08-02 10:04:45 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-08-02 10:04:45 +0200 |
| commit | b440c26e65720f80e249d7123d2ae80aa8f43f82 (patch) | |
| tree | a976510fdfca9245799e8c3a7438001fe4776bfc | |
| parent | e12eb99b5dc272f0d11eda4be60e5198430b4c4f (diff) | |
Wayland: fix window closing with Sway's kill command or app menu
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index ba35d2920..e6fa514ce 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -444,7 +444,7 @@ void Fl_Wayland_Window_Driver::hide() { wld_win->subsurface = NULL; } if (wld_win->kind == DECORATED) { - if (wld_win->frame) libdecor_frame_unref(wld_win->frame); + libdecor_frame_unref(wld_win->frame); wld_win->frame = NULL; wld_win->xdg_surface = NULL; } else { @@ -886,20 +886,18 @@ void Fl_Wayland_Window_Driver::wait_for_expose() } static void delayed_close(void *data) { - if (data) { - Fl::remove_check(delayed_close, data); - Fl::handle(FL_CLOSE, (Fl_Window*)data); - Fl::add_timeout(0.01, delayed_close, NULL); // necessary for closing with app menu - } + Fl::remove_check(delayed_close, data); + Fl::handle(FL_CLOSE, (Fl_Window*)data); } static void handle_close(struct libdecor_frame *frame, void *user_data) { // runs when the close button of a window titlebar is pushed // or after "Quit" of the application menu - libdecor_frame_unref(frame); // may or may not release frame + // or after the Kill command of Sway struct wld_window* wl_win = (struct wld_window*)user_data; + // the close window attempt is delayed because libdecor + // uses the frame after return from this function Fl::add_check(delayed_close, wl_win->fl_win); - wl_win->frame = NULL; } |
