1/*
2 * Copyright (C) 2010 LunarG Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 * Authors:
23 *    Chia-I Wu <olv@lunarg.com>
24 */
25
26#ifndef _EGLUTINT_H_
27#define _EGLUTINT_H_
28
29#include "EGL/egl.h"
30#include "eglut.h"
31
32struct eglut_window {
33   EGLConfig config;
34   EGLContext context;
35
36   /* initialized by native display */
37   struct {
38      union {
39         EGLNativeWindowType window;
40         EGLNativePixmapType pixmap;
41         EGLSurface surface; /* pbuffer or screen surface */
42      } u;
43      int width, height;
44   } native;
45
46   EGLSurface surface;
47
48   int index;
49
50   EGLUTreshapeCB reshape_cb;
51   EGLUTdisplayCB display_cb;
52   EGLUTkeyboardCB keyboard_cb;
53   EGLUTspecialCB special_cb;
54};
55
56struct eglut_state {
57   int api_mask;
58   int window_width, window_height;
59   const char *display_name;
60   int verbose;
61   int init_time;
62
63   EGLUTidleCB idle_cb;
64
65   int num_windows;
66
67   /* initialized by native display */
68   EGLNativeDisplayType native_dpy;
69   EGLint surface_type;
70
71   EGLDisplay dpy;
72   EGLint major, minor;
73
74   struct eglut_window *current;
75
76   int redisplay;
77};
78
79extern struct eglut_state *_eglut;
80
81void
82_eglutFatal(char *format, ...);
83
84int
85_eglutNow(void);
86
87void
88_eglutNativeInitDisplay(void);
89
90void
91_eglutNativeFiniDisplay(void);
92
93void
94_eglutNativeInitWindow(struct eglut_window *win, const char *title,
95                       int x, int y, int w, int h);
96
97void
98_eglutNativeFiniWindow(struct eglut_window *win);
99
100void
101_eglutNativeEventLoop(void);
102
103#endif /* _EGLUTINT_H_ */
104