diff --git a/CMakeLists.txt b/CMakeLists.txt index e8e27d9..4c3a441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -set(CFLTK_PROJECT_VERSION 1.4.33) +set(CFLTK_PROJECT_VERSION 1.4.34) project( cfltk @@ -69,12 +69,17 @@ set(CFLTK_SRCS src/cfl_font.cpp src/cfl_utils.cpp src/cfl_prefs.cpp - src/Fl_Simple_Terminal.cxx) + src/Fl_Simple_Terminal.cxx + ) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CFLTK_SRCS ${CFLTK_SRCS} src/cfl_nswindow.m) endif() +if(UNIX AND NOT APPLE) + set(CFLTK_SRCS ${CFLTK_SRCS} src/cfl_platform.cpp) +endif() + if(NOT ANDROID) set(CFLTK_SRCS ${CFLTK_SRCS} src/cfl_printer.cpp) endif() diff --git a/fltk b/fltk index 089f310..7cb33ea 160000 --- a/fltk +++ b/fltk @@ -1 +1 @@ -Subproject commit 089f31018bc41d22aed104fbf4f8f3d155df25f7 +Subproject commit 7cb33ea80252b00bf00789d7280d976dd5b04502 diff --git a/include/cfl_macros.h b/include/cfl_macros.h index 6a9caf4..9d8adbb 100644 --- a/include/cfl_macros.h +++ b/include/cfl_macros.h @@ -321,7 +321,7 @@ typedef void (*custom_draw_callback)(Fl_Widget *, void *); return ret; \ } \ int widget##_take_focus(widget *self) { \ - LOCK(auto ret = self->take_focus()); \ + LOCK(auto ret = ((Fl_Widget *)self)->take_focus()); \ return ret; \ } \ void widget##_set_visible_focus(widget *self) { \ diff --git a/src/cfl_platform.cpp b/src/cfl_platform.cpp new file mode 100644 index 0000000..19f1a85 --- /dev/null +++ b/src/cfl_platform.cpp @@ -0,0 +1,32 @@ +#include +#include + +#if defined(FLTK_USE_WAYLAND) +extern "C" void wl_proxy_marshal(void *proxy, unsigned opcode, ...); +#elif defined(FLTK_USE_X11) +// extern "C" void XUnmapWindow(void *display, unsigned long win); +// extern "C" void XMapWindow(void *display, unsigned long win); +#else +#endif + +extern "C" void cfltk_platform_hide(void *proxy) { + #if defined(FLTK_USE_WAYLAND) + if (FLTK_USE_WAYLAND == 1 && fl_wl_display()) { + wl_proxy_marshal(proxy, 1, 0, 0, 0); + wl_proxy_marshal(proxy, 6); + } + #elif defined(FLTK_USE_X11) + if (FLTK_USE_X11 == 1 && fl_x11_display()) { + XUnmapWindow(fl_x11_display(), (unsigned long)proxy); + } + #else + #endif +} + +extern "C" void cfltk_platform_show(void *proxy) { + #if defined(FLTK_USE_X11) + if (FLTK_USE_X11 == 1 && fl_x11_display()) { + XMapWindow(fl_x11_display(), (unsigned long)proxy); + } + #endif +} \ No newline at end of file