summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-30 12:58:57 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-30 12:58:57 +0200
commitfcdc2f0e102497313232cc7c0a570cc4c524a02b (patch)
tree1ffc8c6fcbe0a2de801a055d2dce46d60f320dac /src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
parent84af9661098286335e7c1d1d9ec6d407e05b1d21 (diff)
Attempt to improve fl_disable_wayland().
Diffstat (limited to 'src/drivers/Wayland/Fl_Wayland_System_Driver.cxx')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_System_Driver.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
index 4b26a17ea..7c3cf9aa8 100644
--- a/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
@@ -88,3 +88,21 @@ void *Fl_Wayland_System_Driver::control_maximize_button(void *data) {
return NULL;
}
}
+
+
+void Fl_Wayland_System_Driver::disable_wayland() {
+ if (fl_wl_display()) {
+ fprintf(stderr, "Error: fl_disable_wayland() cannot be called "
+ "after the Wayland display was opened\n");
+ exit(1);
+ }
+
+ if (Fl_Wayland_Screen_Driver::wl_display) {
+ wl_display_disconnect(Fl_Wayland_Screen_Driver::wl_display);
+ Fl_Wayland_Screen_Driver::wl_display = NULL;
+ delete Fl_Screen_Driver::system_driver;
+ Fl_Screen_Driver::system_driver = NULL;
+ }
+ Fl_Wayland_Screen_Driver::wld_disabled = true;
+ Fl::system_driver();
+}