~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/glut/directfb/internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
3
 
 *
4
 
 * This library is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU Lesser General Public
6
 
 * License as published by the Free Software Foundation; either
7
 
 * version 2 of the License, or (at your option) any later version.
8
 
 * 
9
 
 * This library is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
 * Lesser General Public License for more details.
13
 
 * 
14
 
 * You should have received a copy of the GNU Lesser General Public
15
 
 * License along with this library; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
 
 *
18
 
 */
19
 
 
20
 
#ifndef __GLUT_INTERNAL_H__
21
 
#define __GLUT_INTERNAL_H__
22
 
 
23
 
#include <stdio.h>
24
 
#include <stdlib.h>
25
 
 
26
 
#include <directfb.h>
27
 
#include <directfb_version.h>
28
 
 
29
 
#include "GL/glut.h"
30
 
#include "GL/directfbgl.h"
31
 
 
32
 
 
33
 
#define VERSION_CODE( M, m, r )  (((M) << 16) | ((m) << 8) | ((r)))
34
 
 
35
 
#define DIRECTFB_VERSION_CODE    VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
36
 
                                               DIRECTFB_MINOR_VERSION, \
37
 
                                               DIRECTFB_MICRO_VERSION )
38
 
 
39
 
 
40
 
#define DEFAULT_WIDTH  640
41
 
#define DEFAULT_HEIGHT 480
42
 
 
43
 
/*
44
 
 * Window request flags
45
 
 */
46
 
#define WINDOW_REQUEST_POSITION   0x00000001
47
 
#define WINDOW_REQUEST_RESIZE     0x00000002
48
 
#define WINDOW_REQUEST_RESTACK    0x00000004
49
 
#define WINDOW_REQUEST_SHOW       0x00000008
50
 
#define WINDOW_REQUEST_HIDE       0x00000010
51
 
#define WINDOW_REQUEST_DESTROY    0x00000020
52
 
 
53
 
/*
54
 
 * GLUT Window implementation
55
 
 */
56
 
typedef struct __GlutWindow_s {
57
 
     int                    id;
58
 
     DFBWindowID            wid;
59
 
 
60
 
     IDirectFBWindow       *window; /* NULL = fullscreen (game mode) */
61
 
     IDirectFBSurface      *surface;
62
 
     IDirectFBGL           *gl;
63
 
 
64
 
     /* cursor position in fullscreen mode */
65
 
     int                    cx;
66
 
     int                    cy;
67
 
     /* joystick position */
68
 
     int                    jx;
69
 
     int                    jy;
70
 
     int                    jz;
71
 
     /* pressed modifiers */
72
 
     int                    modifiers;
73
 
     /* pressed buttons */
74
 
     int                    buttons;
75
 
     /* current cursor shape */
76
 
     int                    cursor;
77
 
     
78
 
     struct {
79
 
          int               flags;
80
 
          int               x;
81
 
          int               y;
82
 
          int               w;
83
 
          int               h;
84
 
          int               z;
85
 
     } req;
86
 
 
87
 
     GLboolean              visible;    
88
 
     GLboolean              redisplay;
89
 
     GLboolean              reshape;
90
 
     GLboolean              visibility;
91
 
 
92
 
     struct __GlutWindow_s *next;
93
 
     struct __GlutWindow_s *prev;
94
 
} __GlutWindow;
95
 
 
96
 
 
97
 
/* Global Vars */
98
 
extern IDirectFB             *dfb;
99
 
extern IDirectFBDisplayLayer *primary;
100
 
extern IDirectFBEventBuffer  *events;
101
 
extern IDirectFBInputDevice  *keyboard;
102
 
extern IDirectFBInputDevice  *mouse;
103
 
extern IDirectFBInputDevice  *joystick;
104
 
 
105
 
extern GLenum                 g_display_mode;
106
 
extern GLuint                 g_width;
107
 
extern GLuint                 g_height;
108
 
extern GLint                  g_xpos;
109
 
extern GLint                  g_ypos;
110
 
extern GLint                  g_bpp;
111
 
extern GLboolean              g_idle;
112
 
extern __GlutWindow          *g_current;
113
 
extern __GlutWindow          *g_game;
114
 
 
115
 
 
116
 
/* Global Funcs */
117
 
/* window.c */
118
 
extern __GlutWindow* __glutCreateWindow( GLboolean fullscreen );
119
 
extern __GlutWindow* __glutFindWindow( DFBWindowID id );
120
 
extern void          __glutSetWindow( __GlutWindow *window );
121
 
extern void          __glutHandleWindows( void );
122
 
extern void          __glutDestroyWindow( __GlutWindow *window );
123
 
extern void          __glutDestroyWindows( void );
124
 
/* callback.c */
125
 
extern void          __glutHandleTimers( void );
126
 
extern void          __glutFreeTimers( void );
127
 
 
128
 
 
129
 
/* Global Callbacks */
130
 
extern void (GLUTCALLBACK *display_func) (void);
131
 
extern void (GLUTCALLBACK *reshape_func) (int width, int height);
132
 
extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y);
133
 
extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y);
134
 
extern void (GLUTCALLBACK *motion_func) (int x, int y);
135
 
extern void (GLUTCALLBACK *passive_motion_func) (int x, int y);
136
 
extern void (GLUTCALLBACK *entry_func) (int state);
137
 
extern void (GLUTCALLBACK *visibility_func) (int state);
138
 
extern void (GLUTCALLBACK *idle_func) (void);
139
 
extern void (GLUTCALLBACK *menu_state_func) (int state);
140
 
extern void (GLUTCALLBACK *special_func) (int key, int x, int y);
141
 
extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z);
142
 
extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z);
143
 
extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state);
144
 
extern void (GLUTCALLBACK *button_box_func) (int button, int state);
145
 
extern void (GLUTCALLBACK *dials_func) (int dial, int value);
146
 
extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y);
147
 
extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y);
148
 
extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y);
149
 
extern void (GLUTCALLBACK *overlay_display_func) (void);
150
 
extern void (GLUTCALLBACK *window_status_func) (int state);
151
 
extern void (GLUTCALLBACK *keyboard_up_func) (unsigned char key, int x, int y);
152
 
extern void (GLUTCALLBACK *special_up_func) (int key, int x, int y);
153
 
extern void (GLUTCALLBACK *joystick_func) (unsigned int buttons, int x, int y, int z);
154
 
 
155
 
 
156
 
#ifdef DEBUG
157
 
# define __glutAssert( exp ) {\
158
 
     if (!(exp)) {\
159
 
          fprintf( stderr, "(!!) *** Assertion [%s] failed in %s() ***\n",\
160
 
                           #exp, __FUNCTION__ );
161
 
          fflush( stderr );\
162
 
          exit( -1 );\
163
 
     }\
164
 
 }
165
 
#else
166
 
# define __glutAssert( exp )
167
 
#endif
168
 
 
169
 
#define __glutWarning( format, ... ) {\
170
 
     fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\
171
 
     fflush( stderr );\
172
 
}
173
 
 
174
 
#define __glutFatalError( format, ... ) {\
175
 
     fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\
176
 
     fprintf( stderr, "\t-> from %s() at line %d\n", __FUNCTION__, __LINE__ );\
177
 
     fflush( stderr );\
178
 
     exit( -1 );\
179
 
}
180
 
 
181
 
 
182
 
#endif /* __GLUT_INTERNAL_H__ */
183