2 * Mesa 3-D graphics library
4 * Copyright (C) 1995-1998 Brian Paul
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.
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.
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.
22 * DOS/DJGPP glut driver v1.5 for Mesa
24 * Copyright (C) 2002 - Borca Daniel
25 * Email : dborca@yahoo.com
26 * Web : http://www.geocities.com/dborca
35 void (*func
) (int); /* function to call */
36 int value
; /* value to pass to callback */
37 int ttl
; /* time to live (blank shots) */
38 int fid
; /* func-id as returned from PCHW */
41 GLUTidleCB g_idle_func
= NULL
;
45 static void g_single_shot_callback (void *opaque
)
47 GLUTSShotCB
*cb
= (GLUTSShotCB
*)opaque
;
50 pc_remove_int(cb
->fid
);
51 /* We won't be needing this slot anymore, so free it. This operation
52 * must be the last thing, and must be atomic, to mutex `glutTimerFunc'
56 } ENDOFUNC(g_single_shot_callback
)
60 void APIENTRY
glutDisplayFunc (GLUTdisplayCB func
)
62 g_curwin
->display
= func
;
67 void APIENTRY
glutReshapeFunc (GLUTreshapeCB func
)
69 g_curwin
->reshape
= func
;
74 void APIENTRY
glutKeyboardFunc (GLUTkeyboardCB func
)
76 g_curwin
->keyboard
= func
;
81 void APIENTRY
glutMouseFunc (GLUTmouseCB func
)
83 g_curwin
->mouse
= func
;
88 void APIENTRY
glutMotionFunc (GLUTmotionCB func
)
90 g_curwin
->motion
= func
;
95 void APIENTRY
glutPassiveMotionFunc (GLUTpassiveCB func
)
97 g_curwin
->passive
= func
;
102 void APIENTRY
glutEntryFunc (GLUTentryCB func
)
104 g_curwin
->entry
= func
;
109 void APIENTRY
glutVisibilityFunc (GLUTvisibilityCB func
)
111 g_curwin
->visibility
= func
;
116 void APIENTRY
glutWindowStatusFunc (GLUTwindowStatusCB func
)
122 void APIENTRY
glutIdleFunc (GLUTidleCB func
)
129 void APIENTRY
glutTimerFunc (unsigned int millis
, GLUTtimerCB func
, int value
)
131 static GLUTSShotCB g_sscb
[MAX_SSHOT_CB
];
132 static GLboolean virgin
= GL_TRUE
;
141 LOCKFUNC(g_single_shot_callback
);
142 /* we should lock the callee also... */
147 /* don't go beyond 20Hz */
149 ttl
= millis
* freq
/ 1000;
151 freq
= 1000 / millis
;
154 for (i
= 0; i
< MAX_SSHOT_CB
; i
++) {
155 if (g_sscb
[i
].func
== NULL
) {
156 /* We will be needing this slot, so alloc it. This operation
157 * must be the first thing, and must be atomic, to mutex callbacks!
159 g_sscb
[i
].func
= func
;
160 g_sscb
[i
].value
= value
;
162 /* There is a very small gap here: `pc_install_int' enables
163 * interrupts just before returning FID value (which will be
164 * used inside callback). The critical gap is 1 millisecond
165 * - which I'm sure we won't overrun...
167 g_sscb
[i
].fid
= pc_install_int((PFUNC
)func
, &g_sscb
[i
], freq
);
168 if (g_sscb
[i
].fid
< 0) {
169 /* Interrupt could not be set! Release the slot back */
170 g_sscb
[i
].func
= NULL
;
180 void APIENTRY
glutSpecialFunc (GLUTspecialCB func
)
182 g_curwin
->special
= func
;
187 void APIENTRY
glutSpaceballMotionFunc (GLUTspaceMotionCB func
)
193 void APIENTRY
glutSpaceballRotateFunc (GLUTspaceRotateCB func
)
199 void APIENTRY
glutSpaceballButtonFunc (GLUTspaceButtonCB func
)
205 void APIENTRY
glutDialsFunc (GLUTdialsCB func
)
211 void APIENTRY
glutButtonBoxFunc (GLUTbuttonBoxCB func
)
217 void APIENTRY
glutTabletMotionFunc (GLUTtabletMotionCB func
)
223 void APIENTRY
glutTabletButtonFunc (GLUTtabletButtonCB func
)
229 void APIENTRY
glutJoystickFunc (GLUTjoystickCB func
, int interval
)