Skip to content

Commit 63f95bc

Browse files
committed
Added initContextCallback
1 parent 8a6979b commit 63f95bc

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

Graphics/UI/GLUT/Callbacks/Registration.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ data CallbackType
4343
-- freeglut-only callback types
4444
| CloseCB | MouseWheelCB | PositionCB
4545
| MultiEntryCB | MultiMotionCB | MultiButtonCB
46-
| MultiPassiveCB
46+
| MultiPassiveCB | InitContextCB
4747
deriving ( Eq, Ord )
4848

4949
isGlobal :: CallbackType -> Bool

Graphics/UI/GLUT/Callbacks/Window.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ module Graphics.UI.GLUT.Callbacks.Window (
2727
-- * Window close callback
2828
CloseCallback, closeCallback,
2929

30+
-- * Initialize context callback
31+
InitContextCallback, initContextCallback,
32+
3033
-- * Keyboard callback
3134
KeyboardCallback, keyboardCallback, keyboardUpCallback,
3235

@@ -313,6 +316,19 @@ closeCallback = makeSettableStateVar $
313316

314317
--------------------------------------------------------------------------------
315318

319+
-- | An initialize context callback
320+
321+
type InitContextCallback = IO ()
322+
323+
-- | (/freeglut only/) Controls the initialize context callback for the /current
324+
-- window/.
325+
326+
initContextCallback :: SettableStateVar (Maybe InitContextCallback)
327+
initContextCallback = makeSettableStateVar $
328+
setCallback InitContextCB glutInitContextFunc makeInitContextFunc
329+
330+
--------------------------------------------------------------------------------
331+
316332
-- | A keyboard callback
317333

318334
type KeyboardCallback = Char -> Position -> IO ()

Graphics/UI/GLUT/Raw/Callbacks.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module Graphics.UI.GLUT.Raw.Callbacks (
2121
DisplayFunc, makeDisplayFunc,
2222
EntryFunc, makeEntryFunc,
2323
IdleFunc, makeIdleFunc,
24+
InitContextFunc, makeInitContextFunc,
2425
JoystickFunc, makeJoystickFunc,
2526
KeyboardFunc, makeKeyboardFunc,
2627
KeyboardUpFunc, makeKeyboardUpFunc,
@@ -85,6 +86,11 @@ type IdleFunc = IO ()
8586
foreign import ccall "wrapper"
8687
makeIdleFunc :: IdleFunc -> IO (FunPtr IdleFunc)
8788

89+
type InitContextFunc = IO ()
90+
91+
foreign import ccall "wrapper"
92+
makeInitContextFunc :: InitContextFunc -> IO (FunPtr InitContextFunc)
93+
8894
type JoystickFunc = CUInt -> CInt -> CInt -> CInt -> IO ()
8995

9096
foreign import ccall "wrapper"

Graphics/UI/GLUT/Raw/Functions.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ module Graphics.UI.GLUT.Raw.Functions (
6363
glutIgnoreKeyRepeat,
6464
glutInit,
6565
glutInitContextFlags,
66+
glutInitContextFunc,
6667
glutInitContextProfile,
6768
glutInitContextVersion,
6869
glutInitDisplayMode,
@@ -229,6 +230,7 @@ API_ENTRY(glutIdleFunc,FunPtr IdleFunc -> IO ())
229230
API_ENTRY(glutIgnoreKeyRepeat,CInt -> IO ())
230231
API_ENTRY(glutInit,Ptr CInt -> Ptr (Ptr CChar) -> IO ())
231232
API_ENTRY(glutInitContextFlags,CInt -> IO ())
233+
API_ENTRY(glutInitContextFunc,FunPtr InitContextFunc -> IO ())
232234
API_ENTRY(glutInitContextProfile,CInt -> IO ())
233235
API_ENTRY(glutInitContextVersion,CInt -> CInt -> IO ())
234236
API_ENTRY(glutInitDisplayMode,CUInt -> IO ())

0 commit comments

Comments
 (0)