Hybrid Wayland/X11: remove setenv() call from Fl_Wayland_System_Driver::disable_wayland().
This commit is contained in:
parent
07fd2628fe
commit
5701313340
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user