FLTK 1.4.0
platform_types.h
Go to the documentation of this file.
1/*
2 * Copyright 2016-2023 by Bill Spitzak and others.
3 *
4 * This library is free software. Distribution and use rights are outlined in
5 * the file "COPYING" which should have been included with this file. If this
6 * file is missing or damaged, see the license at:
7 *
8 * https://www.fltk.org/COPYING.php
9 *
10 * Please see the following page on how to report bugs and issues:
11 *
12 * https://www.fltk.org/bugs.php
13 */
14
15#ifndef Fl_Platform_Types_H
16#define Fl_Platform_Types_H
17
25#ifdef FL_DOXYGEN
26
31typedef opaque fl_intptr_t;
36typedef opaque fl_uintptr_t;
37
46typedef opaque Fl_Offscreen;
47
56typedef struct opaque *Fl_Region;
57typedef opaque FL_SOCKET;
66typedef struct opaque *GLContext;
67
73typedef opaque Fl_Timestamp;
74
75# define FL_COMMAND opaque
76# define FL_CONTROL opaque
78#else /* FL_DOXYGEN */
79
80#ifndef FL_PLATFORM_TYPES_H
81#define FL_PLATFORM_TYPES_H
82
83#include <FL/fl_config.h>
84#include <time.h> // for time_t
85
86/* Platform-dependent types are defined here.
87 These types must be defined by any platform:
88 FL_SOCKET, struct dirent, fl_intptr_t, fl_uintptr_t
89
90 NOTE: *FIXME* AlbrechtS 13 Apr 2016 (concerning FL_SOCKET)
91 ----------------------------------------------------------
92 The Fl::add_fd() API is partially inconsistent because some of the methods
93 explicitly use 'int', but the callback typedefs use FL_SOCKET. With the
94 definition of FL_SOCKET below we can have different data sizes and
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
106typedef intptr_t fl_intptr_t;
107typedef uintptr_t fl_uintptr_t;
108
109#else /* ! _WIN64 */
110
111typedef long fl_intptr_t;
112typedef unsigned long fl_uintptr_t;
113
114#endif /* _WIN64 */
115
116typedef void *GLContext;
117typedef void *Fl_Region;
119
120/* Allows all hybrid combinations except WIN32 + X11 with MSVC */
121#if defined(_WIN32) && !defined(__MINGW32__)
122 struct dirent {char d_name[1];};
123#else
124# include <dirent.h>
125#endif
126
127# if defined(_WIN64) && defined(_MSC_VER)
128typedef unsigned __int64 FL_SOCKET; /* *FIXME* - FL_SOCKET (see above) */
129# else
130typedef int FL_SOCKET;
131# endif
132
133#include <FL/Fl_Export.H>
134extern FL_EXPORT int fl_command_modifier();
135extern FL_EXPORT int fl_control_modifier();
136# define FL_COMMAND fl_command_modifier()
137# define FL_CONTROL fl_control_modifier()
138
139#endif /* FL_PLATFORM_TYPES_H */
140
141/* This is currently the same for all platforms but may change in the future */
142struct Fl_Timestamp_t {
143 time_t sec;
144 int usec;
145};
146
147typedef struct Fl_Timestamp_t Fl_Timestamp;
148
149#endif /* FL_DOXYGEN */
150
151#endif /* Fl_Platform_Types_H */
152
opaque Fl_Offscreen
Platform-specific value representing an offscreen drawing buffer.
Definition: platform_types.h:46
struct opaque * GLContext
Pointer to a platform-specific structure representing the window's OpenGL rendering context.
Definition: platform_types.h:66
opaque Fl_Timestamp
Platform-specific point in time, used for delta time calculation.
Definition: platform_types.h:73
opaque fl_uintptr_t
An unsigned integral type large enough to store a pointer or an unsigned long value.
Definition: platform_types.h:36
struct opaque * Fl_Region
Pointer to a platform-specific structure representing a collection of rectangles.
Definition: platform_types.h:56
opaque FL_SOCKET
socket or file descriptor
Definition: platform_types.h:57
opaque fl_intptr_t
An integral type large enough to store a pointer or a long value.
Definition: platform_types.h:31