The colormap code is now simpler, 15bpp works where it did not before.
[mesa.git] / src / glut / fbdev / callback.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 * Copyright (C) 1995-2006 Brian Paul
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 /*
22 * Library for glut using mesa fbdev driver
23 *
24 * Written by Sean D'Epagnier (c) 2006
25 */
26
27 #include <GL/glut.h>
28
29 #include "internal.h"
30
31 void (*DisplayFunc)(void) = NULL;
32 void (*ReshapeFunc)(int width, int height) = NULL;
33 void (*KeyboardFunc)(unsigned char key, int x, int y) = NULL;
34 void (*KeyboardUpFunc)(unsigned char key, int x, int y) = NULL;
35 void (*MouseFunc)(int key, int state, int x, int y) = NULL;
36 void (*MotionFunc)(int x, int y) = NULL;
37 void (*PassiveMotionFunc)(int x, int y) = NULL;
38 void (*VisibilityFunc)(int state) = NULL;
39 void (*SpecialFunc)(int key, int x, int y) = NULL;
40 void (*SpecialUpFunc)(int key, int x, int y) = NULL;
41 void (*IdleFunc)(void) = NULL;
42 void (*MenuStatusFunc)(int state, int x, int y) = NULL;
43 void (*MenuStateFunc)(int state) = NULL;
44
45 void glutDisplayFunc(void (*func)(void))
46 {
47 DisplayFunc = func;
48 }
49
50 void glutOverlayDisplayFunc(void (*func)(void))
51 {
52 }
53
54 void glutWindowStatusFunc(void (*func)(int state))
55 {
56 }
57
58 void glutReshapeFunc(void (*func)(int width, int height))
59 {
60 ReshapeFunc = func;
61 }
62
63 void glutKeyboardFunc(void (*func)(unsigned char key, int x, int y))
64 {
65 KeyboardFunc = func;
66 }
67
68 void glutKeyboardUpFunc(void (*func)(unsigned char key, int x, int y))
69 {
70 KeyboardUpFunc = func;
71 }
72
73 void glutMouseFunc(void (*func)(int button, int state, int x, int y))
74 {
75 MouseEnabled = 1;
76 MouseFunc = func;
77 }
78
79 void glutMotionFunc(void (*func)(int x, int y))
80 {
81 MouseEnabled = 1;
82 MotionFunc = func;
83 }
84
85 void glutPassiveMotionFunc(void (*func)(int x, int y))
86 {
87 MouseEnabled = 1;
88 PassiveMotionFunc = func;
89 }
90
91 void glutJoystickFunc(void (*func)(unsigned int buttonMask,
92 int x, int y, int z), int pollInterval)
93 {
94 }
95
96 void glutVisibilityFunc(void (*func)(int state))
97 {
98 VisibilityFunc = func;
99 }
100
101 void glutEntryFunc(void (*func)(int state))
102 {
103 }
104
105 void glutSpecialFunc(void (*func)(int key, int x, int y))
106 {
107 SpecialFunc = func;
108 }
109
110 void glutSpecialUpFunc(void (*func)(int key, int x, int y))
111 {
112 SpecialUpFunc = func;
113 }
114
115 void glutSpaceballMotionFunc(void (*func)(int x, int y, int z))
116 {
117 }
118
119 void glutSpaceballRotateFunc(void (*func)(int x, int y, int z))
120 {
121 }
122
123 void glutSpaceballButtonFunc(void (*func)(int button, int state))
124 {
125 }
126
127 void glutButtonBoxFunc(void (*func)(int button, int state))
128 {
129 }
130
131 void glutDialsFunc(void (*func)(int dial, int value))
132 {
133 }
134
135 void glutTabletMotionFunc(void (*func)(int x, int y))
136 {
137 }
138
139 void glutTabletButtonFunc(void (*func)(int button, int state,
140 int x, int y))
141 {
142 }
143
144 void glutMenuStatusFunc(void (*func)(int status, int x, int y))
145 {
146 MenuStatusFunc = func;
147 }
148
149 void glutMenuStateFunc(void (*func)(int status))
150 {
151 MenuStateFunc = func;
152 }
153
154 void glutIdleFunc(void (*func)(void))
155 {
156 IdleFunc = func;
157 }
158
159 void glutTimerFunc(unsigned int msecs,
160 void (*func)(int value), int value)
161 {
162 struct GlutTimer **head = &GlutTimers, *timer = malloc(sizeof *timer);
163 timer->time = glutGet(GLUT_ELAPSED_TIME) + msecs;
164 timer->func = func;
165 timer->value = value;
166
167 while(*head && (*head)->time < timer->time)
168 head = &(*head)->next;
169
170 timer->next = *head;
171 *head = timer;
172 }