Attempt to improve fl_disable_wayland().
This commit is contained in:
parent
84af966109
commit
fcdc2f0e10
@ -76,5 +76,6 @@ extern FL_EXPORT void fl_close_display();
|
||||
extern FL_EXPORT Window fl_window;
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
extern FL_EXPORT void fl_open_callback(void (*)(const char *));
|
||||
extern FL_EXPORT void fl_disable_wayland();
|
||||
|
||||
#endif // !FL_PLATFORM_H
|
||||
|
@ -39,10 +39,6 @@ extern FL_EXPORT cairo_t *fl_wl_cairo();
|
||||
typedef void *EGLContext;
|
||||
/** Returns the EGLContext corresponding to the given GLContext */
|
||||
extern FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc);
|
||||
/** Prevent the FLTK library from using its wayland backend.
|
||||
Call this early in your main(), before fl_open_display() runs. */
|
||||
extern FL_EXPORT void fl_disable_wayland();
|
||||
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
|
||||
|
@ -2015,6 +2015,15 @@ void fl_close_display()
|
||||
Fl::screen_driver()->close_display();
|
||||
}
|
||||
|
||||
/** Prevent the FLTK library from using its wayland backend.
|
||||
Call this early in your main(), before fl_open_display() runs.
|
||||
This has no effect on non-Wayland platforms.
|
||||
*/
|
||||
void fl_disable_wayland()
|
||||
{
|
||||
Fl::system_driver()->disable_wayland();
|
||||
}
|
||||
|
||||
FL_EXPORT Window fl_xid_(const Fl_Window *w) {
|
||||
Fl_X *temp = Fl_X::i(w);
|
||||
return temp ? (Window)temp->xid : 0;
|
||||
|
@ -255,6 +255,7 @@ public:
|
||||
virtual void unlock_ring() {}
|
||||
virtual double wait(double); // must override
|
||||
virtual int ready() { return 0; } // must override
|
||||
virtual void disable_wayland() {}
|
||||
};
|
||||
|
||||
#endif // FL_SYSTEM_DRIVER_H
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
int event_key(int k);
|
||||
int get_key(int k);
|
||||
virtual void *control_maximize_button(void *data);
|
||||
virtual void disable_wayland();
|
||||
};
|
||||
|
||||
#endif /* FL_WAYLAND_SYSTEM_DRIVER_H */
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -35,18 +35,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
void fl_disable_wayland() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Fl_System_Driver *Fl_System_Driver::newSystemDriver() {
|
||||
const char *backend = ::getenv("FLTK_BACKEND");
|
||||
const char *xdgrt = ::getenv("XDG_RUNTIME_DIR");
|
||||
|
Loading…
Reference in New Issue
Block a user