summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-03-27 11:06:17 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-03-27 11:06:17 +0200
commit31b5d5b562b71f913a8ab29cad72daa2d8018bd9 (patch)
tree07299db4f823ad51be9559254afea59378196442 /src/drivers
parentcce40848ce89df2b3a68cbda2aae3e03feee3cfa (diff)
Complete Fl_Wayland_Screen_Driver::close_display()
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.H3
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx46
2 files changed, 46 insertions, 3 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index 4662efce6..c36cf49e4 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -1,5 +1,5 @@
//
-// Definition of X11 Screen interface
+// Definition of the Wayland Screen interface
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2023 by Bill Spitzak and others.
@@ -34,7 +34,6 @@ struct seat {
struct wl_keyboard *wl_keyboard;
uint32_t keyboard_enter_serial;
struct wl_surface *keyboard_surface;
- struct wl_list link;
struct wl_list pointer_outputs;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor *default_cursor;
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 2eaa69b0d..6371a4c2c 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -1195,14 +1195,58 @@ void Fl_Wayland_Screen_Driver::open_display_platform() {
fl_create_print_window();
}
+
void Fl_Wayland_Screen_Driver::close_display() {
+ if (text_input_base) {
+ disable_im();
+ zwp_text_input_manager_v3_destroy(text_input_base);
+ text_input_base = NULL;
+ }
+ while (wl_list_length(&outputs) > 0) {
+ Fl_Wayland_Screen_Driver::output *output;
+ wl_list_for_each(output, &outputs, link) {
+ wl_list_remove(&output->link);
+ screen_count_set( wl_list_length(&outputs) );
+ if (output->wl_output) wl_output_destroy(output->wl_output);
+ free(output);
+ break;
+ }
+ }
+ wl_subcompositor_destroy(wl_subcompositor); wl_subcompositor = NULL;
+ wl_surface_destroy(seat->cursor_surface); seat->cursor_surface = NULL;
+ wl_cursor_theme_destroy(seat->cursor_theme); seat->cursor_theme = NULL;
+ wl_compositor_destroy(wl_compositor); wl_compositor = NULL;
+ wl_shm_destroy(wl_shm); wl_shm = NULL;
+ if (seat->wl_keyboard) {
+ xkb_state_unref(seat->xkb_state); seat->xkb_state = NULL;
+ xkb_keymap_unref(seat->xkb_keymap); seat->xkb_keymap = NULL;
+ wl_keyboard_destroy(seat->wl_keyboard);
+ seat->wl_keyboard = NULL;
+ }
+ wl_pointer_destroy(seat->wl_pointer); seat->wl_pointer = NULL;
+ xkb_compose_state_unref(seat->xkb_compose_state); seat->xkb_compose_state = NULL;
+ xkb_context_unref(seat->xkb_context); seat->xkb_context = NULL;
+ if (seat->data_source) {
+ wl_data_source_destroy(seat->data_source);
+ seat->data_source = NULL;
+ }
+ wl_data_device_destroy(seat->data_device); seat->data_device = NULL;
+ wl_data_device_manager_destroy(seat->data_device_manager); seat->data_device_manager = NULL;
+ wl_seat_destroy(seat->wl_seat); seat->wl_seat = NULL;
+ if (seat->name) free(seat->name);
+ delete seat; seat = NULL;
+ if (libdecor_context) {
+ libdecor_unref(libdecor_context);
+ libdecor_context = NULL;
+ }
+ xdg_wm_base_destroy(xdg_wm_base); xdg_wm_base = NULL;
Fl_Wayland_Plugin *plugin = Fl_Wayland_Window_Driver::gl_plugin();
if (plugin) plugin->terminate();
Fl::remove_fd(wl_display_get_fd(Fl_Wayland_Screen_Driver::wl_display));
+ wl_registry_destroy(wl_registry); wl_registry = NULL;
wl_display_disconnect(Fl_Wayland_Screen_Driver::wl_display);
Fl_Wayland_Screen_Driver::wl_display = NULL;
- wl_registry = NULL;
}