comparison mupdf-source/thirdparty/freeglut/src/x11/fg_internal_x11.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 /*
2 * fg_internal_x11.h
3 *
4 * The freeglut library private include file.
5 *
6 * Copyright (c) 2012 Stephen J. Baker. All Rights Reserved.
7 * Written by Diederick C. Niehorster, <dcnieho@gmail.com>
8 * Creation date: Fri Jan 20, 2012
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28 #ifndef FREEGLUT_INTERNAL_X11_H
29 #define FREEGLUT_INTERNAL_X11_H
30
31
32 /* -- PLATFORM-SPECIFIC INCLUDES ------------------------------------------- */
33 #ifdef EGL_VERSION_1_0
34 #include "egl/fg_internal_egl.h"
35 #else
36 #include <GL/glx.h>
37 #include "x11/fg_internal_x11_glx.h"
38 #endif
39 #include <X11/Xlib.h>
40 #include <X11/Xatom.h>
41 #include <X11/keysym.h>
42 #include <X11/extensions/XInput.h>
43 #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
44 # include <X11/extensions/xf86vmode.h>
45 #endif
46 #ifdef HAVE_X11_EXTENSIONS_XRANDR_H
47 # include <X11/extensions/Xrandr.h>
48 #endif
49
50
51 /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
52 /* The structure used by display initialization in fg_init.c */
53 typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay;
54 struct tagSFG_PlatformDisplay
55 {
56 Display* Display; /* The display we are being run in. */
57 int Screen; /* The screen we are about to use. */
58 Window RootWindow; /* The screen's root window. */
59 int Connection; /* The display's connection number */
60 Atom DeleteWindow; /* The window deletion atom */
61 Atom State; /* The state atom */
62 Atom StateFullScreen; /* The full screen atom */
63 int NetWMSupported; /* Flag for EWMH Window Managers */
64 Atom NetWMPid; /* The _NET_WM_PID atom */
65 Atom ClientMachine; /* The client machine name atom */
66 XIM IM; /* The input method */
67 XIMStyle InputStyle; /* The input method style */
68
69 #ifdef HAVE_X11_EXTENSIONS_XRANDR_H
70 int prev_xsz, prev_ysz;
71 int prev_refresh;
72 int prev_size_valid;
73 #endif /* HAVE_X11_EXTENSIONS_XRANDR_H */
74
75 #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
76 /*
77 * XF86VidMode may be compilable even if it fails at runtime. Therefore,
78 * the validity of the VidMode has to be tracked
79 */
80 int DisplayModeValid; /* Flag that indicates runtime status*/
81 XF86VidModeModeLine DisplayMode; /* Current screen's display settings */
82 int DisplayModeClock; /* The display mode's refresh rate */
83 int DisplayViewPortX; /* saved X location of the viewport */
84 int DisplayViewPortY; /* saved Y location of the viewport */
85 #endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */
86
87 #ifdef EGL_VERSION_1_0
88 struct tagSFG_PlatformDisplayEGL egl;
89 #endif
90
91 int DisplayPointerX; /* saved X location of the pointer */
92 int DisplayPointerY; /* saved Y location of the pointer */
93 };
94
95
96 /*
97 * Make "freeglut" window handle and context types so that we don't need so
98 * much conditionally-compiled code later in the library.
99 */
100 #ifndef EGL_VERSION_1_0
101 typedef Window SFG_WindowHandleType ;
102 typedef GLXContext SFG_WindowContextType ;
103 #endif
104 typedef struct tagSFG_PlatformContext SFG_PlatformContext;
105 struct tagSFG_PlatformContext
106 {
107 #ifdef EGL_VERSION_1_0
108 struct tagSFG_PlatformContextEGL egl;
109 #else
110 GLXFBConfig FBConfig; /* The window's FBConfig */
111 #endif
112 XIC IC; /* The window's input context */
113 };
114
115
116 /* Window's state description. This structure should be kept portable. */
117 typedef struct tagSFG_PlatformWindowState SFG_PlatformWindowState;
118 struct tagSFG_PlatformWindowState
119 {
120 int OldWidth; /* Window width from before a resize */
121 int OldHeight; /* " height " " " " */
122 GLboolean KeyRepeating; /* Currently in repeat mode? */
123 };
124
125
126 /* -- JOYSTICK-SPECIFIC STRUCTURES AND TYPES ------------------------------- */
127 /*
128 * Initial defines from "js.h" starting around line 33 with the existing "fg_joystick.c"
129 * interspersed
130 */
131 # ifdef HAVE_SYS_IOCTL_H
132 # include <sys/ioctl.h>
133 # endif
134 # ifdef HAVE_FCNTL_H
135 # include <fcntl.h>
136 # endif
137
138 #include <errno.h>
139 #include <string.h>
140
141 # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
142 /* XXX The below hack is done until freeglut's autoconf is updated. */
143 # define HAVE_USB_JS 1
144
145 # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
146 # include <sys/joystick.h>
147 # else
148 /*
149 * XXX NetBSD/amd64 systems may find that they have to steal the
150 * XXX /usr/include/machine/joystick.h from a NetBSD/i386 system.
151 * XXX I cannot comment whether that works for the interface, but
152 * XXX it lets you compile...(^& I do not think that we can do away
153 * XXX with this header.
154 */
155 # include <machine/joystick.h> /* For analog joysticks */
156 # endif
157 # define JS_DATA_TYPE joystick
158 # define JS_RETURN (sizeof(struct JS_DATA_TYPE))
159 # endif
160
161 # if defined(__linux__)
162 # include <linux/joystick.h>
163
164 /* check the joystick driver version */
165 # if defined(JS_VERSION) && JS_VERSION >= 0x010000
166 # define JS_NEW
167 # endif
168 # else /* Not BSD or Linux */
169 # ifndef JS_RETURN
170
171 /*
172 * We'll put these values in and that should
173 * allow the code to at least compile when there is
174 * no support. The JS open routine should error out
175 * and shut off all the code downstream anyway and if
176 * the application doesn't use a joystick we'll be fine.
177 */
178
179 struct JS_DATA_TYPE
180 {
181 int buttons;
182 int x;
183 int y;
184 };
185
186 # define JS_RETURN (sizeof(struct JS_DATA_TYPE))
187 # endif
188 # endif
189
190 /* XXX It might be better to poll the operating system for the numbers of buttons and
191 * XXX axes and then dynamically allocate the arrays.
192 */
193 # define _JS_MAX_AXES 16
194 typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;
195 struct tagSFG_PlatformJoystick
196 {
197 # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
198 struct os_specific_s *os;
199 # endif
200
201 # ifdef JS_NEW
202 struct js_event js;
203 int tmp_buttons;
204 float tmp_axes [ _JS_MAX_AXES ];
205 # else
206 struct JS_DATA_TYPE js;
207 # endif
208
209 char fname [ 128 ];
210 int fd;
211 };
212
213
214 /* Menu font and color definitions */
215 #define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18
216
217 #define FREEGLUT_MENU_PEN_FORE_COLORS {0.0f, 0.0f, 0.0f, 1.0f}
218 #define FREEGLUT_MENU_PEN_BACK_COLORS {0.70f, 0.70f, 0.70f, 1.0f}
219 #define FREEGLUT_MENU_PEN_HFORE_COLORS {0.0f, 0.0f, 0.0f, 1.0f}
220 #define FREEGLUT_MENU_PEN_HBACK_COLORS {1.0f, 1.0f, 1.0f, 1.0f}
221
222
223
224
225 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
226 /* spaceball device functions, defined in fg_spaceball.c */
227 int fgIsSpaceballXEvent( const XEvent *ev );
228 void fgSpaceballHandleXEvent( const XEvent *ev );
229
230 /*
231 * Check if "hint" is present in "property" for "window". See fg_init.c
232 */
233 int fgHintPresent(Window window, Atom property, Atom hint);
234
235 /* Handler for X extension Events */
236 #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
237 void fgHandleExtensionEvents( XEvent * ev );
238 void fgRegisterDevices( Display* dpy, Window* win );
239 #endif
240
241
242 #endif /* FREEGLUT_INTERNAL_X11_H */