summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-31 08:56:56 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-31 08:56:56 +0200
commit57013133406c1d263078d75c06565eebb8e9445e (patch)
tree736eaebb52d7e1beb5b018306a193389c40d019e /src/drivers
parent07fd2628febb512192239cc252087deb62da4866 (diff)
Hybrid Wayland/X11: remove setenv() call from Fl_Wayland_System_Driver::disable_wayland().
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.H2
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx9
-rw-r--r--src/drivers/Wayland/Fl_Wayland_System_Driver.cxx3
3 files changed, 7 insertions, 7 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index d5196b557..f0f01ca1f 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -174,7 +174,7 @@ public:
static compositor_name compositor; // identifies the used Wayland compositor
void set_spot(int font, int height, int x, int y, int w, int h, Fl_Window *win);
void reset_spot();
- static bool undo_wayland_backend_if_needed();
+ static bool undo_wayland_backend_if_needed(const char *backend = NULL);
};
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index cc6d1b4ce..29a037171 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -18,6 +18,7 @@
#include "Fl_Wayland_Screen_Driver.H"
#include "Fl_Wayland_Window_Driver.H"
#include "Fl_Wayland_System_Driver.H"
+#include "../X11/Fl_X11_System_Driver.H"
#include "Fl_Wayland_Graphics_Driver.H"
#include <wayland-cursor.h>
#include "../../../libdecor/src/libdecor.h"
@@ -1088,13 +1089,13 @@ Fl_Wayland_Screen_Driver::Fl_Wayland_Screen_Driver() : Fl_Screen_Driver() {
}
-bool Fl_Wayland_Screen_Driver::undo_wayland_backend_if_needed() {
- const char *backend = getenv("FLTK_BACKEND");
+bool Fl_Wayland_Screen_Driver::undo_wayland_backend_if_needed(const char *backend) {
+ if (!backend) backend = getenv("FLTK_BACKEND");
if (wl_display && backend && strcmp(backend, "x11") == 0) {
wl_display_disconnect(wl_display);
wl_display = NULL;
- delete Fl_Screen_Driver::system_driver;
- Fl_Screen_Driver::system_driver = NULL;
+ if (Fl_Screen_Driver::system_driver) delete Fl_Screen_Driver::system_driver;
+ Fl_Screen_Driver::system_driver = new Fl_X11_System_Driver();
return true;
}
return false;
diff --git a/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
index 158c5619a..c47ff56cf 100644
--- a/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_System_Driver.cxx
@@ -101,6 +101,5 @@ void Fl_Wayland_System_Driver::disable_wayland() {
"or a Wayland window was created or the Wayland screen was accessed\n");
exit(1);
}
- setenv("FLTK_BACKEND", "x11", 1);
- Fl_Wayland_Screen_Driver::undo_wayland_backend_if_needed();
+ Fl_Wayland_Screen_Driver::undo_wayland_backend_if_needed("x11");
}