From 0a17281420c800aee9460e23921b93729c2c4f54 Mon Sep 17 00:00:00 2001 From: Mohammed Alyousef Date: Sun, 21 Jul 2024 01:37:06 +0300 Subject: [PATCH] fix using_wayland --- src/cfl.cpp | 2 -- src/cfl_window.cpp | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cfl.cpp b/src/cfl.cpp index e0503c2..7663aaf 100644 --- a/src/cfl.cpp +++ b/src/cfl.cpp @@ -878,8 +878,6 @@ void Fl_set_contrast_function( int Fl_using_wayland(void) { #if defined(FLTK_USE_WAYLAND) return FLTK_USE_WAYLAND == 1 && fl_wl_display(); -#elif defined(FLTK_USE_X11) - return FLTK_USE_X11 == 1 && fl_x11_display(); #else return false; #endif diff --git a/src/cfl_window.cpp b/src/cfl_window.cpp index b213c59..b9d6d6b 100644 --- a/src/cfl_window.cpp +++ b/src/cfl_window.cpp @@ -300,7 +300,7 @@ Fl_Window *Fl_Window_find_by_handle(void *handle) { void *resolve_raw_handle(void *handle) { void *ret = handle; #if defined(FLTK_USE_WAYLAND) - ret = fl_wl_surface((struct wld_window *)((Window)handle)); + ret = fl_wl_surface((struct wld_window *)((Window)handle)); #endif return ret; } @@ -309,7 +309,10 @@ void *Fl_display(void) { #if defined(__APPLE__) || defined(__ANDROID__) return 0; #elif defined(FLTK_USE_WAYLAND) - return fl_wl_display(); + if (fl_wl_display()) + return fl_wl_display(); + else + return fl_display; #else return fl_display; #endif @@ -331,7 +334,7 @@ void Fl_Window_set_raw_handle(Fl_Window *self, void *handle) { return; #if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) && \ !defined(FLTK_USE_WAYLAND) - LOCK(Fl_X::set_xid(self, (Window )handle)); + LOCK(Fl_X::set_xid(self, (Window)handle)); #else // LOCK(Fl_X *xp = new Fl_X; if (!xp) return; Window h = *(Window // *)handle; xp->xid = h;