Re: [bug] error in unmarshalMouseButton

Claude Heiland-Allen <[email protected]> Tue, 16 Jun 2009 13:23:24 +0100
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
Claude Heiland-Allen wrote:
> Suggested fix:

diff attached.


Claude
-- 
http://claudiusmaximus.goto10.org

_______________________________________________
HOpenGL mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/hopengl
no-crash-on-mouse-click.patch (text/x-patch, 1.2 KB)
diff -rN -u old-GLUT/GLUT.cabal new-GLUT/GLUT.cabal
--- old-GLUT/GLUT.cabal	2009-06-16 13:12:04.000000000 +0100
+++ new-GLUT/GLUT.cabal	2009-06-16 13:12:04.000000000 +0100
@@ -1,5 +1,5 @@
 name:		GLUT
-version:	2.1.2.1
+version:	2.1.2.2
 license:	BSD3
 license-file:	LICENSE
 maintainer:	Sven Panne <[email protected]>
diff -rN -u old-GLUT/Graphics/UI/GLUT/Types.hs new-GLUT/Graphics/UI/GLUT/Types.hs
--- old-GLUT/Graphics/UI/GLUT/Types.hs	2009-06-16 13:12:04.000000000 +0100
+++ new-GLUT/Graphics/UI/GLUT/Types.hs	2009-06-16 13:12:04.000000000 +0100
@@ -82,6 +82,7 @@
    | RightButton
    | WheelUp
    | WheelDown
+   | OtherButton Int
    deriving ( Eq, Ord, Show )
 
 marshalMouseButton :: MouseButton -> CInt
@@ -91,6 +92,7 @@
    RightButton -> glut_RIGHT_BUTTON
    WheelUp ->glut_WHEEL_UP
    WheelDown -> glut_WHEEL_DOWN
+   OtherButton b -> fromIntegral b
 
 unmarshalMouseButton :: CInt -> MouseButton
 unmarshalMouseButton x
@@ -99,4 +101,4 @@
    | x == glut_RIGHT_BUTTON = RightButton
    | x == glut_WHEEL_UP = WheelUp
    | x == glut_WHEEL_DOWN = WheelDown
-   | otherwise = error ("unmarshalMouseButton: illegal value " ++ show x)
+   | otherwise = OtherButton (fromIntegral x)