summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/2026-02-05-claudemd.txt1962
-rwxr-xr-xbin/fluidbin2584648 -> 2584568 bytes
-rw-r--r--lib/libfltk.abin2237328 -> 2237200 bytes
-rw-r--r--src/Fl.cxx100
-rw-r--r--src/Fl_Cairo.cxx32
-rw-r--r--src/Fl_Private.H41
-rw-r--r--src/Fl_System_Driver.cxx4
-rw-r--r--src/Fl_add_idle.cxx4
-rw-r--r--src/drivers/X11/fl_X11_platform_init.cxx8
-rw-r--r--src/fl_boxtype.cxx12
-rw-r--r--test/penpal.cxx93
11 files changed, 149 insertions, 2107 deletions
diff --git a/FL/2026-02-05-claudemd.txt b/FL/2026-02-05-claudemd.txt
deleted file mode 100644
index 7a4c1a861..000000000
--- a/FL/2026-02-05-claudemd.txt
+++ /dev/null
@@ -1,1962 +0,0 @@
-
-╭─── Claude Code v2.1.6 ───────────────────────────────────────────────────────╮
-│ │ Tips for getting │
-│ Welcome back Maxim! │ started │
-│ │ Run /init to create a … │
-│ ▗ ▗ ▖ ▖ │ ─────────────────────── │
-│ │ Recent activity │
-│ ▘▘ ▝▝ │ No recent activity │
-│ │ │
-│ Opus 4.5 · Claude Max · │ │
-│ maksimgrinberg01@gmail.com's Organization │ │
-│ ~/Desktop/fltk/FL │ │
-╰──────────────────────────────────────────────────────────────────────────────╯
-══════════════════ Conversation compacted · ctrl+o for history ═════════════════
- ⎿  Referenced file ../CMake/options.cmake
- ⎿  Read ../CMakeLists.txt (405 lines)
- ⎿  Referenced file ../src/CMakeLists.txt
- ⎿  Read platform.H (72 lines)
- ⎿  Todo list read (10 items)
- ⎿  Plan file referenced (~/.claude/plans/compiled-petting-babbage.md)
-
-⏺ Продолжаю работу над Фазой 1. Нужно дочистить CMake/options.cmake, затем
- перейти к очистке #ifdef мёртвых веток в исходниках.
-
-⏺ Read(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Read 749 lines
-
-⏺ Вижу оставшиеся проблемы в options.cmake. Нужно убрать:
- 1. set(FLTK_USE_WAYLAND FALSE) (строка 240)
- 2. if(NOT FLTK_USE_WAYLAND) guard (строка 570)
- 3. FLTK_USE_WAYLAND в условии Pango (строка 632)
- 4. Весь блок if(FLTK_USE_WAYLAND) для GTK (строки 639-653)
- 5. if(APPLE AND FLTK_BACKEND_X11) для fontconfig (строки 659-661)
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Removed 1 line
- 237 ##############################################################
- #########
- 238
- 239 list(APPEND FLTK_LDLIBS -lm)
- 240 -set(FLTK_USE_WAYLAND FALSE)
- 240
- 241 ##############################################################
- #########
- 242
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Added 1 line, removed 3 lines
- 566 ##############################################################
- #########
- 567 if(X11_Xft_FOUND)
- 568 option(FLTK_USE_PANGO "use lib Pango" OFF)
- 569 - if(NOT FLTK_USE_WAYLAND)
- 570 - option(FLTK_GRAPHICS_CAIRO "all drawing to X11 windows use
- -s Cairo" OFF)
- 571 - endif(NOT FLTK_USE_WAYLAND)
- 569 + option(FLTK_GRAPHICS_CAIRO "all drawing to X11 windows uses
- +Cairo" OFF)
- 570 if(NOT FLTK_GRAPHICS_CAIRO)
- 571 option(FLTK_USE_XFT "use lib Xft" ON)
- 572 endif()
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Added 1 line, removed 18 lines
- 626
- 627 endif((PANGOXFT_FOUND OR NOT USE_PANGOXFT) AND PANGOCAIRO_FO
- UND AND CAIRO_FOUND)
- 628
- 629 - if(USE_PANGO AND (FLTK_GRAPHICS_CAIRO OR FLTK_USE_WAYLAND))
- 629 + if(USE_PANGO AND FLTK_GRAPHICS_CAIRO)
- 630 set(FLTK_USE_CAIRO 1)
- 631 - # fl_debug_var(FLTK_USE_CAIRO)
- 631 endif()
- 632
- 633 endif((X11_Xft_FOUND OR NOT USE_PANGOXFT) AND FLTK_USE_PANGO)
- 634
- 636 -if(FLTK_USE_WAYLAND)
- 637 -
- 638 - # Note: Disable FLTK_USE_LIBDECOR_GTK to get cairo titlebars
- - rather than GTK
- 639 - if(FLTK_USE_LIBDECOR_GTK AND NOT USE_SYSTEM_LIBDECOR)
- 640 - pkg_check_modules(GTK IMPORTED_TARGET gtk+-3.0)
- 641 - if(GTK_FOUND)
- 642 - list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${GTK_INCLUDE
- -_DIRS})
- 643 - list(APPEND FLTK_LDLIBS ${GTK_LDFLAGS})
- 644 - else()
- 645 - message(WARNING "Installation of the development files f
- -or the GTK library "
- 646 - "(e.g., libgtk-3-dev) is recommended when using the gnom
- -e desktop.")
- 647 - endif(GTK_FOUND)
- 648 - endif(FLTK_USE_LIBDECOR_GTK AND NOT USE_SYSTEM_LIBDECOR)
- 649 -
- 650 -endif()
- 651 -
- 635 if(FLTK_USE_XFT)
- 636 set(USE_XFT X11_Xft_FOUND)
- 637 list(APPEND FLTK_LDLIBS -lXft)
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Removed 3 lines
- 636 set(USE_XFT X11_Xft_FOUND)
- 637 list(APPEND FLTK_LDLIBS -lXft)
- 638 set(FLTK_XFT_FOUND TRUE)
- 639 - if(APPLE AND FLTK_BACKEND_X11)
- 640 - find_library(LIB_fontconfig fontconfig "/opt/X11/lib")
- 641 - endif()
- 639 else()
- 640 set(FLTK_XFT_FOUND FALSE)
- 641 endif(FLTK_USE_XFT)
-
-⏺ Также уберу ссылку на CMAKE_MSVC_RUNTIME_LIBRARY в секции debug:
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Removed 1 line
- 697 fl_debug_var(OPENGL_FOUND)
- 698 fl_debug_var(OPENGL_INCLUDE_DIR)
- 699 fl_debug_var(OPENGL_LIBRARIES)
- 700 - fl_debug_var(CMAKE_MSVC_RUNTIME_LIBRARY)
- 700 message("--- bundled libraries ---")
- 701 fl_debug_var(FLTK_USE_SYSTEM_LIBJPEG)
- 702 fl_debug_var(FLTK_USE_SYSTEM_LIBPNG)
-
-⏺ Теперь проверю, что в файле больше нет ссылок на Wayland и APPLE:
-
-⏺ Search(pattern: "WAYLAND|__APPLE__|APPLE|_WIN32|MSVC|CYGWIN|MINGW", path:
- "~/Desktop/fltk/CMake/options.cmake", output_mode: "content")
- ⎿  Found 0 lines
-
-⏺ options.cmake полностью очищен. Помечу задачу как завершённую и перейду к
- следующей.
-
-⏺ Теперь нужно найти файлы с #ifdef _WIN32, #ifdef __APPLE__, FLTK_USE_WAYLAND в
- src/ и FL/. Запущу поиск параллельно.
-
-⏺ Search(pattern: "_WIN32|WIN32", path: "~/Desktop/fltk/src")
- ⎿  Found 5 files (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32", path: "~/Desktop/fltk/FL")
- ⎿  Found 6 files (ctrl+o to expand)
-
-⏺ Search(pattern: "__APPLE__", path: "~/Desktop/fltk/src")
- ⎿  Found 1 file (ctrl+o to expand)
-
-⏺ Search(pattern: "__APPLE__", path: "~/Desktop/fltk/FL")
- ⎿  Found 3 files (ctrl+o to expand)
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND|USE_WAYLAND", path: "~/Desktop/fltk/src")
- ⎿  Found 3 files (ctrl+o to expand)
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND|USE_WAYLAND", path: "~/Desktop/fltk/FL")
- ⎿  Found 0 files
-
-⏺ Файлов не так много. Запущу параллельное чтение нужных файлов, чтобы увидеть
- контекст #ifdef веток и удалить мёртвый код.
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path:
- "~/Desktop/fltk/src/Fl.cxx", output_mode: "content")
- ⎿  Found 11 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path:
- "~/Desktop/fltk/src/Fl_Cairo.cxx", output_mode: "content")
- ⎿  Found 86 lines (ctrl+o to expand)
-
-⏺ Нужно прочитать все затронутые файлы. Запущу чтение параллельно.
-
-⏺ Read(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Read 338 lines
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path:
- "~/Desktop/fltk/src/flstring.h", output_mode: "content")
- ⎿  Found 14 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path:
- "~/Desktop/fltk/src/forms_fselect.cxx", output_mode: "content")
- ⎿  Found 11 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path:
- "~/Desktop/fltk/src/fl_call_main.c", output_mode: "content")
- ⎿  Found 11 lines (ctrl+o to expand)
-
-⏺ Теперь прочитаю заголовки FL/ с платформо-специфичным кодом.
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "math.h", output_mode:
- "content")
- ⎿  Found 13 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "platform_types.h",
- output_mode: "content")
- ⎿  Found 12 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "fl_utf8.h",
- output_mode: "content")
- ⎿  Found 18 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "gl.h", output_mode:
- "content")
- ⎿  Found 31 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "glu.h", output_mode:
- "content")
- ⎿  Found 22 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "Fl_Window.H",
- output_mode: "content")
- ⎿  Found 23 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32|WIN32|__APPLE__|WAYLAND", path: "Fl.H", output_mode:
- "content")
- ⎿  Found 11 lines (ctrl+o to expand)
-
-⏺ Нашёл все файлы с платформо-специфичным кодом. Начну очистку — сначала простые
- файлы параллельно.
-
-⏺ Update(math.h)
- ⎿  File must be read first
-
-⏺ Read(math.h)
- ⎿  Read 51 lines
-
-⏺ Read(platform_types.h)
- ⎿  Read 153 lines
-
-⏺ Read(fl_utf8.h)
- ⎿  Read 30 lines
-
-⏺ Read(gl.h)
- ⎿  Read 100 lines
-
-⏺ Read(glu.h)
- ⎿  Read 46 lines
-
-⏺ Read(Fl_Window.H)
- ⎿  Read 50 lines
-
-⏺ Read(Fl.H)
- ⎿  Read 20 lines
-
-⏺ Read(~/Desktop/fltk/src/flstring.h)
- ⎿  Read 102 lines
-
-⏺ Read(~/Desktop/fltk/src/forms_fselect.cxx)
- ⎿  Read 20 lines
-
-⏺ Read(~/Desktop/fltk/src/fl_call_main.c)
- ⎿  Read 159 lines
-
-⏺ Теперь применю все правки. Начну с простых файлов параллельно.
-
-⏺ Update(math.h)
- ⎿  Removed 8 lines
- 14 // https://www.fltk.org/bugs.php
- 15 //
- 16
- 17 -// Xcode on macOS includes files by recursing down into directo
- -ries.
- 18 -// This code catches the cycle and directly includes the requir
- -ed file.
- 19 -#ifdef fl_math_h_cyclic_include
- 20 -# include "/usr/include/math.h"
- 21 -#endif
- 22 -
- 17 #ifndef fl_math_h
- 18 # define fl_math_h
- 19
- 26 -# define fl_math_h_cyclic_include
- 20 # include <math.h>
- 28 -# undef fl_math_h_cyclic_include
- 21
- 22 # ifndef M_PI
- 23 # define M_PI 3.14159265358979323846
-
-⏺ Update(math.h)
- ⎿  Removed 7 lines
- 32 # define M_SQRT1_2 0.70710678118654752440
- 33 # endif // !M_SQRT2
- 34
- 35 -# if (defined(_WIN32) || defined(CRAY)) && !defined(__MINGW32_
- -_)
- 36 -
- 37 -inline double rint(double v) {return floor(v+.5);}
- 38 -inline double copysign(double a, double b) {return b<0 ? -a : a
- -;}
- 39 -
- 40 -# endif // (_WIN32 || CRAY) && !__MINGW32__
- 41 -
- 35 #endif // !fl_math_h
-
-⏺ Update(fl_utf8.h)
- ⎿  Removed 8 lines
- 116 FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen,
- const char *src, unsigned srclen);
- 117
- 118 /*************************************************************
- ****************/
- 119 -#ifdef _WIN32
- 120 -/* these two Windows-only functions are kept for API compatibi
- -lity */
- 121 -/* OD: Attempt to convert the UTF-8 string to the current loca
- -le */
- 122 -FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsi
- -gned int codepage);
- 119
- 124 -/* OD: Attempt to convert a string in the current locale to UT
- -F-8 */
- 125 -FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsi
- -gned int codepage);
- 126 -#endif /* _WIN32 */
- 127 -
- 120 /*************************************************************
- ****************
- 121 * The following functions are intended to provide portable, U
- TF-8 aware
- 122 * versions of standard functions
-
-⏺ Update(gl.h)
- ⎿  Added 2 lines, removed 18 lines
- 43 # define FL_gl_H
- 44
- 45 # include "Enumerations.H" // for color names
- 46 -# ifdef _WIN32
- 47 -# include <windows.h>
- 48 -# endif
- 46 # ifndef APIENTRY
- 50 -# if defined(__CYGWIN__)
- 51 -# define APIENTRY __attribute__ ((__stdcall__))
- 52 -# else
- 53 -# define APIENTRY
- 54 -# endif
- 47 +# define APIENTRY
- 48 # endif
- 49
- 57 -# ifdef __APPLE__ // PORTME: OpenGL path abstraction
- 58 -# ifndef GL_SILENCE_DEPRECATION
- 59 -# define GL_SILENCE_DEPRECATION 1
- 60 -# endif
- 61 -# if !defined(__gl3_h_) // make sure OpenGL/gl3.h was not in
- -cluded before
- 62 -# include <OpenGL/gl.h>
- 63 -# endif
- 64 -# else
- 65 -# include <GL/gl.h>
- 66 -# endif // __APPLE__ // PORTME: OpenGL Path abstraction
- 50 +# include <GL/gl.h>
- 51
- 52 FL_EXPORT void gl_start();
- 53 FL_EXPORT void gl_finish();
-
-⏺ Update(glu.h)
- ⎿  Added 2 lines, removed 13 lines
- 25 # define FL_glu_H
- 26
- 27 # include "Enumerations.H" // for color names
- 28 -# ifdef _WIN32
- 29 -# include <windows.h>
- 30 -# endif
- 28 # ifndef APIENTRY
- 32 -# if defined(__CYGWIN__)
- 33 -# define APIENTRY __attribute__ ((__stdcall__))
- 34 -# else
- 35 -# define APIENTRY
- 36 -# endif
- 29 +# define APIENTRY
- 30 # endif
- 31
- 39 -# ifdef __APPLE__ // PORTME: OpenGL Path abstraction
- 40 -# include <OpenGL/glu.h>
- 41 -# else
- 42 -# include <GL/glu.h>
- 43 -# endif
- 32 +# include <GL/glu.h>
- 33
- 34 #endif // !FL_glu_H
-
-⏺ Update(Fl.H)
- ⎿  Removed 5 lines
- 77 FL_EXPORT extern Fl_Screen_Driver *screen_driver();
- 78 FL_EXPORT extern Fl_System_Driver *system_driver();
- 79
- 80 -#ifdef __APPLE__ // deprecated in 1.4 - only for compatibility
- -with 1.3
- 81 -FL_EXPORT extern void reset_marked_text();
- 82 -FL_EXPORT extern void insertion_point_location(int x, int y, in
- -t height);
- 83 -#endif
- 84 -
- 80 FL_EXPORT extern int box_shadow_width();
- 81 FL_EXPORT extern void box_shadow_width(int W);
- 82
-
-⏺ Update(~/Desktop/fltk/src/flstring.h)
- ⎿  Removed 5 lines
- 53 * Some of these functions are also defined in ISO C99...
- 54 */
- 55
- 56 -# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MIN
- -GW32__)
- 57 -# define strcasecmp(s,t) _stricmp((s), (t))
- 58 -# define strncasecmp(s,t,n) _strnicmp((s), (t), (n))
- 59 -# endif /* _WIN32 && ... */
- 60 -
- 56 # ifdef __cplusplus
- 57 extern "C" {
- 58 # endif /* __cplusplus */
-
-⏺ Update(~/Desktop/fltk/src/forms_fselect.cxx)
- ⎿  Added 2 lines, removed 5 lines
- 29 if (pat && pat[0]) fl_pattern = pat;
- 30 if (fname && fname[0]) strlcpy(fl_filename,fname,sizeof(fl_fi
- lename));
- 31 char *p = fl_directory+strlen(fl_directory);
- 32 - if (p > fl_directory && *(p-1)!='/'
- 33 -#ifdef _WIN32
- 34 - && *(p-1)!='\\' && *(p-1)!=':'
- 35 -#endif
- 36 - ) *p++ = '/';
- 32 + if (p > fl_directory && *(p-1)!='/')
- 33 + *p++ = '/';
- 34 strlcpy(p,fl_filename,sizeof(fl_directory) - (p - fl_director
- y));
- 35 const char *q = fl_file_chooser(message,fl_pattern,fl_directo
- ry);
- 36 if (!q) return 0;
- ⎿  Found 20 new diagnostic issues in 5 files (ctrl+o to expand)
-
-⏺ Теперь обработаю FL/platform_types.h — уберу Windows-специфичный код.
-
-⏺ Update(platform_types.h)
- ⎿  Removed 15 lines
- 95 different signedness of socket numbers on *some* platforms
- .
- 96 */
- 97
- 98 -#ifdef _WIN64
- 99 -
- 100 -#if defined(_MSC_VER) && (_MSC_VER < 1600)
- 101 -# include <stddef.h> /* stdint.h not available before VS 2010
- - (1600) */
- 102 -#else
- 103 -# include <stdint.h>
- 104 -#endif
- 105 -
- 106 -typedef intptr_t fl_intptr_t;
- 107 -typedef uintptr_t fl_uintptr_t;
- 108 -
- 109 -#else /* ! _WIN64 */
- 110 -
- 98 typedef long fl_intptr_t;
- 99 typedef unsigned long fl_uintptr_t;
- 100
- 114 -#endif /* _WIN64 */
- 115 -
- 101 typedef void *GLContext;
- 102 typedef void *Fl_Region;
- 103 typedef fl_uintptr_t Fl_Offscreen;
-
-⏺ Update(platform_types.h)
- ⎿  Added 1 line, removed 10 lines
- 102 typedef void *Fl_Region;
- 103 typedef fl_uintptr_t Fl_Offscreen;
- 104
- 105 -/* Allows all hybrid combinations except WIN32 + X11 with MSVC
- - */
- 106 -#if defined(_WIN32) && !defined(__MINGW32__)
- 107 - struct dirent {char d_name[1];};
- 108 -#else
- 109 -# include <dirent.h>
- 110 -#endif
- 105 +#include <dirent.h>
- 106
- 112 -# if defined(_WIN64) && defined(_MSC_VER)
- 113 -typedef unsigned __int64 FL_SOCKET; /* *FIXME* - FL_SOCKET
- - (see above) */
- 114 -# else
- 107 typedef int FL_SOCKET;
- 116 -# endif
- 108
- 109 #include <FL/Fl_Export.H>
- 110 extern FL_EXPORT int fl_command_modifier();
- ⎿  Found 4 new diagnostic issues in 2 files (ctrl+o to expand)
-
-⏺ Теперь удалю HICON-блок из Fl_Window.H и удалю fl_call_main.c.
-
-⏺ Update(Fl_Window.H)
- ⎿  Removed 37 lines
- 385 void icon(const Fl_RGB_Image*);
- 386 void icons(const Fl_RGB_Image*[], int);
- 387
- 388 -#if defined(_WIN32) || defined(FL_DOXYGEN)
- 389 - typedef struct HICON__* HICON;
- 390 - // These 2 member functions break the driver model but are k
- -ept for back compatibility.
- 391 - // They are implemented in Fl_win32.cxx
- 392 -
- 393 - /** Sets the default window icons (Windows platform only).
- 394 -
- 395 - Convenience function to set the default icons using Windows
- -'
- 396 - native HICON icon handles.
- 397 -
- 398 - The given icons are copied. You can free the icons immediat
- -ely after
- 399 - this call.
- 400 -
- 401 - \param[in] big_icon default large icon for all windows
- 402 - subsequently created
- 403 - \param[in] small_icon default small icon for all windows
- 404 - subsequently created
- 405 -
- 406 - \see Fl_Window::default_icon(const Fl_RGB_Image *)
- 407 - \see Fl_Window::default_icons(const Fl_RGB_Image *[], int)
- 408 - \see Fl_Window::icon(const Fl_RGB_Image *)
- 409 - \see Fl_Window::icons(const Fl_RGB_Image *[], int)
- 410 - \see Fl_Window::icons(HICON, HICON)
- 411 - */
- 412 - static void default_icons(HICON big_icon, HICON small_icon);
- 413 -
- 414 - /** Sets the window icons using HICON handles (Windows platf
- -orm only).
- 415 -
- 416 - The given icons are copied. You can free the icons immediat
- -ely after
- 417 - this call.
- 418 -
- 419 - \param[in] big_icon large window icon
- 420 - \param[in] small_icon small window icon
- 421 - */
- 422 - void icons(HICON big_icon, HICON small_icon);
- 423 -#endif // defined(_WIN32) || defined(FL_DOXYGEN)
- 424 -
- 388 /* for legacy compatibility */
- 389 const void* icon() const;
- 390 void icon(const void * ic);
-
-⏺ Bash(rm /Users/mnik01/Desktop/fltk/src/fl_call_main.c)
- ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni
- k01/Desktop/hobby/emsdk/emsdk_env.sh
-
- ⎿  Found 4 new diagnostic issues in 1 file (ctrl+o to expand)
-
-⏺ Теперь самое сложное — src/Fl_Cairo.cxx. Упрощу его до X11-only.
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Added 1 line, removed 29 lines
- 27
- 28 #ifdef FLTK_HAVE_CAIRO
- 29
- 30 -// Define USE_MAC_OS for convenience (below). We use macOS spec
- -ific features
- 31 -// if USE_MAC_OS is defined, otherwise we're using X11 (XQuartz
- -) on macOS
- 32 -
- 33 -#if defined __APPLE__ && !defined(FLTK_USE_X11)
- 34 -#define USE_MAC_OS
- 35 -#include <ApplicationServices/ApplicationServices.h>
- 36 -#endif
- 37 -
- 30 #include <FL/platform.H>
- 31 #include <FL/Fl_Window.H>
- 32 +#include <cairo-xlib.h>
- 33
- 41 -// Cairo is currently supported for the following platforms:
- 42 -// Windows, macOS (Apple Quartz), X11, Wayland
- 43 -
- 44 -#if defined(_WIN32) // Windows
- 45 -# include <cairo-win32.h>
- 46 -#elif defined(FLTK_USE_WAYLAND) // Wayland or hybrid
- 47 -# include "../src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
- -"
- 48 -# include "../src/drivers/Wayland/Fl_Wayland_Window_Driver.H"
- 49 -# if defined(FLTK_USE_X11)
- 50 -# include <cairo-xlib.h>
- 51 -# else
- 52 - static void *fl_gc = NULL;
- 53 -# endif
- 54 -#elif defined(FLTK_USE_X11) // X11
- 55 -# include <cairo-xlib.h>
- 56 -#elif defined(__APPLE__) // macOS
- 57 -# include <cairo-quartz.h>
- 58 -#else
- 59 -# error Cairo is not supported on this platform.
- 60 -#endif
- 61 -
- 34 // static initialization
- 35
- 36 Fl_Cairo_State Fl::Private::cairo_state_; ///< current Cairo co
- ntext information
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Removed 11 lines
- 119 return NULL;
- 120 cairo_t *cairo_ctxt;
- 121
- 122 -#if defined(FLTK_USE_WAYLAND)
- 123 - if (fl_wl_display()) { // true means using wayland backend
- 124 - struct wld_window *xid = fl_wl_xid(wi);
- 125 - if (!xid || !xid->buffer)
- 126 - return NULL; // this may happen with GL windows or if wi
- -ndow is not shown
- 127 - cairo_ctxt = xid->buffer->draw_buffer.cairo_;
- 128 - Fl::Private::cairo_state_.cc(cairo_ctxt, false);
- 129 - return cairo_ctxt;
- 130 - }
- 131 -#endif
- 132 -
- 122 if (fl_gc == 0) { // means remove current cc
- 123 Fl::cairo_cc(0); // destroy any previous cc
- 124 Fl::Private::cairo_state_.window(0);
- ⎿  Found 3 new diagnostic issues in 1 file (ctrl+o to expand)
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Added 2 lines, removed 15 lines
- 129 if (fl_gc == Fl::Private::cairo_state_.gc() && fl_xid(wi) ==
- (Window)Fl::Private::cairo_state_.window())
- 130 return Fl::cairo_cc();
- 131
- 132 - // Scale the Cairo context appropriately. This is platform d
- -ependent
- 133 -
- 134 -#if !defined(USE_MAC_OS)
- 135 - float scale = Fl::screen_scale(wi->screen_num()); // get the
- - screen scaling factor
- 136 -#endif
- 137 -
- 138 -#if defined(FLTK_USE_X11)
- 132 + // Scale the Cairo context appropriately
- 133 + float scale = Fl::screen_scale(wi->screen_num());
- 134 cairo_ctxt = Fl::Private::cairo_make_current(0, wi->w() * sc
- ale, wi->h() * scale);
- 140 -#else
- 141 - // on macOS, scaling is done before by Fl_Window::make_curre
- -nt(), on Windows, the size is not used
- 142 - cairo_ctxt = Fl::Private::cairo_make_current(fl_gc, wi->w(),
- - wi->h());
- 143 -#endif
- 144 -
- 135 Fl::Private::cairo_state_.window((void *)fl_xid(wi));
- 146 -
- 147 -#if !defined(USE_MAC_OS)
- 136 cairo_scale(cairo_ctxt, scale, scale);
- 149 -#endif
- 137 return cairo_ctxt;
- 138 }
- 139
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Removed 10 lines
- 144 */
- 145
- 146 static cairo_surface_t *cairo_create_surface(void *gc, int W,
- int H) {
- 147 -#if defined(FLTK_USE_X11)
- 147 return cairo_xlib_surface_create(fl_display, fl_window, fl_v
- isual->visual, W, H);
- 149 -#elif defined(FLTK_USE_WAYLAND)
- 150 - return NULL;
- 151 -#elif defined(_WIN32)
- 152 - return cairo_win32_surface_create((HDC)gc);
- 153 -#elif defined(__APPLE__)
- 154 - return cairo_quartz_surface_create_for_cg_context((CGContext
- -Ref)gc, W, H);
- 155 -#else
- 156 -#error Cairo is not supported on this platform.
- 157 -#endif
- 148 }
- 149
- 150
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Теперь очищу блок #if 0 (мёртвый код — неиспользуемая функция) и блок с
- USE_MAC_OS:
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Removed 45 lines
- 148 }
- 149
- 150
- 151 -#if 0 // this non-public function appears not to be used anywh
- -ere in FLTK
- 151 /**
- 153 - Creates a Cairo context from a \a gc only, gets its window s
- -ize or
- 154 - offscreen size if fl_window is null.
- 155 -
- 156 - \note Only available if CMake FLTK_OPTION_CAIRO_WINDOW is en
- -abled.
- 157 -*/
- 158 -cairo_t *Fl::Private::cairo_make_current(void *gc) {
- 159 - int W = 0, H = 0;
- 160 -#if defined(FLTK_USE_X11) || defined(FLTK_USE_WAYLAND)
- 161 - // FIXME X11 get W,H
- 162 - // gc will be the window handle here
- 163 - // # warning FIXME get W,H for cairo_make_current(void*)
- 164 -#elif defined(__APPLE__)
- 165 - if (fl_window) {
- 166 - W = Fl_Window::current()->w();
- 167 - H = Fl_Window::current()->h();
- 168 - } else {
- 169 - W = CGBitmapContextGetWidth(fl_gc);
- 170 - H = CGBitmapContextGetHeight(fl_gc);
- 171 - }
- 172 -#elif defined(_WIN32)
- 173 - // we don't need any W,H for Windows
- 174 -#else
- 175 -#error Cairo is not supported on this platform.
- 176 -#endif
- 177 -
- 178 - if (!gc) {
- 179 - Fl::cairo_cc(0);
- 180 - cairo_state_.gc(0); // keep track for next time
- 181 - return 0;
- 182 - }
- 183 - if (gc == Fl::Private::cairo_state_.gc() &&
- 184 - fl_window == (Window)Fl::Private::cairo_state_.window()
- -&&
- 185 - cairo_state_.cc() != 0)
- 186 - return Fl::cairo_cc();
- 187 - cairo_state_.gc(fl_gc); // keep track for next time
- 188 - cairo_surface_t *s = cairo_create_surface(gc, W, H);
- 189 - cairo_t *c = cairo_create(s);
- 190 - cairo_surface_destroy(s);
- 191 - cairo_state_.cc(c);
- 192 - return c;
- 193 -}
- 194 -#endif
- 195 -
- 196 -/**
- 152 Creates a Cairo context from a \p gc and the given size.
- 153
- 154 \note Only available if CMake FLTK_OPTION_CAIRO_WINDOW is en
- abled.
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Теперь уберу оставшийся USE_MAC_OS блок в cairo_make_current(void*, int, int):
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Removed 12 lines
- 162 // we need to (re-)create a fresh cc ...
- 163 cairo_state_.gc(gc); // keep track for next time
- 164 cairo_surface_t *s = cairo_create_surface(gc, W, H);
- 165 -
- 166 -#if defined(USE_MAC_OS) && defined(FLTK_HAVE_CAIROEXT)
- 167 - CGAffineTransform at = CGContextGetCTM((CGContextRef)gc);
- 168 - CGContextSaveGState((CGContextRef)gc);
- 169 - CGContextConcatCTM((CGContextRef)gc, CGAffineTransformInvert
- -(at));
- 170 -#endif
- 171 -
- 165 cairo_t *c = cairo_create(s);
- 173 -
- 174 -#if defined(USE_MAC_OS) && defined(FLTK_HAVE_CAIROEXT)
- 175 - CGContextRestoreGState((CGContextRef)gc);
- 176 -#endif
- 177 -
- 166 cairo_state_.cc(c); // and purge any previously owned conte
- xt
- 167 cairo_surface_destroy(s);
- 168 return c;
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Теперь обработаю два оставшихся файла с WAYLAND-ссылками.
-
-⏺ Search(pattern: "WAYLAND|_WIN32|__APPLE__", path:
- "~/Desktop/fltk/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx",
- output_mode: "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "WAYLAND|_WIN32|__APPLE__", path:
- "~/Desktop/fltk/src/drivers/PostScript/Fl_PostScript.cxx", output_mode:
- "content")
- ⎿  Found 23 lines (ctrl+o to expand)
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Read(~/Desktop/fltk/src/drivers/PostScript/Fl_PostScript.cxx)
- ⎿  Read 30 lines
-
-⏺ Update(~/Desktop/fltk/src/drivers/PostScript/Fl_PostScript.cxx)
- ⎿  Added 1 line, removed 1 line
- 1470 fprintf(output, "GR GR\n");
- 1471 }
- 1472
- 1473 -#if defined(FLTK_USE_X11) || defined(FLTK_USE_WAYLAND)
- 1473 +#if defined(FLTK_USE_X11)
- 1474
- 1475 Fl_Paged_Device *Fl_PDF_File_Surface::new_platform_pdf_surfac
- e_(const char ***pfname) {
- 1476 *pfname = NULL;
-
-⏺ Update(~/Desktop/fltk/src/drivers/PostScript/Fl_PostScript.cxx)
- ⎿  Added 1 line, removed 1 line
- 1492 return begin_job(NULL, perr_message);
- 1493 }
- 1494
- 1495 -#endif // defined(FLTK_USE_X11) || defined(FLTK_USE_WAYLAND)
- 1495 +#endif // defined(FLTK_USE_X11)
- 1496
- 1497 # else // USE_PANGO
- 1498
- ⎿  Found 10 new diagnostic issues in 1 file (ctrl+o to expand)
-
-⏺ Все диагностики — LSP-ошибки из-за отсутствия сгенерированных файлов
- (config.h, fl_config.h). Это нормально.
-
- Также почищу документацию в Fl_Cairo.cxx (убрал ссылки на другие платформы в
- комментариях). Проверю, остались ли ещё ссылки на Wayland в комментарии:
-
-⏺ Search(pattern: "Wayland|Windows|macOS|WIN32|__APPLE__|USE_MAC_OS", path:
- "~/Desktop/fltk/src/Fl_Cairo.cxx", output_mode: "content")
- ⎿  Found 5 lines (ctrl+o to expand)
- ⎿  Found 10 new diagnostic issues in 1 file (ctrl+o to expand)
-
-⏺ Осталось только в комментариях. Почищу комментарии.
-
-⏺ Read(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Read 15 lines
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Added 1 line, removed 1 line
- 112 \note Only available when CMake option '-D FLTK_OPTION_CAIRO
- _WINDOW' is set.
- 113
- 114 \return The valid cairo_t *cairo context associated to this
- window.
- 115 - \retval NULL if \a wi is NULL or maybe with GL windows under
- - Wayland
- 115 + \retval NULL if \a wi is NULL
- 116 */
- 117 cairo_t *Fl::cairo_make_current(Fl_Window *wi) {
- 118 if (!wi)
-
-⏺ Read(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Read 10 lines
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Added 1 line, removed 3 lines
- 138 }
- 139
- 140 /*
- 141 - Creates transparently a cairo_surface_t object.
- 142 - gc is an HDC context in Windows, a CGContext* in Quartz, and
- 143 - a display on X11 (not used on this platform)
- 141 + Creates a cairo_surface_t object using X11/Xlib.
- 142 */
- 143
- 144 static cairo_surface_t *cairo_create_surface(void *gc, int W,
- int H) {
-
-⏺ Read(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Read 50 lines
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Added 1 line, removed 4 lines
- 167 }
- 168
- 169 /** Flush Cairo drawings on Cairo context \p c.
- 170 - This is \b required on Windows if you use the Cairo context
- -provided
- 171 - by the "Cairo autolink" option. Call this when all your draw
- -ings on
- 172 - the Cairo context are finished. This is maybe not necessary
- -on other
- 173 - platforms than Windows but it does no harm if you call it al
- -ways.
- 170 + Call this when all your drawings on the Cairo context are fi
- +nished.
- 171
- 172 You don't need to use this if you use an Fl_Cairo_Window whi
- ch does
- 173 this automatically after the draw callback returns.
-
-⏺ Update(~/Desktop/fltk/src/Fl_Cairo.cxx)
- ⎿  Added 1 line, removed 1 line
- 197 \see Fl::cairo_make_current(Fl_Window*);
- 198 */
- 199 FL_EXPORT extern void Fl::cairo_flush(cairo_t *c) {
- 200 - // flush Cairo drawings: necessary at least for Windows
- 200 + // flush Cairo drawings
- 201 cairo_surface_t *s = cairo_get_target(c);
- 202 cairo_surface_flush(s);
- 203 }
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Теперь также очищу Doxygen-документацию в FL/platform_types.h от упоминаний
- других платформ:
-
-⏺ Update(platform_types.h)
- ⎿  Added 1 line, removed 5 lines
- 37
- 38 /**
- 39 Platform-specific value representing an offscreen drawing buff
- er.
- 40 - \note This value can be safely cast to these types on each pl
- -atform:
- 41 - \li X11: Pixmap
- 42 - \li Wayland: cairo_t *
- 43 - \li Windows: HBITMAP
- 44 - \li macOS: CGContextRef
- 40 + \note This value can be safely cast to Pixmap on X11.
- 41 */
- 42 typedef opaque Fl_Offscreen;
- 43
-
-⏺ Update(platform_types.h)
- ⎿  Added 1 line, removed 5 lines
- 43
- 44 /**
- 45 Pointer to a platform-specific structure representing a collec
- tion of rectangles.
- 46 - \note This pointer can be safely cast to these types on each
- -platform:
- 47 - \li X11: Region as defined by X11
- 48 - \li Wayland: cairo_region_t *
- 49 - \li Windows: HRGN
- 50 - \li macOS: struct flCocoaRegion *
- 46 + \note This pointer can be safely cast to Region as defined by
- + X11.
- 47 */
- 48 typedef struct opaque *Fl_Region;
- 49 typedef opaque FL_SOCKET; /**< socket or file descriptor */
-
-⏺ Update(platform_types.h)
- ⎿  Added 1 line, removed 5 lines
- 49 typedef opaque FL_SOCKET; /**< socket or file descriptor */
- 50 /**
- 51 Pointer to a platform-specific structure representing the wind
- ow's OpenGL rendering context.
- 52 - \note This pointer can be safely cast to these types on each
- -platform:
- 53 - \li X11: GLXContext
- 54 - \li Wayland: EGLContext
- 55 - \li Windows: HGLRC
- 56 - \li macOS: NSOpenGLContext *
- 52 + \note This pointer can be safely cast to GLXContext on X11.
- 53 */
- 54 typedef struct opaque *GLContext;
- 55
- ⎿  Found 2 new diagnostic issues in 1 file (ctrl+o to expand)
-
-⏺ Также уберу FL_COMMAND/FL_CONTROL документацию о MacOS:
-
-⏺ Update(platform_types.h)
- ⎿  Added 2 lines, removed 2 lines
- 60 */
- 61 typedef opaque Fl_Timestamp;
- 62
- 63 -# define FL_COMMAND opaque /**< An alias for FL_CTRL on Win
- -dows and X11, or FL_META on MacOS X */
- 64 -# define FL_CONTROL opaque /**< An alias for FL_META on Win
- -dows and X11, or FL_CTRL on MacOS X */
- 63 +# define FL_COMMAND opaque /**< An alias for FL_CTRL on X11
- + */
- 64 +# define FL_CONTROL opaque /**< An alias for FL_META on X11
- + */
- 65
- 66 #else /* FL_DOXYGEN */
- 67
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Основные файлы обработаны. Теперь помечу задачу как завершённую и запущу
- верификационный grep.
-
-⏺ Запускаю верификацию — поиск оставшихся _WIN32, __APPLE__, FLTK_USE_WAYLAND в
- src/ и FL/.
-
-⏺ Search(pattern: "#\s*if.*_WIN32|#\s*ifdef\s+_WIN32|#\s*if.*WIN32", path:
- "~/Desktop/fltk/src", output_mode: "content")
- ⎿  Found 1 line (ctrl+o to expand)
-
-⏺ Search(pattern: "#\s*if.*_WIN32|#\s*ifdef\s+_WIN32|#\s*if.*WIN32", path:
- "~/Desktop/fltk/FL", output_mode: "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "#\s*if.*__APPLE__", path: "~/Desktop/fltk/src", output_mode:
- "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "#\s*if.*__APPLE__", path: "~/Desktop/fltk/FL", output_mode:
- "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND", path: "~/Desktop/fltk/src", output_mode:
- "content")
- ⎿  Found 1 line (ctrl+o to expand)
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND", path: "~/Desktop/fltk/FL", output_mode:
- "content")
- ⎿  Found 0 lines
-
-⏺ Осталось 2 вхождения. Исправлю оба.
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND", path:
- "~/Desktop/fltk/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx",
- output_mode: "content")
- ⎿  Found 21 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "_WIN32", path: "~/Desktop/fltk/src/Fl.cxx", output_mode:
- "content")
- ⎿  Found 11 lines (ctrl+o to expand)
-
-⏺ Read(~/Desktop/fltk/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx)
- ⎿  Read 10 lines
-
-⏺ Read(~/Desktop/fltk/src/Fl.cxx)
- ⎿  Read 30 lines
-
-⏺ Update(~/Desktop/fltk/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx)
- ⎿  Removed 2 lines
- 40 }
- 41 };
- 42
- 43 -#ifndef FLTK_USE_WAYLAND
- 43 Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_
- Gl_Window *w)
- 44 {
- 45 return new Fl_X11_Gl_Window_Driver(w);
- 46 }
- 48 -#endif
- 47
- 48 void Fl_X11_Gl_Window_Driver::draw_string_legacy(const char* st
- r, int n) {
- 49 draw_string_legacy_get_list(str, n);
-
-⏺ Теперь обновлю комментарий в Fl.cxx — функция args_to_utf8 на X11 ничего не
- делает (это noop для не-Windows). Упрощу комментарий.
-
-⏺ Read(~/Desktop/fltk/src/Fl.cxx)
- ⎿  Read 50 lines
- ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)
-
-⏺ Read(~/Desktop/fltk/src/Fl.cxx)
- ⎿  Read 24 lines
-
-⏺ Update(~/Desktop/fltk/src/Fl.cxx)
- ⎿  Added 5 lines, removed 62 lines
- 2572 FL_EXPORT const char* fl_local_ctrl = Fl::system_driver()->c
- ontrol_name();
- 2573
- 2574 /**
- 2575 - Convert Windows commandline arguments to UTF-8.
- 2575 + Ensure commandline arguments are UTF-8 encoded.
- 2576
- 2577 - \note This function does nothing on other (non-Windows) pla
- -tforms, hence
- 2578 - you may call it on all platforms or only on Windows by us
- -ing platform
- 2579 - specific code like <tt>'\#ifdef _WIN32'</tt> etc. - it's
- -your choice.
- 2580 - Calling it on other platforms returns quickly w/o wasting
- - much CPU time.
- 2577 + On X11 this is a no-op since arguments are already in the l
- +ocale encoding
- 2578 + which is typically UTF-8 on modern systems.
- 2579
- 2582 - This function <i>must be called <b>on Windows platforms</b>
- -</i> in \c main()
- 2583 - before the array \c argv is used if your program uses any c
- -ommandline
- 2584 - argument strings (these should be UTF-8 encoded).
- 2585 - This applies also to standard FLTK commandline arguments li
- -ke
- 2586 - "-name" (class name) and "-title" (window title in the titl
- -e bar).
- 2587 -
- 2588 - Unfortunately Windows \b neither provides commandline argum
- -ents in UTF-8
- 2589 - encoding \b nor as Windows "Wide Character" strings in the
- -standard
- 2590 - \c main() and/or the Windows specific \c WinMain() function
- -.
- 2591 -
- 2592 - On Windows platforms (no matter which build system) this fu
- -nction calls
- 2593 - a Windows specific function to retrieve commandline argumen
- -ts as Windows
- 2594 - "Wide Character" strings, converts these strings to an inte
- -rnally allocated
- 2595 - buffer (or multiple buffers) and returns the result in \c a
- -rgv.
- 2596 - For implementation details please refer to the source code;
- - however these
- 2597 - details may be changed in the future.
- 2598 -
- 2599 - Note that \c argv is provided by reference so it can be ove
- -rwritten.
- 2600 -
- 2601 - In the recommended simple form the function overwrites the
- -variable
- 2602 - \c argv and allocates a new array of strings pointed to by
- -\c argv.
- 2603 - You may use this form on all platforms and it is as simple
- -as adding
- 2604 - one line to old programs to make them work with internation
- -al (UTF-8)
- 2605 - commandline arguments.
- 2606 -
- 2607 - \code
- 2608 - int main(int argc, char **argv) {
- 2609 - Fl::args_to_utf8(argc, argv); // add this line
- 2610 - // ... use argc and argv, e.g. for commandline parsing
- 2611 - window->show(argc, argv);
- 2612 - return Fl::run();
- 2613 - }
- 2614 - \endcode
- 2615 -
- 2616 - For an example see 'examples/howto-parse-args.cxx' in the F
- -LTK sources.
- 2617 -
- 2618 - If you want to retain the original \c argc and \c argv vari
- -ables the
- 2619 - following slightly longer and more complicated code works a
- -s well on
- 2620 - all platforms.
- 2621 -
- 2622 - \code
- 2623 - int main(int argc, char **argv) {
- 2624 - char **argvn = argv; // must copy argv to wo
- -rk on all platforms
- 2625 - int argcn = Fl::args_to_utf8(argc, argvn);
- 2626 - // ... use argcn and argvn, e.g. for commandline parsin
- -g
- 2627 - window->show(argcn, argvn);
- 2628 - return Fl::run();
- 2629 - }
- 2630 - \endcode
- 2631 -
- 2632 - \param[in] argc used only on non-Windows platforms
- 2633 - \param[out] argv modified only on Windows platforms
- 2580 + \param[in] argc argument count
- 2581 + \param[out] argv argument array
- 2582 \returns argument count (always the same as argc)
- 2583
- 2584 \since 1.4.0
- 2637 -
- 2638 - \internal This function must not open the display, otherwis
- -e
- 2639 - commandline processing (e.g. by fluid) would open the dis
- -play.
- 2640 - OTOH calling it when the display is opened wouldn't work
- -either
- 2641 - for the same reasons ('fluid -c' doesn't open the display
- -).
- 2585 */
- 2586 int Fl::args_to_utf8(int argc, char ** &argv) {
- 2587 return Fl::system_driver()->args_to_utf8(argc, argv);
-
-⏺ Теперь повторю верификационный grep:
-
-⏺ Search(pattern: "#\s*if.*(_WIN32|WIN32\b)|#\s*ifdef\s+(_WIN32|WIN32\b)", path:
- "~/Desktop/fltk/src", output_mode: "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "#\s*if.*(_WIN32|WIN32\b)|#\s*ifdef\s+(_WIN32|WIN32\b)", path:
- "~/Desktop/fltk/FL", output_mode: "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "#\s*if.*__APPLE__", path: "~/Desktop/fltk/src", output_mode:
- "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "#\s*if.*__APPLE__", path: "~/Desktop/fltk/FL", output_mode:
- "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND", path: "~/Desktop/fltk/src", output_mode:
- "content")
- ⎿  Found 0 lines
-
-⏺ Search(pattern: "FLTK_USE_WAYLAND", path: "~/Desktop/fltk/FL", output_mode:
- "content")
- ⎿  Found 0 lines
- ⎿  Found 10 new diagnostic issues in 1 file (ctrl+o to expand)
-
-⏺ Все 0 результатов — _WIN32, __APPLE__ и FLTK_USE_WAYLAND полностью удалены из
- src/ и FL/. Также проверю CMake/ и другие ключевые директории:
-
-⏺ Search(pattern: "#\s*if.*(_WIN32|__APPLE__|FLTK_USE_WAYLAND)", path:
- "~/Desktop/fltk/CMake", output_mode: "content")
- ⎿  Found 2 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "APPLE|WIN32|MSVC|WAYLAND", path: "~/Desktop/fltk/CMake")
- ⎿  Found 10 files (ctrl+o to expand)
-
-⏺ Есть остатки в CMake файлах. Запущу агент для их глубокой проверки.
-
-⏺ Explore(Find platform refs in CMake)
- ⎿  Done (16 tool uses · 22.4k tokens · 55s)
-
-⏺ Осталось много платформо-специфичного кода в CMake файлах. Почищу их. Начну с
- чтения файлов параллельно.
-
-⏺ Read(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Read 345 lines
-
-⏺ Read(~/Desktop/fltk/CMake/setup.cmake)
- ⎿  Read 210 lines
-
-⏺ Read(~/Desktop/fltk/CMake/variables.cmake)
- ⎿  Read 178 lines
-
-⏺ Буду чистить CMake файлы. Начну с параллельных правок.
-
-⏺ Update(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Added 1 line, removed 6 lines
- 136
- 137 fl_find_header(HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
- 138
- 139 -if(WIN32 AND NOT CYGWIN)
- 140 - # we don't use pthreads on Windows (except for Cygwin, see o
- -ptions.cmake)
- 141 - set(HAVE_PTHREAD_H 0)
- 142 -else()
- 143 - fl_find_header(HAVE_PTHREAD_H pthread.h)
- 144 -endif(WIN32 AND NOT CYGWIN)
- 139 +fl_find_header(HAVE_PTHREAD_H pthread.h)
- 140
- 141 # Do we have PTHREAD_MUTEX_RECURSIVE ?
- 142
-
-⏺ Update(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Removed 25 lines
- 149 set(HAVE_PTHREAD_MUTEX_RECURSIVE 0)
- 150 endif()
- 151
- 152 -# Special case for Microsoft Visual Studio generator (MSVC):
- 153 -#
- 154 -# The header files <GL/glu.h> and <locale.h> are located in th
- -e SDK's
- 155 -# for Visual Studio. If CMake is invoked from a desktop icon o
- -r the Windows
- 156 -# menu it doesn't have the correct paths to find these header
- -files.
- 157 -# The CMake folks recommend not to search for these files at a
- -ll, because
- 158 -# they must always be there, but we do anyway.
- 159 -# If we don't find them we issue a warning and continue anyway
- -.
- 160 -#
- 161 -# Note: these cache variables can only be seen in "advanced" m
- -ode.
- 162 -
- 163 -if(MSVC)
- 164 -
- 165 - if(NOT HAVE_GL_GLU_H)
- 166 - message(STATUS "Info: Header file GL/glu.h was not found.
- -Continuing...")
- 167 - set(HAVE_GL_GLU_H 1)
- 168 - endif(NOT HAVE_GL_GLU_H)
- 169 -
- 170 - if(NOT HAVE_LOCALE_H)
- 171 - message(STATUS "Info: Header file locale.h was not found.
- -Continuing...")
- 172 - set(HAVE_LOCALE_H 1)
- 173 - endif(NOT HAVE_LOCALE_H)
- 174 -
- 175 -endif(MSVC)
- 176 -
- 152 # Simulate the behavior of autoconf macro AC_HEADER_DIRENT, se
- e:
- 153 # https://www.gnu.org/software/autoconf/manual/autoconf-2.69/h
- tml_node/Particular-Headers.html
- 154 # "Check for the following header files. For the first one tha
- t is found
-
-⏺ Update(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Added 2 lines, removed 2 lines
- 178 find_path(FREETYPE_PATH freetype.h PATH_SUFFIXES freetype2)
- 179 find_path(FREETYPE_PATH freetype/freetype.h PATH_SUFFIXES free
- type2)
- 180
- 181 -if(FREETYPE_PATH AND ((NOT APPLE) OR FLTK_BACKEND_X11))
- 181 +if(FREETYPE_PATH)
- 182 list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${FREETYPE_PATH})
- 183 -endif(FREETYPE_PATH AND ((NOT APPLE) OR FLTK_BACKEND_X11))
- 183 +endif(FREETYPE_PATH)
- 184
- 185 mark_as_advanced(FREETYPE_PATH)
- 186
-
-⏺ Update(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Added 1 line, removed 3 lines
- 187 ##############################################################
- #########
- 188 # libraries
- 189 find_library(LIB_dl dl)
- 190 -if((NOT APPLE) OR FLTK_BACKEND_X11)
- 191 - find_library(LIB_fontconfig fontconfig)
- 192 -endif((NOT APPLE) OR FLTK_BACKEND_X11)
- 190 +find_library(LIB_fontconfig fontconfig)
- 191 find_library(LIB_freetype freetype)
- 192 find_library(LIB_GL GL)
- 193 find_library(LIB_MesaGL MesaGL)
-
-⏺ Update(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Removed 5 lines
- 237 check_symbol_exists(scandir "dirent.h" HAVE_SCA
- NDIR)
- 238 check_symbol_exists(snprintf "stdio.h" HAVE_SNP
- RINTF)
- 239
- 240 -# not really true but we convert strcasecmp calls to _stricmp
- -calls in flstring.h
- 241 -if(MSVC)
- 242 - set(HAVE_STRCASECMP 1)
- 243 -endif(MSVC)
- 244 -
- 240 check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASEC
- MP)
- 241
- 242 check_symbol_exists(strlcat "string.h" HAVE_STRLCAT)
-
-⏺ Update(~/Desktop/fltk/CMake/resources.cmake)
- ⎿  Added 1 line, removed 2 lines
- 245
- 246 check_symbol_exists(setenv "stdlib.h" HAVE_SETENV)
- 247
- 248 -# Windows doesn't require '-lm' for trunc(), other platforms d
- -o
- 249 -if(LIB_m AND NOT WIN32)
- 248 +if(LIB_m)
- 249 set(CMAKE_REQUIRED_LIBRARIES ${LIB_m})
- 250 endif()
- 251
-
-⏺ Теперь setup.cmake:
-
-⏺ Update(~/Desktop/fltk/CMake/setup.cmake)
- ⎿  Added 1 line, removed 7 lines
- 93 ##############################################################
- #########
- 94
- 95 # set where config files go
- 96 -if(WIN32 AND NOT CYGWIN)
- 97 - set(FLTK_CONFIG_PATH CMake)
- 98 -elseif(APPLE AND NOT FLTK_BACKEND_X11)
- 99 - set(FLTK_CONFIG_PATH ${FLTK_DATADIR}/fltk)
- 100 -else()
- 101 - set(FLTK_CONFIG_PATH ${FLTK_DATADIR}/fltk)
- 102 -endif(WIN32 AND NOT CYGWIN)
- 96 +set(FLTK_CONFIG_PATH ${FLTK_DATADIR}/fltk)
- 97
- 98 include(TestBigEndian)
- 99 TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
-
-⏺ Update(~/Desktop/fltk/CMake/setup.cmake)
- ⎿  Removed 69 lines
- 104 set(CMAKE_XCODE_GENERATE_SCHEME 1)
- 105 endif()
- 106
- 107 -if(APPLE)
- 108 - # Check if the __MAC_OS_X_VERSION_MAX_ALLOWED compile time m
- -acro is at least
- 109 - # the version encoded in SDK_VERSION and return TRUE or FALS
- -E in RESULT.
- 110 - # Note 1: try_compile() always creates an *internal* CMake c
- -ache variable for
- 111 - # the result which we set to 'FLTK_CHECK_OSX_MAX_ALL
- -OWED_${SDK_VERSION}'.
- 112 - # Note 2: 'FLTK_' to avoid polluting the cache if FLTK is bu
- -ilt as a subproject.
- 113 - # Note 3: We don't care about the cache, i.e. we run try_com
- -pile() unconditionally
- 114 - # so users can switch SDK's, particularly if they *u
- -pgrade* Xcode.
- 115 -
- 116 - function(CHECK_OSX_MAX_ALLOWED SDK_VERSION RESULT)
- 117 - set(_result FLTK_CHECK_OSX_MAX_ALLOWED_${SDK_VERSION})
- 118 - try_compile(${_result}
- 119 - ${CMAKE_CURRENT_BINARY_DIR}/CHECK_OSX_MAX_ALLOWED_${SDK_
- -VERSION}
- 120 - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMake/macOSMaxAllowe
- -d.c
- 121 - COMPILE_DEFINITIONS -DSDK_VERSION_CHECK=${SDK_VERSION}
- 122 - )
- 123 - set(${RESULT} ${${_result}} PARENT_SCOPE)
- 124 - endfunction()
- 125 -
- 126 - # APPLE macOS setup
- 127 - set(HAVE_STRCASECMP 1)
- 128 - set(HAVE_DIRENT_H 1)
- 129 - set(HAVE_SNPRINTF 1)
- 130 - set(HAVE_VSNPRINTF 1)
- 131 - set(HAVE_SCANDIR 1)
- 132 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
- 133 - if(FLTK_BACKEND_X11)
- 134 - if(NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0)) # a.k
- -.a. macOS version ≥ 10.13
- 135 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_HAS_TH
- -READ_API_PTHREAD")
- 136 - endif(NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0))
- 137 - else()
- 138 - set(FLTK_COCOA_FRAMEWORKS "-framework Cocoa")
- 139 - if (NOT (CMAKE_OSX_ARCHITECTURES STREQUAL "ppc" OR CMAKE_O
- -SX_ARCHITECTURES STREQUAL "i386"))
- 140 - CHECK_OSX_MAX_ALLOWED(150000 SDK_15_AVAILABLE) # at leas
- -t SDK 15.0.0 ?
- 141 - if (SDK_15_AVAILABLE)
- 142 - list(APPEND FLTK_COCOA_FRAMEWORKS "-weak_framework Scr
- -eenCaptureKit") # 15.0
- 143 - list(APPEND FLTK_COCOA_FRAMEWORKS "-weak_framework Uni
- -formTypeIdentifiers") # 11.0
- 144 - else(SDK_15_AVAILABLE)
- 145 - CHECK_OSX_MAX_ALLOWED(110000 SDK_11_AVAILABLE) # at le
- -ast SDK 11.0.0 ?
- 146 - if (SDK_11_AVAILABLE)
- 147 - list(APPEND FLTK_COCOA_FRAMEWORKS "-weak_framework U
- -niformTypeIdentifiers")
- 148 - endif(SDK_11_AVAILABLE)
- 149 - endif(SDK_15_AVAILABLE)
- 150 - endif()
- 151 - endif(FLTK_BACKEND_X11)
- 152 -endif(APPLE)
- 153 -
- 154 -if(WIN32)
- 155 - # we do no longer define WIN32 or _WIN32 (since FLTK 1.4.0)
- 156 - # ... but if we did, we'd define _WIN32 (since FLTK 1.4.0)
- 157 - # add_definitions (-D_WIN32)
- 158 - if(MSVC)
- 159 - add_definitions (-DWIN32_LEAN_AND_MEAN)
- 160 - add_definitions (-D_CRT_SECURE_NO_WARNINGS)
- 161 - if(NOT MSVC_VERSION VERSION_LESS 1900) # Visual Studio 201
- -5
- 162 - add_compile_options (/utf-8) # equivalent to `/s
- -ource-charset:utf-8 /execution-charset:utf-8`
- 163 - endif()
- 164 - set(BORDER_WIDTH 2)
- 165 - endif(MSVC)
- 166 -
- 167 - # Don't use the following code, it breaks building with MSYS
- -2/UCRT64
- 168 - # See GitHub PR #1167. Solution is to remove the entire bloc
- -k!
- 169 -
- 170 - ### if(MINGW AND EXISTS /mingw)
- 171 - ### list(APPEND CMAKE_PREFIX_PATH /mingw)
- 172 - ### endif(MINGW AND EXISTS /mingw)
- 173 -
- 174 -endif(WIN32)
- 175 -
- 107 ##############################################################
- #########
- 108 # size of ints
- 109 include(CheckTypeSize)
-
-⏺ Теперь variables.cmake:
-
-⏺ Update(~/Desktop/fltk/CMake/variables.cmake)
- ⎿  Added 1 line, removed 17 lines
- 39 # FIXME: libraries may need reordering.
- 40 # FIXME: check fontconfig conditions (only if Xft is used or ..
- .)
- 41
- 42 -if(WIN32)
- 43 - list(APPEND FLTK_LDLIBS -lole32 -luuid -lcomctl32 -lws2_32 -l
- -winspool)
- 44 -elseif(APPLE AND NOT FLTK_BACKEND_X11)
- 45 - list(APPEND FLTK_LDLIBS ${FLTK_COCOA_FRAMEWORKS})
- 46 -elseif(FLTK_USE_WAYLAND)
- 47 - foreach(_lib WLDCURSOR WLDCLIENT XKBCOMMON)
- 48 - list(APPEND FLTK_LDLIBS "${${_lib}_LDFLAGS}")
- 49 - endforeach()
- 50 - if(FLTK_USE_DBUS AND DBUS_FOUND)
- 51 - list(APPEND FLTK_LDLIBS "${DBUS_LDFLAGS}")
- 52 - endif()
- 53 - if(USE_SYSTEM_LIBDECOR)
- 54 - list(APPEND FLTK_LDLIBS ${SYSTEM_LIBDECOR_LDFLAGS})
- 55 - endif(USE_SYSTEM_LIBDECOR)
- 56 -else()
- 57 - list(APPEND FLTK_LDLIBS -lm)
- 58 -endif(WIN32)
- 42 +list(APPEND FLTK_LDLIBS -lm)
- 43
- 44 if(LIB_fontconfig)
- 45 list(APPEND FLTK_LDLIBS -lfontconfig)
-
-⏺ Update(~/Desktop/fltk/CMake/variables.cmake)
- ⎿  Removed 4 lines
- 64 # should be set here, whereas variables with different values s
- hould
- 65 # be set in install.cmake or export.cmake, respectively.
- 66
- 67 -if(WIN32)
- 68 - set(LDFLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows")
- 69 -endif()
- 70 -
- 67 set(IMAGELIBS)
- 68 set(STATICIMAGELIBS)
- 69
-
-⏺ Теперь прочитаю и почищу оставшиеся CMake файлы.
-
-⏺ Read(~/Desktop/fltk/CMake/export.cmake)
- ⎿  Read 151 lines
-
-⏺ Read(~/Desktop/fltk/CMake/fl_add_library.cmake)
- ⎿  Read 258 lines
-
-⏺ Read(~/Desktop/fltk/CMake/fl_create_example.cmake)
- ⎿  Read 174 lines
-
-⏺ Теперь применю правки к export.cmake, fl_add_library.cmake и
- fl_create_example.cmake параллельно, а также удалю Windows-only файл.
-
-⏺ Update(~/Desktop/fltk/CMake/export.cmake)
- ⎿  Added 2 lines, removed 7 lines
- 24
- 25 if(FLTK_BUILD_FLUID AND NOT CMAKE_CROSSCOMPILING)
- 26 # Use the fluid executable we build using its namespaced targ
- et name
- 27 - if(WIN32)
- 28 - set(FLTK_FLUID_EXECUTABLE fltk::fluid-cmd)
- 29 - set(FLUID_EXPORT fluid fluid-cmd) # export fluid and f
- -luid-cmd
- 30 - else()
- 31 - set(FLTK_FLUID_EXECUTABLE fltk::fluid)
- 32 - set(FLUID_EXPORT fluid) # export fluid
- 33 - endif()
- 27 + set(FLTK_FLUID_EXECUTABLE fltk::fluid)
- 28 + set(FLUID_EXPORT fluid) # export fluid
- 29 else()
- 30 # We don't build fluid /or/ we are cross-compiling (or both):
- 31 # we need to find a fluid executable on the build host.
-
-⏺ Update(~/Desktop/fltk/CMake/export.cmake)
- ⎿  Removed 3 lines
- 57 # set fltk-options export names (built or not, Windows)
- 58 if(FLTK_BUILD_FLTK_OPTIONS)
- 59 set(FLTK_OPTIONS_EXPORT fltk-options)
- 60 - if(WIN32)
- 61 - list(APPEND FLTK_OPTIONS_EXPORT fltk-options-cmd)
- 62 - endif()
- 60 else()
- 61 set(FLTK_OPTIONS_EXPORT)
- 62 endif()
-
-⏺ Update(~/Desktop/fltk/CMake/export.cmake)
- ⎿  Added 2 lines, removed 4 lines
- 117 # use fallback before CMake 3.19
- 118
- 119 if(CMAKE_VERSION VERSION_LESS 3.19)
- 120 - if(UNIX OR MSYS OR MINGW)
- 121 - execute_process(COMMAND chmod 755 fltk-config
- 122 - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
- 123 - endif()
- 120 + execute_process(COMMAND chmod 755 fltk-config
- 121 + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
- 122 else(CMAKE_VERSION VERSION_LESS 3.19)
- 123 file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/fltk-config"
- 124 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
-
-⏺ Update(~/Desktop/fltk/CMake/fl_add_library.cmake)
- ⎿  Added 1 line, removed 5 lines
- 57
- 58 string(REPLACE "fltk_" "" EXPORT_NAME ${TARGET_NAME})
- 59
- 60 - if(MSVC)
- 61 - set(OUTPUT_NAME_DEBUG "${LIBNAME}d")
- 62 - else()
- 63 - set(OUTPUT_NAME_DEBUG "${LIBNAME}")
- 64 - endif(MSVC)
- 60 + set(OUTPUT_NAME_DEBUG "${LIBNAME}")
- 61
- 62 set(OUTPUT_NAME_RELEASE "${LIBNAME}")
- 63
-
-⏺ Update(~/Desktop/fltk/CMake/fl_add_library.cmake)
- ⎿  Added 1 line, removed 7 lines
- 151 $<INSTALL_INTERFACE:lib>
- 152 )
- 153
- 154 - if(APPLE AND NOT FLTK_BACKEND_X11)
- 155 - foreach(item ${FLTK_COCOA_FRAMEWORKS})
- 156 - target_link_libraries(${TARGET_NAME} PUBLIC "${item}")
- 157 - endforeach()
- 158 - endif()
- 159 -
- 160 - # we must link fltk with cairo if Cairo or Wayland is enab
- -led (or both)
- 154 + # we must link fltk with cairo if Cairo is enabled
- 155 if(FLTK_HAVE_CAIRO OR FLTK_USE_CAIRO)
- 156 target_include_directories(${TARGET_NAME} PUBLIC ${PKG_C
- AIRO_INCLUDE_DIRS})
- 157 target_link_directories (${TARGET_NAME} PUBLIC ${PKG_C
- AIRO_LIBRARY_DIRS})
-
-⏺ Update(~/Desktop/fltk/CMake/fl_add_library.cmake)
- ⎿  Removed 9 lines
- 183 OUTPUT_NAME_RELEASE ${OUTPUT_NAME_RELEASE}
- 184 EXPORT_NAME ${EXPORT_NAME}
- 185 )
- 186 - # Visual Studio only:
- 187 - if(MSVC)
- 188 - set_target_properties(${TARGET_NAME} PROPERTIES
- 189 - OUTPUT_NAME ${LIBNAME}_dll
- 190 - OUTPUT_NAME_DEBUG ${LIBNAME}_dlld
- 191 - OUTPUT_NAME_RELEASE ${LIBNAME}_dll
- 192 - )
- 193 - target_compile_definitions(${TARGET_NAME} PUBLIC FL_DLL)
- 194 - endif(MSVC)
- 186 endif(LIBTYPE STREQUAL "SHARED")
- 187
- 188 # Debug library output names (optional)
-
-⏺ Update(~/Desktop/fltk/CMake/fl_add_library.cmake)
- ⎿  Removed 8 lines
- 205 message(STATUS "--- /DEBUG_ONAME ---")
- 206 endif(DEBUG_ONAME)
- 207
- 208 - if(MSVC)
- 209 - if(FLTK_OPTION_LARGE_FILE)
- 210 - set_target_properties(${TARGET_NAME} PROPERTIES
- 211 - LINK_FLAGS /LARGEADDRESSAWARE
- 212 - )
- 213 - endif(FLTK_OPTION_LARGE_FILE)
- 214 - endif(MSVC)
- 215 -
- 208 install(TARGETS ${TARGET_NAME} EXPORT FLTK-Targets
- 209 RUNTIME DESTINATION ${FLTK_BINDIR}
- 210 LIBRARY DESTINATION ${FLTK_LIBDIR}
-
-⏺ Теперь fl_create_example.cmake:
-
-⏺ Update(~/Desktop/fltk/CMake/fl_create_example.cmake)
- ⎿  Added 1 line, removed 13 lines
- 56 set(PLIST) # macOS .plist file(max. one)
- 57 set(ICON_PATH) # macOS icon resource path
- 58
- 59 - # create macOS bundle? 0 = no, 1 = yes
- 59 + # filter input files for different handling (fluid, source)
- 60
- 61 - if(APPLE AND NOT FLTK_BACKEND_X11)
- 62 - set(MAC_BUNDLE 1)
- 63 - else()
- 64 - set(MAC_BUNDLE 0)
- 65 - endif()
- 66 -
- 67 - # filter input files for different handling (fluid, icon, pli
- -st, source)
- 68 -
- 61 foreach(src ${SOURCES})
- 62 if("${src}" MATCHES "\\.fl$")
- 63 list(APPEND flsrcs ${src})
- 72 - elseif("${src}" MATCHES "\\.icns$")
- 73 - set(ICON_NAME "${src}")
- 74 - elseif("${src}" MATCHES "\\.plist$")
- 75 - set(PLIST "${src}")
- 64 else()
- 65 list(APPEND srcs ${src})
- 66 endif("${src}" MATCHES "\\.fl$")
-
-⏺ Update(~/Desktop/fltk/CMake/fl_create_example.cmake)
- ⎿  Added 2 lines, removed 12 lines
- 78 unset(FLUID_SOURCES)
- 79 endif(flsrcs)
- 80
- 81 - # set macOS (icon) resource path if applicable
- 82 -
- 83 - if(MAC_BUNDLE AND ICON_NAME)
- 84 - set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/mac-resources/${
- -ICON_NAME}")
- 85 - endif(MAC_BUNDLE AND ICON_NAME)
- 86 -
- 81 #############################################################
- #################
- 88 - # add executable target and set properties (all platforms)
- 82 + # add executable target and set properties
- 83 #############################################################
- #################
- 84
- 91 - if(MAC_BUNDLE)
- 92 - add_executable (${TARGET_NAME} MACOSX_BUNDLE ${srcs}
- - ${ICON_PATH})
- 93 - else()
- 94 - add_executable (${TARGET_NAME} WIN32 ${srcs})
- 95 - endif(MAC_BUNDLE)
- 85 + add_executable (${TARGET_NAME} ${srcs})
- 86
- 87 set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAM
- E ${NAME})
- 88 target_link_libraries (${TARGET_NAME} PRIVATE ${LIBRARIES})
-
-⏺ Update(~/Desktop/fltk/CMake/fl_create_example.cmake)
- ⎿  Removed 4 lines
- 87 set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAM
- E ${NAME})
- 88 target_link_libraries (${TARGET_NAME} PRIVATE ${LIBRARIES})
- 89
- 90 - # make sure we're "exporting" global symbols like 'fl_disable
- -_wayland',
- 91 - # see also README.Wayland.txt and CMake policy CMP0065.
- 92 -
- 90 set_target_properties (${TARGET_NAME} PROPERTIES ENABLE_EXP
- ORTS TRUE)
- 91
- 95 -
- 92 # Search the current binary directory for header files create
- d by CMake
- 93 # or fluid and the source folder for other headers included b
- y test programs
- 94
-
-⏺ Update(~/Desktop/fltk/CMake/fl_create_example.cmake)
- ⎿  Removed 47 lines
- 97 ${CMAKE_CURRENT_SOURCE_DIR}
- 98 )
- 99
- 100 - if(MAC_BUNDLE)
- 101 - if(PLIST)
- 102 - set_target_properties(${TARGET_NAME} PROPERTIES MACOSX_B
- -UNDLE_INFO_PLIST
- 103 - "${CMAKE_CURRENT_SOURCE_DIR}/mac-r
- -esources/${PLIST}")
- 104 - endif()
- 105 -
- 106 - string(REPLACE "_" "-" FLTK_BUNDLE_ID "org.fltk.${TARGET_N
- -AME}")
- 107 - set_target_properties(${TARGET_NAME} PROPERTIES MACOSX_BUN
- -DLE_BUNDLE_NAME "${TARGET_NAME}")
- 108 - set_target_properties(${TARGET_NAME} PROPERTIES MACOSX_BUN
- -DLE_GUI_IDENTIFIER "${FLTK_BUNDLE_ID}")
- 109 - set_target_properties(${TARGET_NAME} PROPERTIES XCODE_ATTR
- -IBUTE_PRODUCT_BUNDLE_IDENTIFIER "${FLTK_BUNDLE_ID}")
- 110 -
- 111 - if(ICON_NAME)
- 112 - set_target_properties(${TARGET_NAME} PROPERTIES MACOSX_B
- -UNDLE_ICON_FILE ${ICON_NAME})
- 113 - set_target_properties(${TARGET_NAME} PROPERTIES RESOURCE
- - ${ICON_PATH})
- 114 - endif()
- 115 - endif()
- 116 -
- 117 - ############################################################
- -##################
- 118 - # Copy macOS "bundle wrapper" (shell script) to target direc
- -tory.
- 119 - # The "custom command" will be executed "POST_BUILD".
- 120 - ############################################################
- -##################
- 121 -
- 122 - if(MAC_BUNDLE)
- 123 - set(WRAPPER "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}
- -/${TARGET_NAME}")
- 124 -
- 125 - add_custom_command(
- 126 - TARGET ${TARGET_NAME} POST_BUILD
- 127 - COMMAND cp ${FLTK_SOURCE_DIR}/CMake/macOS-bundle-wrapper
- -.in ${WRAPPER}
- 128 - COMMAND chmod u+x,g+x,o+x ${WRAPPER}
- 129 - BYPRODUCTS ${WRAPPER}
- 130 - # COMMENT "Creating macOS bundle wrapper script ${WRAPPE
- -R}"
- 131 - VERBATIM
- 132 - )
- 133 - unset(WRAPPER)
- 134 - endif(MAC_BUNDLE)
- 135 -
- 136 - ############################################################
- -##################
- 137 - # MSVC: Add fltk-shared (DLL) path to Environment 'PATH' for
- - debugging
- 138 - ############################################################
- -##################
- 139 -
- 140 - if(MSVC AND TARGET fltk-shared)
- 141 - set(DllDir "$<SHELL_PATH:$<TARGET_FILE_DIR:fltk-shared>>")
- 142 - set_target_properties(${TARGET_NAME} PROPERTIES
- 143 - VS_DEBUGGER_ENVIRONMENT "PATH=${DllDir};$ENV{PATH}"
- 144 - )
- 145 - endif()
- 146 -
- 100 endfunction()
-
-⏺ Удалю Windows-only файл pen-support.c и проверю FLTKConfig.cmake.in:
-
-⏺ Bash(rm /Users/mnik01/Desktop/fltk/CMake/pen-support.c)
- ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni
- k01/Desktop/hobby/emsdk/emsdk_env.sh
-
-
-⏺ Search(pattern: "APPLE|WIN32|MSVC|WAYLAND|MINGW|CYGWIN", path:
- "~/Desktop/fltk/CMake/FLTKConfig.cmake.in", output_mode: "content")
- ⎿  Found 7 lines (ctrl+o to expand)
-
-⏺ Read(~/Desktop/fltk/CMake/FLTKConfig.cmake.in)
- ⎿  Read 20 lines
-
-⏺ Update(~/Desktop/fltk/CMake/FLTKConfig.cmake.in)
- ⎿  Added 2 lines, removed 7 lines
- 125 endif() # Create aliases ...
- 126
- 127 # set FLTK_FLUID_EXECUTABLE: try to use the fltk::target nam
- e if it
- 128 - # exists and fall back to 'fluid-cmd' or 'fluid' if not. Thi
- -s will
- 129 - # eventually call the build host's fluid if found in the use
- -rs's PATH
- 128 + # exists and fall back to 'fluid' if not.
- 129
- 131 - if(TARGET fltk::fluid-cmd) # Windows only
- 132 - set(FLTK_FLUID_EXECUTABLE fltk::fluid-cmd)
- 133 - elseif(TARGET fltk::fluid)
- 130 + if(TARGET fltk::fluid)
- 131 set(FLTK_FLUID_EXECUTABLE fltk::fluid)
- 135 - elseif(WIN32)
- 136 - set(FLTK_FLUID_EXECUTABLE fluid-cmd)
- 132 else()
- 133 set(FLTK_FLUID_EXECUTABLE fluid)
- 134 endif()
-
-⏺ Теперь проверю, не осталось ли ещё ссылок на удалённый check_mac_sdk.c:
-
-⏺ Search(pattern: "check_mac_sdk|macOSMaxAllowed|CHECK_OSX_MAX_ALLOWED", path:
- "~/Desktop/fltk/CMake")
- ⎿  Found 0 files
-
-⏺ Финальная верификация — поиск платформо-специфичных ссылок во всех CMake
- файлах:
-
-⏺ Search(pattern: "\bAPPLE\b|\bWIN32\b|\bMSVC\b|\bWAYLAND\b|\bMINGW\b|\bCYGWIN\b
- |\b__APPLE__\b|\b_WIN32\b", path: "~/Desktop/fltk/CMake", output_mode:
- "content")
- ⎿  Found 6 lines (ctrl+o to expand)
-
-⏺ Остались только ссылки в комментариях и debug-блоках — это неопасно. Почищу
- debug-блоки в options.cmake:
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Added 2 lines, removed 2 lines
- 50 set(DEBUG_OPTIONS_CMAKE 0)
- 51 if(DEBUG_OPTIONS_CMAKE)
- 52 message(STATUS "[** options.cmake **]")
- 53 - fl_debug_var(WIN32)
- 53 + # fl_debug_var(WIN32) # removed: X11-only
- 54 fl_debug_var(FLTK_LDLIBS)
- 55 endif(DEBUG_OPTIONS_CMAKE)
- 56
- ...
- 690
- 691 if(DEBUG_OPTIONS_CMAKE)
- 692 message(STATUS "") # empty line
- 693 - fl_debug_var(WIN32)
- 693 + # fl_debug_var(WIN32) # removed: X11-only
- 694 fl_debug_var(LIBS)
- 695 fl_debug_var(GLLIBS)
- 696 fl_debug_var(FLTK_LDLIBS)
-
-⏺ Update(~/Desktop/fltk/CMake/options.cmake)
- ⎿  Added 1 line, removed 1 line
- 470 # always use native threads on Windows (even if libpthread is
- available).
- 471
- 472 # Note: HAVE_PTHREAD_H has already been determined in resource
- s.cmake
- 473 -# before this file is included (or set to 0 for WIN32).
- 473 +# before this file is included.
- 474
- 475 option(FLTK_USE_PTHREADS "use multi-threading with pthreads" O
- N)
- 476
-
-⏺ Также проверю, нет ли ссылок на fl_call_main.c в CMakeLists файлах (мы его
- удалили):
-
-⏺ Search(pattern: "fl_call_main", path: "~/Desktop/fltk", glob: "*.cmake")
- ⎿  Found 0 files
-
-⏺ Search(pattern: "fl_call_main", path: "~/Desktop/fltk", glob:
- "CMakeLists.txt")
- ⎿  Found 0 files
-
-⏺ Отлично. Также нужно проверить fluid/ и test/ на платформо-специфичные #ifdef
- ветки — но эти директории не входили в текущую задачу Фазы 1. Проверю только
- остатки в ключевых директориях:
-
-⏺ Search(pattern: "\bAPPLE\b|\bWIN32\b|\bMSVC\b|\bWAYLAND\b", path:
- "~/Desktop/fltk/CMake", glob: "*.cmake", output_mode: "content")
- ⎿  Found 5 lines (ctrl+o to expand)
-
-⏺ Только комментарии. Верификация src/ и FL/:
-
-⏺ Search(pattern: "#\s*if.*(WIN32|_WIN32|__APPLE__|WAYLAND|MSVC|CYGWIN|MINGW)",
- path: "~/Desktop/fltk/src", output_mode: "count")
- ⎿  Found 3 matches across 2 files (ctrl+o to expand)
-
-⏺ Search(pattern: "#\s*if.*(WIN32|_WIN32|__APPLE__|WAYLAND|MSVC|CYGWIN|MINGW)",
- path: "~/Desktop/fltk/FL", output_mode: "count")
- ⎿  Found 0 matches across 0 files
-
-⏺ Search(pattern: "#\s*if.*(WIN32|_WIN32|__APPLE__|WAYLAND|MSVC|CYGWIN|MINGW)",
- path:
- "~/Desktop/fltk/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx",
- output_mode: "content")
- ⎿  Found 15 lines (ctrl+o to expand)
-
-⏺ Search(pattern: "#\s*if.*(WIN32|_WIN32|__APPLE__|WAYLAND|MSVC|CYGWIN|MINGW)",
- path: "~/Desktop/fltk/src/Fl_JPEG_Image.cxx", output_mode: "content")
- ⎿  Found 11 lines (ctrl+o to expand)
-
-⏺ Остались 3 __CYGWIN__ ссылки — Cygwin технически является X11-платформой (Xft
- обработка разной ширины wchar_t), поэтому это допустимо. Все основные
- платформо-специфичные ветки _WIN32, __APPLE__, FLTK_USE_WAYLAND полностью
- удалены.
-
-⏺ Фаза 1 завершена. Вот итоговая сводка выполненной работы:
-
- Фаза 1: Удаление не-X11 платформ — Завершено
-
- Удалённые директории (~70 файлов):
-
- - src/drivers/Cocoa/, src/drivers/Darwin/, src/drivers/GDI/,
- src/drivers/Quartz/, src/drivers/Wayland/, src/drivers/WinAPI/, libdecor/
-
- Удалённые исходные файлы:
-
- - src/: Fl_win32.cxx, fl_dnd_win32.cxx, Fl_get_key_win32.cxx, Fl_cocoa.mm,
- Fl_get_key_mac.cxx, Fl_MacOS_Sys_Menu_Bar.mm,
- Fl_Native_File_Chooser_WIN32.cxx, Fl_Native_File_Chooser_MAC.mm,
- fl_encoding_mac_roman.cxx, scandir_win32.c, fl_call_main.c
- - FL/: win32.H, mac.H, wayland.H
- - CMake/: pen-support.c, MacOSXBundleInfo.plist.in, macOS-bundle-wrapper.in,
- macOSMaxAllowed.c
- - README.macOS.md, README.Windows.txt, README.Wayland.txt
- - fluid/tools/ExternalCodeEditor_WIN32.cxx
-
- Упрощённые файлы:
-
- - FL/platform.H — только #include "x11.H"
- - FL/math.h — убран macOS cyclic include и WIN32/CRAY блок
- - FL/gl.h, FL/glu.h — убраны WIN32/APPLE пути, только <GL/gl.h>
- - FL/fl_utf8.h — убран WIN32 блок
- - FL/Fl_Window.H — убран HICON блок (36 строк)
- - FL/Fl.H — убран APPLE блок
- - FL/platform_types.h — убраны WIN64/WIN32 типы и dirent
- - src/Fl_Cairo.cxx — упрощён до X11-only (убрано ~80 строк
- платформо-зависимого кода)
- - src/Fl.cxx — упрощена документация args_to_utf8
- - src/flstring.h — убран WIN32 strcasecmp хак
- - src/forms_fselect.cxx — убрана WIN32 проверка пути
- - src/CMakeLists.txt — убрано ~400 строк платформо-зависимого кода
- - CMakeLists.txt — убраны macOS/MSVC/Wayland секции
- - CMake/options.cmake — убраны Wayland, WIN32, APPLE опции и детекция
- - CMake/resources.cmake — убраны WIN32/MSVC/APPLE блоки
- - CMake/setup.cmake — убраны APPLE и WIN32 секции (~60 строк)
- - CMake/variables.cmake — упрощено до X11 линковки
- - CMake/export.cmake — убраны WIN32 пути для fluid/fltk-options
- - CMake/fl_add_library.cmake — убраны MSVC/APPLE секции
- - CMake/fl_create_example.cmake — убраны MAC_BUNDLE/WIN32/MSVC секции
- - CMake/FLTKConfig.cmake.in — убран WIN32 fluid-cmd
-
- Результат верификации:
-
- - #ifdef _WIN32 в src/, FL/ → 0 результатов
- - #ifdef __APPLE__ в src/, FL/ → 0 результатов
- - FLTK_USE_WAYLAND в src/, FL/ → 0 результатов
- - Платформо-специфичный CMake код в CMake/ → только комментарии
-
- Следующая фаза по плану — Фаза 2: Замена CMake на Makefile.
-
-✻ Crunched for 33m 46s
-
diff --git a/bin/fluid b/bin/fluid
index 4bc2b9981..3264b785c 100755
--- a/bin/fluid
+++ b/bin/fluid
Binary files differ
diff --git a/lib/libfltk.a b/lib/libfltk.a
index 9d91f3b79..3cfe47827 100644
--- a/lib/libfltk.a
+++ b/lib/libfltk.a
Binary files differ
diff --git a/src/Fl.cxx b/src/Fl.cxx
index ac5b6a601..45509a0f6 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -71,10 +71,10 @@ void *Fl::e_clipboard_data = NULL;
Fl_Event_Dispatch Fl::e_dispatch = 0;
Fl_Callback_Reason Fl::callback_reason_ = FL_REASON_UNKNOWN;
-unsigned char Fl::Private::options_[] = { 0, 0 };
-unsigned char Fl::Private::options_read_ = 0;
+unsigned char Fl_Private_options_[] = { 0, 0 };
+unsigned char Fl_Private_options_read_ = 0;
-int Fl::Private::selection_to_clipboard_ = 0;
+int Fl_Private_selection_to_clipboard_ = 0;
Fl_Window *fl_xfocus = NULL; // which window X thinks has focus
Fl_Window *fl_xmousewin; // which window X thinks has FL_ENTER
@@ -114,7 +114,7 @@ char const * const Fl::clipboard_image = "image";
\see copy(const char *, int, int, const char *)
*/
void Fl::selection_to_clipboard(int mode) {
- Private::selection_to_clipboard_ = mode ? 1 : 0;
+ Fl_Private_selection_to_clipboard_ = mode ? 1 : 0;
}
/**
@@ -123,7 +123,7 @@ void Fl::selection_to_clipboard(int mode) {
\see void selection_to_clipboard(int)
*/
int Fl::selection_to_clipboard() {
- return Private::selection_to_clipboard_;
+ return Fl_Private_selection_to_clipboard_;
}
//
@@ -538,7 +538,7 @@ int Fl::has_check(Fl_Timeout_Handler cb, void *argp) {
return 0;
}
-void Fl::Private::run_checks()
+void Fl_Private_run_checks()
{
// checks are a bit messy so that add/remove and wait may be called
// from inside them without causing an infinite loop:
@@ -618,7 +618,7 @@ void fl_trigger_clipboard_notify(int source) {
////////////////////////////////////////////////////////////////
// idle/wait/run/check/ready:
-void (*Fl::Private::idle_)(); // see Fl::add_idle.cxx for the add/remove functions
+void (*Fl_Private_idle_)(); // see Fl::add_idle.cxx for the add/remove functions
/**
Returns whether at least one idle callback is currently set.
@@ -633,7 +633,7 @@ void (*Fl::Private::idle_)(); // see Fl::add_idle.cxx for the add/remove functio
\retval false No idle callback is currently set.
*/
bool Fl::idle() {
- return (Private::idle_ != 0);
+ return (Fl_Private_idle_ != 0);
}
/*
@@ -652,7 +652,7 @@ bool Fl::idle() {
the first idle callback and appends it to the end of the list of idle
callbacks. For details see static function call_idle() in Fl_add_idle.cxx.
- If it is NULL then no idle callbacks are active and Fl::Private::run_idle() returns
+ If it is NULL then no idle callbacks are active and Fl_Private_run_idle() returns
immediately.
Note: idle callbacks can be queued in nested FLTK event loops like
@@ -663,11 +663,11 @@ bool Fl::idle() {
if an event (timeout or button click etc.) handler calls Fl::add_idle()
or even in Fl::flush() if a draw() method calls Fl::add_idle().
*/
-void Fl::Private::run_idle() {
+void Fl_Private_run_idle() {
static char in_idle;
- if (Fl::Private::idle_ && !in_idle) {
+ if (Fl_Private_idle_ && !in_idle) {
in_idle = 1;
- Fl::Private::idle_(); // call the idle callback stored in Fl::Private::idle_ == Fl::idle()
+ Fl_Private_idle_(); // call the idle callback stored in Fl_Private_idle_ == Fl::idle()
in_idle = 0;
}
}
@@ -787,7 +787,7 @@ void Fl::hide_all_windows() {
}
}
-int Fl::Private::program_should_quit_ = 0;
+int Fl_Private_program_should_quit_ = 0;
/** Returns non-zero when a request for program termination was received and accepted.
On the MacOS platform, the "Quit xxx" item of the application menu is such a request,
@@ -796,7 +796,7 @@ int Fl::Private::program_should_quit_ = 0;
\version 1.4.0
*/
int Fl::program_should_quit() {
- return Private::program_should_quit_;
+ return Fl_Private_program_should_quit_;
}
/** Indicate to the FLTK library whether a program termination request was received and accepted.
@@ -805,7 +805,7 @@ int Fl::program_should_quit() {
\version 1.4.0
*/
void Fl::program_should_quit(int should_i) {
- Private::program_should_quit_ = should_i;
+ Fl_Private_program_should_quit_ = should_i;
}
@@ -2120,74 +2120,74 @@ void Fl::clear_widget_pointer(Fl_Widget const *w)
*/
bool Fl::option(Fl_Option opt)
{
- if (!Private::options_read_) {
+ if (!Fl_Private_options_read_) {
int tmp;
{ // first, read the system wide preferences
Fl_Preferences prefs(Fl_Preferences::CORE_SYSTEM, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", tmp, 0); // default: off
- Private::options_[OPTION_ARROW_FOCUS] = tmp;
+ Fl_Private_options_[OPTION_ARROW_FOCUS] = tmp;
//opt_prefs.get("NativeFilechooser", tmp, 1); // default: on
- //Private::options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+ //Fl_Private_options_[OPTION_NATIVE_FILECHOOSER] = tmp;
//opt_prefs.get("FilechooserPreview", tmp, 1); // default: on
- //Private::options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
+ //Fl_Private_options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
opt_prefs.get("VisibleFocus", tmp, 1); // default: on
- Private::options_[OPTION_VISIBLE_FOCUS] = tmp;
+ Fl_Private_options_[OPTION_VISIBLE_FOCUS] = tmp;
opt_prefs.get("DNDText", tmp, 1); // default: on
- Private::options_[OPTION_DND_TEXT] = tmp;
+ Fl_Private_options_[OPTION_DND_TEXT] = tmp;
opt_prefs.get("ShowTooltips", tmp, 1); // default: on
- Private::options_[OPTION_SHOW_TOOLTIPS] = tmp;
+ Fl_Private_options_[OPTION_SHOW_TOOLTIPS] = tmp;
opt_prefs.get("FNFCUsesGTK", tmp, 1); // default: on
- Private::options_[OPTION_FNFC_USES_GTK] = tmp;
+ Fl_Private_options_[OPTION_FNFC_USES_GTK] = tmp;
opt_prefs.get("PrintUsesGTK", tmp, 1); // default: on
- Private::options_[OPTION_PRINTER_USES_GTK] = tmp;
+ Fl_Private_options_[OPTION_PRINTER_USES_GTK] = tmp;
opt_prefs.get("ShowZoomFactor", tmp, 1); // default: on
- Private::options_[OPTION_SHOW_SCALING] = tmp;
+ Fl_Private_options_[OPTION_SHOW_SCALING] = tmp;
opt_prefs.get("UseZenity", tmp, 0); // default: off
- Private::options_[OPTION_FNFC_USES_ZENITY] = tmp;
+ Fl_Private_options_[OPTION_FNFC_USES_ZENITY] = tmp;
opt_prefs.get("UseKdialog", tmp, 0); // default: off
- Private::options_[OPTION_FNFC_USES_KDIALOG] = tmp;
+ Fl_Private_options_[OPTION_FNFC_USES_KDIALOG] = tmp;
opt_prefs.get("SimpleZoomShortcut", tmp, 0); // default: off
- Private::options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp;
+ Fl_Private_options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp;
}
{ // next, check the user preferences
// system options only, if the option is set ( >= 0 )
Fl_Preferences prefs(Fl_Preferences::CORE_USER, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_ARROW_FOCUS] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_ARROW_FOCUS] = tmp;
//opt_prefs.get("NativeFilechooser", tmp, -1);
- //if (tmp >= 0) Private::options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+ //if (tmp >= 0) Fl_Private_options_[OPTION_NATIVE_FILECHOOSER] = tmp;
//opt_prefs.get("FilechooserPreview", tmp, -1);
- //if (tmp >= 0) Private::options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
+ //if (tmp >= 0) Fl_Private_options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
opt_prefs.get("VisibleFocus", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_VISIBLE_FOCUS] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_VISIBLE_FOCUS] = tmp;
opt_prefs.get("DNDText", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_DND_TEXT] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_DND_TEXT] = tmp;
opt_prefs.get("ShowTooltips", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_SHOW_TOOLTIPS] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_SHOW_TOOLTIPS] = tmp;
opt_prefs.get("FNFCUsesGTK", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_FNFC_USES_GTK] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_FNFC_USES_GTK] = tmp;
opt_prefs.get("PrintUsesGTK", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_PRINTER_USES_GTK] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_PRINTER_USES_GTK] = tmp;
opt_prefs.get("ShowZoomFactor", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_SHOW_SCALING] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_SHOW_SCALING] = tmp;
opt_prefs.get("UseZenity", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_FNFC_USES_ZENITY] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_FNFC_USES_ZENITY] = tmp;
opt_prefs.get("UseKdialog", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_FNFC_USES_KDIALOG] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_FNFC_USES_KDIALOG] = tmp;
opt_prefs.get("SimpleZoomShortcut", tmp, -1);
- if (tmp >= 0) Private::options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp;
+ if (tmp >= 0) Fl_Private_options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp;
}
{ // now, if the developer has registered this app, we could ask for per-application preferences
}
- Private::options_read_ = 1;
+ Fl_Private_options_read_ = 1;
}
if (opt<0 || opt>=OPTION_LAST)
return false;
- return (bool)(Private::options_[opt]!=0);
+ return (bool)(Fl_Private_options_[opt]!=0);
}
/**
@@ -2216,11 +2216,11 @@ void Fl::option(Fl_Option opt, bool val)
{
if (opt<0 || opt>=OPTION_LAST)
return;
- if (!Private::options_read_) {
+ if (!Fl_Private_options_read_) {
// make sure that the options_ array is filled in
option(opt);
}
- Private::options_[opt] = val;
+ Fl_Private_options_[opt] = val;
}
@@ -2243,14 +2243,14 @@ Fl_Widget_Tracker::~Fl_Widget_Tracker()
Fl::release_widget_pointer(wp_); // remove pointer from watch list
}
-int Fl::Private::use_high_res_GL_ = 0;
+int Fl_Private_use_high_res_GL_ = 0;
/** sets whether GL windows should be drawn at high resolution on Apple
computers with retina displays
\version 1.3.4
*/
void Fl::use_high_res_GL(int val) {
- Private::use_high_res_GL_ = val;
+ Fl_Private_use_high_res_GL_ = val;
}
/** returns whether GL windows should be drawn at high resolution on Apple
@@ -2259,10 +2259,10 @@ void Fl::use_high_res_GL(int val) {
\version 1.3.4
*/
int Fl::use_high_res_GL() {
- return Private::use_high_res_GL_;
+ return Fl_Private_use_high_res_GL_;
}
-int Fl::Private::draw_GL_text_with_textures_ = 1;
+int Fl_Private_draw_GL_text_with_textures_ = 1;
/** sets whether OpenGL uses textures to draw all text.
By default, FLTK draws OpenGL text using textures, if the necessary
@@ -2276,7 +2276,7 @@ int Fl::Private::draw_GL_text_with_textures_ = 1;
\version 1.4.0
*/
void Fl::draw_GL_text_with_textures(int val) {
- Private::draw_GL_text_with_textures_ = val;
+ Fl_Private_draw_GL_text_with_textures_ = val;
}
/** returns whether whether OpenGL uses textures to draw all text.
@@ -2285,7 +2285,7 @@ void Fl::draw_GL_text_with_textures(int val) {
\version 1.4.0
*/
int Fl::draw_GL_text_with_textures() {
- return Private::draw_GL_text_with_textures_;
+ return Fl_Private_draw_GL_text_with_textures_;
}
int Fl::dnd()
diff --git a/src/Fl_Cairo.cxx b/src/Fl_Cairo.cxx
index 2387fa19a..be19dede7 100644
--- a/src/Fl_Cairo.cxx
+++ b/src/Fl_Cairo.cxx
@@ -33,7 +33,7 @@
// static initialization
-Fl_Cairo_State Fl::Private::cairo_state_; ///< current Cairo context information
+Fl_Cairo_State Fl_Private_cairo_state_; ///< current Cairo context information
/** When FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true,
any current window dc is linked to a current Cairo context.
@@ -51,7 +51,7 @@ Fl_Cairo_State Fl::Private::cairo_state_; ///< current Cairo context information
\note Only available if built with CMake option FLTK_OPTION_CAIRO_WINDOW=ON.
*/
void Fl::cairo_autolink_context(bool alink) {
- Private::cairo_state_.autolink(alink);
+ Fl_Private_cairo_state_.autolink(alink);
}
/**
@@ -63,12 +63,12 @@ void Fl::cairo_autolink_context(bool alink) {
\note Only available if built with CMake option FLTK_OPTION_CAIRO_EXT=ON.
*/
bool Fl::cairo_autolink_context() {
- return Private::cairo_state_.autolink();
+ return Fl_Private_cairo_state_.autolink();
}
/** Gets the current Cairo context linked with a fltk window. */
cairo_t *Fl::cairo_cc() {
- return Private::cairo_state_.cc();
+ return Fl_Private_cairo_state_.cc();
}
/** Sets the current Cairo context to \p c.
@@ -77,7 +77,7 @@ cairo_t *Fl::cairo_cc() {
\note Only available if built with CMake option FLTK_OPTION_CAIRO_WINDOW=ON.
*/
void Fl::cairo_cc(cairo_t *c, bool own /* = false */) {
- Private::cairo_state_.cc(c, own);
+ Fl_Private_cairo_state_.cc(c, own);
}
@@ -121,18 +121,18 @@ cairo_t *Fl::cairo_make_current(Fl_Window *wi) {
if (fl_gc == 0) { // means remove current cc
Fl::cairo_cc(0); // destroy any previous cc
- Fl::Private::cairo_state_.window(0);
+ Fl_Private_cairo_state_.window(0);
return 0;
}
// don't re-create a context if it's the same gc/window combination
- if (fl_gc == Fl::Private::cairo_state_.gc() && fl_xid(wi) == (Window)Fl::Private::cairo_state_.window())
+ if (fl_gc == Fl_Private_cairo_state_.gc() && fl_xid(wi) == (Window)Fl_Private_cairo_state_.window())
return Fl::cairo_cc();
// Scale the Cairo context appropriately
float scale = Fl::screen_scale(wi->screen_num());
- cairo_ctxt = Fl::Private::cairo_make_current(0, wi->w() * scale, wi->h() * scale);
- Fl::Private::cairo_state_.window((void *)fl_xid(wi));
+ cairo_ctxt = Fl_Private_cairo_make_current(0, wi->w() * scale, wi->h() * scale);
+ Fl_Private_cairo_state_.window((void *)fl_xid(wi));
cairo_scale(cairo_ctxt, scale, scale);
return cairo_ctxt;
}
@@ -151,17 +151,17 @@ static cairo_surface_t *cairo_create_surface(void *gc, int W, int H) {
\note Only available if CMake FLTK_OPTION_CAIRO_WINDOW is enabled.
*/
-cairo_t *Fl::Private::cairo_make_current(void *gc, int W, int H) {
- if (gc == Fl::Private::cairo_state_.gc() &&
- fl_window == (Window)Fl::Private::cairo_state_.window() &&
- cairo_state_.cc() != 0) // no need to create a cc, just return that one
- return cairo_state_.cc();
+cairo_t *Fl_Private_cairo_make_current(void *gc, int W, int H) {
+ if (gc == Fl_Private_cairo_state_.gc() &&
+ fl_window == (Window)Fl_Private_cairo_state_.window() &&
+ Fl_Private_cairo_state_.cc() != 0) // no need to create a cc, just return that one
+ return Fl_Private_cairo_state_.cc();
// we need to (re-)create a fresh cc ...
- cairo_state_.gc(gc); // keep track for next time
+ Fl_Private_cairo_state_.gc(gc); // keep track for next time
cairo_surface_t *s = cairo_create_surface(gc, W, H);
cairo_t *c = cairo_create(s);
- cairo_state_.cc(c); // and purge any previously owned context
+ Fl_Private_cairo_state_.cc(c); // and purge any previously owned context
cairo_surface_destroy(s);
return c;
}
diff --git a/src/Fl_Private.H b/src/Fl_Private.H
index 11c4b5dd9..c86ac930f 100644
--- a/src/Fl_Private.H
+++ b/src/Fl_Private.H
@@ -15,7 +15,7 @@
//
/** \file src/Fl_Private.H
- \brief Fl::Private namespace.
+ \brief FLTK private global variables and functions.
*/
#ifndef Fl_Private_H
@@ -24,21 +24,20 @@
#include <FL/fl_config.h> // build configuration
#include <FL/Fl.H>
-/**
+/*
FLTK private global variables and functions.
+ All prefixed with Fl_Private_ instead of using namespace.
*/
-namespace Fl {
-namespace Private {
-FL_EXPORT extern int use_high_res_GL_;
-FL_EXPORT extern int draw_GL_text_with_textures_;
-FL_EXPORT extern int box_shadow_width_;
-FL_EXPORT extern int box_border_radius_max_;
-FL_EXPORT extern int selection_to_clipboard_;
+FL_EXPORT extern int Fl_Private_use_high_res_GL_;
+FL_EXPORT extern int Fl_Private_draw_GL_text_with_textures_;
+FL_EXPORT extern int Fl_Private_box_shadow_width_;
+FL_EXPORT extern int Fl_Private_box_border_radius_max_;
+FL_EXPORT extern int Fl_Private_selection_to_clipboard_;
-FL_EXPORT extern unsigned char options_[OPTION_LAST];
-FL_EXPORT extern unsigned char options_read_;
-FL_EXPORT extern int program_should_quit_; // non-zero means the program was asked to cleanly terminate
+FL_EXPORT extern unsigned char Fl_Private_options_[Fl::OPTION_LAST];
+FL_EXPORT extern unsigned char Fl_Private_options_read_;
+FL_EXPORT extern int Fl_Private_program_should_quit_; // non-zero means the program was asked to cleanly terminate
/**
The currently executing idle callback function: DO NOT USE THIS DIRECTLY!
@@ -47,10 +46,10 @@ FL_EXPORT extern int program_should_quit_; // non-zero means the program was ask
idle callback functions to be called.
\see add_idle(), remove_idle()
*/
-FL_EXPORT extern void (*idle_)();
+FL_EXPORT extern void (*Fl_Private_idle_)();
-FL_EXPORT extern void run_idle();
-FL_EXPORT extern void run_checks();
+FL_EXPORT extern void Fl_Private_run_idle();
+FL_EXPORT extern void Fl_Private_run_checks();
/**
Sets an idle callback (internal use only).
@@ -61,19 +60,13 @@ FL_EXPORT extern void run_checks();
See documentation: use Fl::add_idle() instead.
*/
-FL_EXPORT inline void set_idle_(Fl_Old_Idle_Handler cb) { idle_ = cb; }
+FL_EXPORT inline void Fl_Private_set_idle_(Fl_Old_Idle_Handler cb) { Fl_Private_idle_ = cb; }
#ifdef FLTK_HAVE_CAIRO
-#if 0 // this non-public function appears not to be used anywhere in FLTK
- FL_EXPORT extern cairo_t *cairo_make_current(void *gc);
-#endif
-FL_EXPORT extern cairo_t *cairo_make_current(void *gc, int W, int H);
-FL_EXPORT extern Fl_Cairo_State cairo_state_;
+FL_EXPORT extern cairo_t *Fl_Private_cairo_make_current(void *gc, int W, int H);
+FL_EXPORT extern Fl_Cairo_State Fl_Private_cairo_state_;
#endif // FLTK_HAVE_CAIRO
-} // namespace Private
-} // namespace Fl
-
#endif // !Fl_Private_H
diff --git a/src/Fl_System_Driver.cxx b/src/Fl_System_Driver.cxx
index 2e98c29ec..c93794711 100644
--- a/src/Fl_System_Driver.cxx
+++ b/src/Fl_System_Driver.cxx
@@ -357,8 +357,8 @@ double Fl_System_Driver::wait(double time_to_wait) {
Fl::do_widget_deletion();
Fl_Timeout::do_timeouts();
- Fl::Private::run_checks();
- Fl::Private::run_idle();
+ Fl_Private_run_checks();
+ Fl_Private_run_idle();
// The idle function may turn off idle() if *all* idle callbacks
// are removed from the callback queue (ring), we can then wait.
diff --git a/src/Fl_add_idle.cxx b/src/Fl_add_idle.cxx
index 5c1f7be12..64b0b205b 100644
--- a/src/Fl_add_idle.cxx
+++ b/src/Fl_add_idle.cxx
@@ -83,7 +83,7 @@ void Fl::add_idle(Fl_Idle_Handler cb, void* data) {
} else {
first = last = p;
p->next = p;
- Private::set_idle_(call_idle);
+ Fl_Private_set_idle_(call_idle);
}
}
@@ -161,7 +161,7 @@ void Fl::remove_idle(Fl_Idle_Handler cb, void* data) {
}
if (l == p) { // only one
first = last = 0;
- Private::set_idle_(0);
+ Fl_Private_set_idle_(0);
} else {
last = l;
first = l->next = p->next;
diff --git a/src/drivers/X11/fl_X11_platform_init.cxx b/src/drivers/X11/fl_X11_platform_init.cxx
index 6a2851900..49947c1f3 100644
--- a/src/drivers/X11/fl_X11_platform_init.cxx
+++ b/src/drivers/X11/fl_X11_platform_init.cxx
@@ -76,10 +76,6 @@ Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, i
}
#if defined(FLTK_HAVE_PEN_SUPPORT)
-namespace Fl {
-namespace Pen {
-Driver default_driver;
-Driver& driver = default_driver;
-} // namespace Pen
-} // namespace Fl
+static Fl_Pen_Driver fl_pen_default_driver;
+Fl_Pen_Driver *fl_pen_driver = &fl_pen_default_driver;
#endif // FLTK_HAVE_PEN_SUPPORT
diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx
index a9c44be08..fe2dba385 100644
--- a/src/fl_boxtype.cxx
+++ b/src/fl_boxtype.cxx
@@ -46,13 +46,13 @@ static const uchar inactive_ramp[24] = {
51, 51, 52, 52};
static int draw_it_active = 1;
-int Fl::Private::box_border_radius_max_ = 15;
+int Fl_Private_box_border_radius_max_ = 15;
/** Get the maximum border radius of all "rounded" boxtypes in pixels.
\since 1.4.0
*/
int Fl::box_border_radius_max() {
- return Private::box_border_radius_max_;
+ return Fl_Private_box_border_radius_max_;
}
/** Set the maximum border radius of all "rounded" boxtypes in pixels.
@@ -68,16 +68,16 @@ int Fl::box_border_radius_max() {
\since 1.4.0
*/
void Fl::box_border_radius_max(int R) {
- Private::box_border_radius_max_ = R < 5 ? 5 : R;
+ Fl_Private_box_border_radius_max_ = R < 5 ? 5 : R;
}
-int Fl::Private::box_shadow_width_ = 3;
+int Fl_Private_box_shadow_width_ = 3;
/** Get the box shadow width of all "shadow" boxtypes in pixels.
\since 1.4.0
*/
int Fl::box_shadow_width() {
- return Private::box_shadow_width_;
+ return Fl_Private_box_shadow_width_;
}
/** Set the box shadow width of all "shadow" boxtypes in pixels.
@@ -85,7 +85,7 @@ int Fl::box_shadow_width() {
\since 1.4.0
*/
void Fl::box_shadow_width(int W) {
- Private::box_shadow_width_ = W < 1 ? 1 : W;
+ Fl_Private_box_shadow_width_ = W < 1 ? 1 : W;
}
/**
diff --git a/test/penpal.cxx b/test/penpal.cxx
index eec1307bb..1b0373abb 100644
--- a/test/penpal.cxx
+++ b/test/penpal.cxx
@@ -15,7 +15,7 @@
//
// The Penpal test app is here to test pen/stylus/tablet event distribution
-// in the Fl::Pen driver. Our main window has three canvases for drawing.
+// in the Fl_Pen driver. Our main window has three canvases for drawing.
// The first canvas is a child of the main window. The second canvas is
// inside a group. The third canvas is a subwindow inside the main window.
// A second application window is itself yet another canvas.
@@ -23,8 +23,8 @@
// We can test if the events are delivered to the right receiver, if the
// mouse and pen offsets are correct. The pen implementation also reacts
// to pen pressure and angles. If handle() returns 1 when receiving
-// Fl::Pen::ENTER, the event handler should not send any mouse events until
-// Fl::Pen::LEAVE.
+// FL_PEN_ENTER, the event handler should not send any mouse events until
+// FL_PEN_LEAVE.
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
@@ -34,6 +34,7 @@
#include <FL/fl_draw.H>
#include <FL/fl_message.H>
#include <FL/names.h>
+#include <FL/core/pen_events.H>
extern Fl_Menu_Item app_menu[];
extern int popup_app_menu();
@@ -79,24 +80,24 @@ int CanvasInterface::cv_handle(int event)
switch (event)
{
// Event handling for pen events:
- case Fl::Pen::ENTER: // Return 1 to receive all pen events and suppress mouse events
+ case FL_PEN_ENTER: // Return 1 to receive all pen events and suppress mouse events
// Pen entered the widget area.
color_++;
if (color_ > 6) color_ = 1;
/* fall through */
- case Fl::Pen::HOVER:
+ case FL_PEN_HOVER:
// Pen move over the surface without touching it.
overlay_ = PEN_HOVER;
ov_x_ = Fl::event_x();
ov_y_ = Fl::event_y();
widget_->redraw();
return 1;
- case Fl::Pen::TOUCH:
+ case FL_PEN_TOUCH:
// Pen tip or eraser just touched the surface.
- if (Fl::event_state(FL_CTRL) || Fl::Pen::event_state(Fl::Pen::State::BUTTON0))
+ if (Fl::event_state(FL_CTRL) || Fl_Pen_event_state_check(FL_PEN_STATE_BUTTON0))
return popup_app_menu();
/* fall through */
- case Fl::Pen::DRAW:
+ case FL_PEN_DRAW:
// Pen is dragged over the surface, or hovers with a button pressed.
overlay_ = PEN_DRAW;
ov_x_ = Fl::event_x();
@@ -104,10 +105,10 @@ int CanvasInterface::cv_handle(int event)
cv_pen_paint();
widget_->redraw();
return 1;
- case Fl::Pen::LIFT:
+ case FL_PEN_LIFT:
// Pen was just lifted from the surface and is now hovering
return 1;
- case Fl::Pen::LEAVE:
+ case FL_PEN_LEAVE:
// The pen left the drawing area.
overlay_ = NONE;
widget_->redraw();
@@ -164,7 +165,7 @@ void CanvasInterface::cv_draw()
// Preset values for overlay
int r = 10;
if (overlay_ == PEN_DRAW)
- r = static_cast<int>(32.0 * Fl::Pen::event_pressure());
+ r = (int)(32.0 * Fl_Pen_event_pressure());
fl_color(FL_BLACK);
switch (overlay_) {
case NONE: break;
@@ -180,8 +181,8 @@ void CanvasInterface::cv_draw()
/* fall through */
case DRAW:
fl_arc(ov_x_-r, ov_y_-r, 2*r, 2*r, 0, 360);
- fl_arc(ov_x_-r/2-40*Fl::Pen::event_tilt_x(),
- ov_y_-r/2-40*Fl::Pen::event_tilt_y(), r, r, 0, 360);
+ fl_arc(ov_x_-r/2-(int)(40*Fl_Pen_event_tilt_x()),
+ ov_y_-r/2-(int)(40*Fl_Pen_event_tilt_y()), r, r, 0, 360);
break;
}
}
@@ -205,9 +206,10 @@ void CanvasInterface::cv_paint() {
void CanvasInterface::cv_pen_paint() {
if (!offscreen_)
return;
- int r = static_cast<int>(32.0 * (Fl::Pen::event_pressure()*Fl::Pen::event_pressure()));
+ double p = Fl_Pen_event_pressure();
+ int r = (int)(32.0 * (p * p));
int dx = in_window_ ? 0 : widget_->x(), dy = in_window_ ? 0 : widget_->y();
- Fl_Color cc = Fl::Pen::event_state(Fl::Pen::State::ERASER_DOWN) ? FL_WHITE : color_;
+ Fl_Color cc = Fl_Pen_event_state_check(FL_PEN_STATE_ERASER_DOWN) ? FL_WHITE : color_;
fl_begin_offscreen(offscreen_);
fl_draw_circle(Fl::event_x()-dx-r, Fl::event_y()-dy-r, 2*r, cc);
fl_end_offscreen();
@@ -246,26 +248,37 @@ public:
void draw() { return cv_draw(); }
};
+// Menu callbacks (replacing lambdas)
+static void menu_modal_cb(Fl_Widget*, void*) {
+ fl_message("None of the canvas areas should receive\n"
+ "pen events while this window is open.");
+}
+
+static void menu_nonmodal_cb(Fl_Widget*, void*) {
+ Fl_Window *w = new Fl_Window(400, 32, "Toolbox");
+ w->set_non_modal();
+ w->show();
+}
+
+static void menu_unsubscribe_cb(Fl_Widget*, void*) {
+ if (cv1) Fl_Pen_unsubscribe(cv1);
+}
+
+static void menu_resubscribe_cb(Fl_Widget*, void*) {
+ if (cv1) Fl_Pen_subscribe(cv1);
+}
+
+static void menu_delete_cb(Fl_Widget*, void*) {
+ if (cv1) { cv1->top_window()->redraw(); delete cv1; cv1 = 0; }
+}
+
// A popup menu with a few test tasks.
Fl_Menu_Item app_menu[] = {
- { "with modal window", 0, [](Fl_Widget*, void*) {
- fl_message("None of the canvas areas should receive\n"
- "pen events while this window is open.");
- } },
- { "with non-modal window", 0, [](Fl_Widget*, void*) {
- Fl_Window *w = new Fl_Window(400, 32, "Toolbox");
- w->set_non_modal();
- w->show();
- } },
- { "unsubscribe middle canvas", 0, [](Fl_Widget*, void*) {
- if (cv1) Fl::Pen::unsubscribe(cv1);
- } },
- { "resubscribe middle canvas", 0, [](Fl_Widget*, void*) {
- if (cv1) Fl::Pen::subscribe(cv1);
- } },
- { "delete middle canvas", 0, [](Fl_Widget*, void*) {
- if (cv1) { cv1->top_window()->redraw(); delete cv1; cv1 = 0; }
- } },
+ { "with modal window", 0, menu_modal_cb },
+ { "with non-modal window", 0, menu_nonmodal_cb },
+ { "unsubscribe middle canvas", 0, menu_unsubscribe_cb },
+ { "resubscribe middle canvas", 0, menu_resubscribe_cb },
+ { "delete middle canvas", 0, menu_delete_cb },
{ 0 }
};
@@ -292,7 +305,8 @@ int main(int argc, char **argv)
// The second canvas is inside a group
Fl_Group *cv1_group = new Fl_Group(215, 5, 210, 210);
cv1_group->box(FL_FRAME_BOX);
- CanvasWidget *canvas_widget_1 = cv1 = new CanvasWidget(220, 10, 200, 200, "CV1");
+ CanvasWidget *canvas_widget_1 = new CanvasWidget(220, 10, 200, 200, "CV1");
+ cv1 = canvas_widget_1;
cv1_group->end();
// The third canvas is a window inside a window, so we can verify
@@ -303,13 +317,14 @@ int main(int argc, char **argv)
window->end();
// A fourth canvas is a top level window by itself.
- CanvasWindow *cv_window = cvwin = new CanvasWindow(100, 380, 200, 200, "Canvas Window");
+ CanvasWindow *cv_window = new CanvasWindow(100, 380, 200, 200, "Canvas Window");
+ cvwin = cv_window;
// All canvases subscribe to pen events.
- Fl::Pen::subscribe(canvas_widget_0);
- Fl::Pen::subscribe(canvas_widget_1);
- Fl::Pen::subscribe(canvas_widget_2);
- Fl::Pen::subscribe(cv_window);
+ Fl_Pen_subscribe(canvas_widget_0);
+ Fl_Pen_subscribe(canvas_widget_1);
+ Fl_Pen_subscribe(canvas_widget_2);
+ Fl_Pen_subscribe(cv_window);
window->show(argc, argv);
canvas_widget_2->show();