Mercurial > projects > doodle
comparison doodle/gtk/events.d @ 136:752676232e4b
Port to GtkD-2.0 (gtk+3)
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Wed, 26 Sep 2012 17:36:31 +0930 |
parents | 0314b2e03f9b |
children |
comparison
equal
deleted
inserted
replaced
135:be50d20643a1 | 136:752676232e4b |
---|---|
95 GdkDevice *device; | 95 GdkDevice *device; |
96 double xRoot, yRoot; | 96 double xRoot, yRoot; |
97 } | 97 } |
98 */ | 98 */ |
99 | 99 |
100 ButtonEvent makeButtonEvent(const GdkEventButton * event, in ScreenModel screenModel) { | 100 ButtonEvent makeButtonEvent(const gdk.Event.GdkEventButton * event, in ScreenModel screenModel) { |
101 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); | 101 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); |
102 Point modelPoint = screenModel.screenToModel(screenPoint); | 102 Point modelPoint = screenModel.screenToModel(screenPoint); |
103 return new ButtonEvent(gtk2tkButtonAction(event.type), | 103 return new ButtonEvent(gtk2tkButtonAction(event.type), |
104 gtk2tkButtonName(event.button), | 104 gtk2tkButtonName(event.button), |
105 screenPoint, modelPoint, gtk2tkMask(event.state)); | 105 screenPoint, modelPoint, gtk2tkMask(event.state)); |
119 GdkDevice *device; | 119 GdkDevice *device; |
120 double xRoot, yRoot; | 120 double xRoot, yRoot; |
121 } | 121 } |
122 */ | 122 */ |
123 | 123 |
124 MotionEvent makeMotionEvent(const GdkEventMotion * event, in ScreenModel screenModel) { | 124 MotionEvent makeMotionEvent(const gdk.Event.GdkEventMotion * event, in ScreenModel screenModel) { |
125 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); | 125 assert(!event.isHint); |
126 Point modelPoint = screenModel.screenToModel(screenPoint); | 126 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); |
127 | 127 Point modelPoint = screenModel.screenToModel(screenPoint); |
128 return new MotionEvent(screenPoint, modelPoint, gtk2tkMask(event.state)); | 128 return new MotionEvent(screenPoint, modelPoint, gtk2tkMask(event.state)); |
129 } | |
130 | |
131 MotionEvent makeMotionEventHint(int x, int y, gdk.Event.GdkModifierType mask, in ScreenModel screenModel) { | |
132 Point screenPoint = Point(cast(double)x + 0.5, screenModel.viewBoundsScreen.h - (cast(double)y + 0.5)); | |
133 Point modelPoint = screenModel.screenToModel(screenPoint); | |
134 return new MotionEvent(screenPoint, modelPoint, gtk2tkMask(cast(gdk.Event.guint)mask)); | |
129 } | 135 } |
130 | 136 |
131 /* | 137 /* |
132 public struct GdkEventKey { | 138 public struct GdkEventKey { |
133 GdkEventType type; | 139 GdkEventType type; |
143 uint bitfield0; | 149 uint bitfield0; |
144 uint isModifier : 1; | 150 uint isModifier : 1; |
145 } | 151 } |
146 */ | 152 */ |
147 | 153 |
148 KeyEvent makeKeyEvent(const GdkEventKey * event, in ScreenModel screenModel) { | 154 KeyEvent makeKeyEvent(const gdk.Event.GdkEventKey * event, in ScreenModel screenModel) { |
149 return new KeyEvent(event.string[0..strlen(event.string)].idup, | 155 return new KeyEvent(event.string[0..strlen(event.string)].idup, |
150 event.keyval, | 156 event.keyval, |
151 gtk2tkMask(event.state)); | 157 gtk2tkMask(event.state)); |
152 } | 158 } |
153 | 159 |
164 GdkDevice *device; | 170 GdkDevice *device; |
165 double xRoot, yRoot; | 171 double xRoot, yRoot; |
166 } | 172 } |
167 */ | 173 */ |
168 | 174 |
169 ScrollEvent makeScrollEvent(const GdkEventScroll * event, in ScreenModel screenModel) { | 175 ScrollEvent makeScrollEvent(const gdk.Event.GdkEventScroll * event, in ScreenModel screenModel) { |
170 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); | 176 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); |
171 Point modelPoint = screenModel.screenToModel(screenPoint); | 177 Point modelPoint = screenModel.screenToModel(screenPoint); |
172 return new ScrollEvent(gtk2tkDirection(event.direction), | 178 return new ScrollEvent(gtk2tkDirection(event.direction), |
173 screenPoint, | 179 screenPoint, |
174 modelPoint, | 180 modelPoint, |
200 int focus; | 206 int focus; |
201 uint state; | 207 uint state; |
202 } | 208 } |
203 */ | 209 */ |
204 | 210 |
205 CrossingEvent makeCrossingEvent(const GdkEventCrossing * event, in ScreenModel screenModel) { | 211 CrossingEvent makeCrossingEvent(const gdk.Event.GdkEventCrossing * event, in ScreenModel screenModel) { |
206 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); | 212 Point screenPoint = Point(event.x + 0.5, screenModel.viewBoundsScreen.h - (event.y + 0.5)); |
207 Point modelPoint = screenModel.screenToModel(screenPoint); | 213 Point modelPoint = screenModel.screenToModel(screenPoint); |
208 return new CrossingEvent(gtk2tkCrossingMode(event.mode), | 214 return new CrossingEvent(gtk2tkCrossingMode(event.mode), |
209 screenPoint, | 215 screenPoint, |
210 modelPoint, | 216 modelPoint, |