summaryrefslogtreecommitdiff
path: root/FL/platform_types.h
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-03-15 06:42:06 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-29 12:15:32 +0200
commitc720aae51515907ae82ee02df80bd084f291d4b1 (patch)
tree7fbf3569f35966891df68490b047b30c9ec20bcd /FL/platform_types.h
parent28981f6fd3971aaf7ff6527ee1cdeb9d886c4a4a (diff)
Make hybrid Wayland/X11 platform.
Diffstat (limited to 'FL/platform_types.h')
-rw-r--r--FL/platform_types.h104
1 files changed, 46 insertions, 58 deletions
diff --git a/FL/platform_types.h b/FL/platform_types.h
index f831b8b22..b55544d4c 100644
--- a/FL/platform_types.h
+++ b/FL/platform_types.h
@@ -32,15 +32,40 @@ typedef opaque fl_intptr_t;
A variable of type fl_uintptr_t can also store an unsigned long int value. */
typedef opaque fl_uintptr_t;
-typedef opaque Fl_Offscreen; /**< an offscreen drawing buffer */
-typedef opaque Fl_Region; /**< a region made of several rectangles */
+/**
+ Platform-specific value representing an offscreen drawing buffer.
+ \note This value can be safely cast to these types on each platform:
+ \li X11: Pixmap
+ \li Wayland: struct fl_wld_buffer *
+ \li Windows: HBITMAP
+ \li macOS: CGContextRef
+ */
+typedef opaque Fl_Offscreen;
+
+/**
+ Pointer to a platform-specific structure representing a collection of rectangles.
+ \note This pointer can be safely cast to these types on each platform:
+ \li X11: Region as defined by X11
+ \li Wayland: struct flCairoRegion *
+ \li Windows: HRGN
+ \li macOS: struct flCocoaRegion *
+ */
+typedef struct opaque *Fl_Region;
typedef opaque FL_SOCKET; /**< socket or file descriptor */
-typedef opaque GLContext; /**< an OpenGL graphics context, into which all OpenGL calls are rendered */
+/**
+ Pointer to a platform-specific structure representing the window's OpenGL rendering context.
+ \note This pointer can be safely cast to these types on each platform:
+ \li X11: GLXContext
+ \li Wayland: EGLContext
+ \li Windows: HGLRC
+ \li macOS: NSOpenGLContext *
+ */
+typedef struct opaque *GLContext;
# define FL_COMMAND opaque /**< An alias for FL_CTRL on Windows and X11, or FL_META on MacOS X */
# define FL_CONTROL opaque /**< An alias for FL_META on Windows and X11, or FL_CTRL on MacOS X */
-#else
+#else /* FL_DOXYGEN */
#ifndef FL_PLATFORM_TYPES_H
#define FL_PLATFORM_TYPES_H
@@ -49,8 +74,7 @@ typedef opaque GLContext; /**< an OpenGL graphics context, into which all OpenGL
/* Platform-dependent types are defined here.
These types must be defined by any platform:
- Fl_Offscreen, Fl_Region, FL_SOCKET, GLContext, struct dirent, struct stat,
- fl_intptr_t, fl_uintptr_t
+ FL_SOCKET, struct dirent, fl_intptr_t, fl_uintptr_t
NOTE: *FIXME* AlbrechtS 13 Apr 2016 (concerning FL_SOCKET)
----------------------------------------------------------
@@ -78,65 +102,29 @@ typedef unsigned long fl_uintptr_t;
#endif /* _WIN64 */
+typedef void *GLContext;
+typedef void *Fl_Region;
+typedef fl_uintptr_t Fl_Offscreen;
+
+/* Allows all hybrid combinations except WIN32 + X11 with MSVC */
+#if defined(_WIN32) && !defined(__MINGW32__)
+ struct dirent {char d_name[1];};
+#else
+# include <dirent.h>
+#endif
-#ifdef __APPLE__
-typedef struct CGContext* Fl_Offscreen;
-typedef struct flCocoaRegion* Fl_Region;
-typedef int FL_SOCKET;
-#ifdef __OBJC__
- @class NSOpenGLContext;
- typedef NSOpenGLContext* GLContext;
-#elif defined(__cplusplus)
- typedef class NSOpenGLContext* GLContext;
-#endif /* __OBJC__ */
-
-#include <sys/types.h>
-#include <dirent.h>
-# define FL_COMMAND FL_META
-# define FL_CONTROL FL_CTRL
-
-#elif defined(_WIN32)
-typedef struct HBITMAP__ *HBITMAP;
-typedef HBITMAP Fl_Offscreen;
-typedef struct HRGN__ *Fl_Region;
# if defined(_WIN64) && defined(_MSC_VER)
typedef unsigned __int64 FL_SOCKET; /* *FIXME* - FL_SOCKET (see above) */
# else
typedef int FL_SOCKET;
# endif
-typedef struct HGLRC__ *GLContext;
-#ifdef __MINGW32__
-# include <dirent.h>
-#else
- struct dirent {char d_name[1];};
-#endif
-
-#elif defined(FLTK_USE_WAYLAND)
-typedef struct fl_wld_buffer *Fl_Offscreen; /**< an offscreen drawing buffer */
-typedef struct flCairoRegion* Fl_Region;
-typedef int FL_SOCKET; /**< socket or file descriptor */
-typedef void *EGLContext;
-typedef EGLContext GLContext;
-#include <sys/types.h>
-#include <dirent.h>
-
-#elif defined(FLTK_USE_X11)
-typedef unsigned long Fl_Offscreen;
-typedef struct _XRegion *Fl_Region;
-typedef int FL_SOCKET;
-typedef struct __GLXcontextRec *GLContext;
-#include <sys/types.h>
-#include <dirent.h>
-
-#endif /* __APPLE__ */
-
-
-#ifndef __APPLE__
-# define FL_COMMAND FL_CTRL /**< An alias for FL_CTRL on Windows and X11, or FL_META on MacOS X */
-# define FL_CONTROL FL_META /**< An alias for FL_META on Windows and X11, or FL_CTRL on MacOS X */
-#endif
+#include <FL/Fl_Export.H>
+extern FL_EXPORT int fl_command_modifier();
+extern FL_EXPORT int fl_control_modifier();
+# define FL_COMMAND fl_command_modifier()
+# define FL_CONTROL fl_control_modifier()
#endif /* FL_PLATFORM_TYPES_H */
-#endif // FL_DOXYGEN
+#endif /* FL_DOXYGEN */