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 17:37:55 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-30 17:37:55 +0200
commit07fd2628febb512192239cc252087deb62da4866 (patch)
tree895f2bd612078f0babcf2b5a09228806b92e6fb9 /src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
parentfcdc2f0e102497313232cc7c0a570cc4c524a02b (diff)
Hybrid Wayland/X11 platform: improve control of chosen backend.
Diffstat (limited to 'src/drivers/Wayland/Fl_Wayland_System_Driver.cxx')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_System_Driver.cxx20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
index 7c3cf9aa8..158c5619a 100644
--- a/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
@@ -21,6 +21,10 @@
#include "Fl_Wayland_Screen_Driver.H"
#include <FL/platform.H>
#include "../../../libdecor/src/libdecor.h"
+#include <stdlib.h>
+
+
+bool Fl_Wayland_System_Driver::too_late_to_disable = false;
int Fl_Wayland_System_Driver::event_key(int k) {
@@ -91,18 +95,12 @@ void *Fl_Wayland_System_Driver::control_maximize_button(void *data) {
void Fl_Wayland_System_Driver::disable_wayland() {
- if (fl_wl_display()) {
+ if (too_late_to_disable) {
fprintf(stderr, "Error: fl_disable_wayland() cannot be called "
- "after the Wayland display was opened\n");
+ "after the Wayland display was opened\n"
+ "or a Wayland window was created or the Wayland screen was accessed\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();
+ setenv("FLTK_BACKEND", "x11", 1);
+ Fl_Wayland_Screen_Driver::undo_wayland_backend_if_needed();
}