Ticket #14: convertMotionPointBasedOnWindowSize.patch

File convertMotionPointBasedOnWindowSize.patch, 3.5 KB (added by Thomas DuBuisson, 13 years ago)

Fixed some typos in the old patch. This one actually builds.

Line 
12 patches for repository http://code.ouroborus.net/gloss/gloss-head:
2
3Fri Nov 12 10:46:25 PST 2010  Thomas.DuBuisson@gmail.com
4  * Convert motion points based on window size
5 
6  The points used for motion events and key/mouse events disagreed because one method was being convereted to a new coordinate system (based on the window size) while the other was not.  This patch makes sure points for either event are converted.
7
8Fri Nov 12 10:55:02 PST 2010  Thomas.DuBuisson@gmail.com
9  * Fix position conversion typos
10
11New patches:
12
13[Convert motion points based on window size
14Thomas.DuBuisson@gmail.com**20101112184625
15 Ignore-this: 4c5713b28a85d1af5f751e8ee10d7088
16 
17 The points used for motion events and key/mouse events disagreed because one method was being convereted to a new coordinate system (based on the window size) while the other was not.  This patch makes sure points for either event are converted.
18] hunk ./library/Graphics/Gloss/Internals/Interface/Game.hs 121
19 callback_keyMouse worldRef viewRef eventFn
20        = KeyMouse (handle_keyMouse worldRef viewRef eventFn)
21 
22-handle_keyMouse worldRef viewRef eventFn key keyState keyMods pos
23- = do  size@(GLUT.Size sizeX_ sizeY_)  <- GL.get GLUT.windowSize
24+convertPoint pos = do
25+ = do  size@(GLUT.Size sizeX_ sizeY_) <- GL.getGLUT.windowSize
26        let (sizeX, sizeY)              = (fromIntegral sizeX_, fromIntegral sizeY_)
27 
28        let GLUT.Position px_ py_       = pos
29hunk ./library/Graphics/Gloss/Internals/Interface/Game.hs 132
30        let px'         = px - sizeX / 2
31        let py'         = py - sizeY / 2
32        let pos'        = (px', py')
33
34+       return pos'
35+
36+handle_keyMouse worldRef viewRef eventFn key keyState keyMods pos
37+ = do  pos' <- convertPoint
38        worldRef `modifyIORef` \world -> eventFn (EventKey key keyState keyMods pos') world
39 
40 
41hunk ./library/Graphics/Gloss/Internals/Interface/Game.hs 149
42        = Motion (handle_motion worldRef eventFn)
43 
44 handle_motion worldRef eventFn pos
45- = let GLUT.Position x y       = pos
46-       pos'                    = (fromIntegral x, fromIntegral y)
47-   in  worldRef `modifyIORef` \world -> eventFn (EventMotion pos') world
48+ = do pos' <- convertPoint pos
49+     worldRef `modifyIORef` \world -> eventFn (EventMotion pos') world
50 
51 
52 
53[Fix position conversion typos
54Thomas.DuBuisson@gmail.com**20101112185502
55 Ignore-this: 94ef819de773148f41a2f026ffc16a64
56] hunk ./library/Graphics/Gloss/Internals/Interface/Game.hs 121
57 callback_keyMouse worldRef viewRef eventFn
58        = KeyMouse (handle_keyMouse worldRef viewRef eventFn)
59 
60-convertPoint pos = do
61- = do  size@(GLUT.Size sizeX_ sizeY_) <- GL.getGLUT.windowSize
62+convertPoint :: GL.Position -> IO (Float,Float)
63+convertPoint pos
64+ = do  size@(GLUT.Size sizeX_ sizeY_) <- GL.get GLUT.windowSize
65        let (sizeX, sizeY)              = (fromIntegral sizeX_, fromIntegral sizeY_)
66 
67        let GLUT.Position px_ py_       = pos
68hunk ./library/Graphics/Gloss/Internals/Interface/Game.hs 136
69        return pos'
70 
71 handle_keyMouse worldRef viewRef eventFn key keyState keyMods pos
72- = do  pos' <- convertPoint
73+ = do  pos' <- convertPoint pos
74        worldRef `modifyIORef` \world -> eventFn (EventKey key keyState keyMods pos') world
75 
76 
77hunk ./library/Graphics/Gloss/Internals/Interface/Game.hs 151
78 
79 handle_motion worldRef eventFn pos
80  = do pos' <- convertPoint pos
81-     worldRef `modifyIORef` \world -> eventFn (EventMotion pos') world
82+      worldRef `modifyIORef` \world -> eventFn (EventMotion pos') world
83 
84 
85 
86
87Context:
88
89[Start on Delaunay example
90benl@ouroborus.net**20100628064011
91 Ignore-this: 9c2d2f9dba49b0566f51cecd28fcb74a
92]
93[TAG Release 1.1.0.0
94benl@ouroborus.net**20100507050236
95 Ignore-this: 725b43f6639eb93464bca129e8d44c9
96]
97Patch bundle hash:
9864295dedd8037790743d3bfde9888c3477e820ad