Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/eXene/lib/protocol/xevttypes.sml
ViewVC logotype

Annotation of /sml/trunk/src/eXene/lib/protocol/xevttypes.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (view) (download)

1 : monnier 2 (* xevttypes.sml
2 :     *
3 :     * COPYRIGHT (c) 1990,1991 by John H. Reppy. See COPYRIGHT file for details.
4 :     *)
5 :    
6 :     structure XEventTypes =
7 :     struct
8 :    
9 :     local
10 :     open Geometry XProtTypes
11 :    
12 :     val & = Word.andb
13 :     val ++ = Word.orb
14 :     val << = Word.<<
15 :     infix ++ << &
16 :    
17 :     in
18 :    
19 :     (* X event names *)
20 :     datatype xevent_name
21 :     = XEVT_KeyPress
22 :     | XEVT_KeyRelease
23 :     | XEVT_ButtonPress
24 :     | XEVT_ButtonRelease
25 :     | XEVT_EnterWindow
26 :     | XEVT_LeaveWindow
27 :     | XEVT_PointerMotion
28 :     | XEVT_PointerMotionHint
29 :     | XEVT_Button1Motion
30 :     | XEVT_Button2Motion
31 :     | XEVT_Button3Motion
32 :     | XEVT_Button4Motion
33 :     | XEVT_Button5Motion
34 :     | XEVT_ButtonMotion
35 :     | XEVT_KeymapState
36 :     | XEVT_Exposure
37 :     | XEVT_VisibilityChange
38 :     | XEVT_StructureNotify
39 :     | XEVT_ResizeRedirect
40 :     | XEVT_SubstructureNotify
41 :     | XEVT_SubstructureRedirect
42 :     | XEVT_FocusChange
43 :     | XEVT_PropertyChange
44 :     | XEVT_ColormapChange
45 :     | XEVT_OwnerGrabButton
46 :    
47 :     (* The types of the information carried by some XEvents *)
48 :     type key_xevtinfo = { (* KeyPress and KeyRelease *)
49 :     root : win_id, (* the root of the source window *)
50 :     event : win_id, (* the window in which this was generated *)
51 :     child : win_id option, (* the child of the event window that is the *)
52 :     (* ancestor of the source window *)
53 :     same_screen : bool, (* *)
54 :     root_pt : point, (* event coords in the root window *)
55 :     event_pt : point, (* event coords in the event window *)
56 :     keycode : keycode, (* the keycode of the depressed key *)
57 :     mod_state : modkey_state, (* the modifier-key state *)
58 :     mbut_state : mbutton_state, (* the mouse button state *)
59 :     time : XTime.time
60 :     }
61 :     type button_xevtinfo = { (* ButtonPress and ButtonRelease *)
62 :     root : win_id, (* the root of the source window *)
63 :     event : win_id, (* the window in which this was generated *)
64 :     child : win_id option, (* the child of the event window that is the *)
65 :     (* ancestor of the source window *)
66 :     same_screen : bool, (* *)
67 :     root_pt : point, (* event coords in the root window *)
68 :     event_pt : point, (* event coords in the event window *)
69 :     button : mbutton, (* the button that was pressed *)
70 :     mod_state : modkey_state, (* the modifier-key state *)
71 :     mbut_state : mbutton_state, (* the mouse button state *)
72 :     time : XTime.time
73 :     }
74 :     type inout_xevtinfo = { (* EnterNotify and LeaveNotify *)
75 :     root : win_id, (* the root window for the pointer position *)
76 :     event : win_id, (* the event window *)
77 :     child : win_id option, (* the child of event containing the pointer *)
78 :     same_screen : bool, (* *)
79 :     root_pt : point, (* final pointer position in root coords *)
80 :     event_pt : point, (* final pointer position in event coords *)
81 :     mode : focus_mode, (* *)
82 :     detail : focus_detail, (* *)
83 :     mod_state : modkey_state, (* the modifier-key state *)
84 :     mbut_state : mbutton_state, (* the mouse button state *)
85 :     focus : bool, (* true, if event is the focus *)
86 :     time : XTime.time
87 :     }
88 :     type focus_xevtinfo = { (* FocusIn and FocusOut *)
89 :     event : win_id, (* the window that gained the focus *)
90 :     mode : focus_mode,
91 :     detail : focus_detail
92 :     }
93 :    
94 :    
95 :     (* X event messages *)
96 :     datatype xevent
97 :     = KeyPressXEvt of key_xevtinfo
98 :     | KeyReleaseXEvt of key_xevtinfo
99 :     | ButtonPressXEvt of button_xevtinfo
100 :     | ButtonReleaseXEvt of button_xevtinfo
101 :     | MotionNotifyXEvt of {
102 :     root : win_id, (* the root of the source window *)
103 :     event : win_id, (* the window in which this was generated *)
104 :     child : win_id option, (* the child of the event window that is the *)
105 :     (* ancestor of the source window *)
106 :     same_screen : bool, (* *)
107 :     root_pt : point, (* event coords in the root window *)
108 :     event_pt : point, (* event coords in the event window *)
109 :     hint : bool, (* true, if PointerMotionHint is selected *)
110 :     mod_state : modkey_state, (* the modifier-key state *)
111 :     mbut_state : mbutton_state, (* the mouse button state *)
112 :     time : XTime.time
113 :     }
114 :     | EnterNotifyXEvt of inout_xevtinfo
115 :     | LeaveNotifyXEvt of inout_xevtinfo
116 :     | FocusInXEvt of focus_xevtinfo
117 :     | FocusOutXEvt of focus_xevtinfo
118 :     | KeymapNotifyXEvt of {}
119 :     | ExposeXEvt of {
120 :     window : win_id, (* the exposed window *)
121 :     rects : rect list, (* the exposed rectangle. This is a list, so *)
122 :     (* that multiple events can be packed *)
123 :     count : int (* number of subsequent expose events *)
124 :     }
125 :     | GraphicsExposeXEvt of {
126 :     drawable : drawable_id,
127 :     rect : rect, (* the obscured rectangle. *)
128 :     count : int, (* the # of additional GraphicsExpose events *)
129 :     major_opcode : word, (* the graphics operation code *)
130 :     minor_opcode : word (* always 0 for core protocol *)
131 :     }
132 :     | NoExposeXEvt of {
133 :     drawable : drawable_id,
134 :     major_opcode : word, (* the graphics operation code *)
135 :     minor_opcode : word (* always 0 for core protocol *)
136 :     }
137 :     | VisibilityNotifyXEvt of {
138 :     window : win_id, (* the window with changed visibility state *)
139 :     state : visibility (* the new visibility state *)
140 :     }
141 :     | CreateNotifyXEvt of {
142 :     parent : win_id, (* the created window's parent *)
143 :     window : win_id, (* the created window *)
144 :     rect : rect, (* the window's rectangle *)
145 :     border_wid : int, (* the width of the border *)
146 :     override_redirect : bool (* *)
147 :     }
148 :     | DestroyNotifyXEvt of {
149 :     event : win_id, (* the window on which this was generated *)
150 :     window : win_id (* the destroyed window *)
151 :     }
152 :     | UnmapNotifyXEvt of {
153 :     event : win_id, (* the window on which this was generated *)
154 :     window : win_id, (* the window being unmapped *)
155 :     from_config : bool (* true, if parent was resized *)
156 :     }
157 :     | MapNotifyXEvt of {
158 :     event : win_id, (* the window on which this was generated *)
159 :     window : win_id, (* the window being mapped *)
160 :     override_redirect : bool (* *)
161 :     }
162 :     | MapRequestXEvt of {
163 :     parent : win_id, (* the parent *)
164 :     window : win_id (* the mapped window *)
165 :     }
166 :     | ReparentNotifyXEvt of {
167 :     event : win_id, (* the window on which this was generated *)
168 :     parent : win_id, (* the new parent *)
169 :     window : win_id, (* the re-rooted window *)
170 :     corner : point, (* the upper-left corner *)
171 :     override_redirect : bool (* *)
172 :     }
173 :     | ConfigureNotifyXEvt of {
174 :     event : win_id, (* the window on which this was generated *)
175 :     window : win_id, (* the reconfigured window *)
176 :     sibling : win_id option, (* the sibling that window is above (if any) *)
177 :     rect : rect, (* the window's rectangle *)
178 :     border_wid : int, (* the width of the border *)
179 :     override_redirect : bool (* *)
180 :     }
181 :     | ConfigureRequestXEvt of {
182 :     parent : win_id, (* the parent *)
183 :     window : win_id, (* the window to reconfigure *)
184 :     sibling : win_id option, (* the new sibling (if any) *)
185 :     x : int option, (* the window's rectangle *)
186 :     y : int option,
187 :     wid : int option,
188 :     ht : int option,
189 :     border_wid : int option, (* the width of the border *)
190 :     stack_mode : stack_mode option (* the mode for stacking windows *)
191 :     }
192 :     | GravityNotifyXEvt of {
193 :     event : win_id, (* the window on which this was generated *)
194 :     window : win_id, (* the window being moved *)
195 :     corner : point (* upper-left corner of window *)
196 :     }
197 :     | ResizeRequestXEvt of {
198 :     window : win_id, (* the window to resize *)
199 :     req_sz : size (* the requested new size *)
200 :     }
201 :     | CirculateNotifyXEvt of {
202 :     event : win_id, (* the window on which this was generated *)
203 :     window : win_id, (* the window being circulated *)
204 :     parent : win_id, (* the parent *)
205 :     place : stack_pos (* the new place *)
206 :     }
207 :     | CirculateRequestXEvt of {
208 :     parent : win_id, (* the parent *)
209 :     window : win_id, (* the window to circulate *)
210 :     place : stack_pos (* the place to circulate the window to *)
211 :     }
212 :     | PropertyNotifyXEvt of {
213 :     window : win_id, (* the window with the changed property *)
214 :     atom : atom, (* the affected property *)
215 :     time : XTime.time, (* when the property was changed *)
216 :     deleted : bool (* true, if the property was deleted *)
217 :     }
218 :     | SelectionClearXEvt of {
219 :     owner : win_id, (* the current owner of the selection *)
220 :     selection : atom, (* the selection *)
221 :     time : XTime.time (* the last-change time *)
222 :     }
223 :     | SelectionRequestXEvt of {
224 :     owner : win_id, (* the owner of the selection *)
225 :     selection : atom, (* the selection *)
226 :     target : atom, (* the requested type for the selection *)
227 :     requestor : win_id, (* the requesting window *)
228 :     property : atom option, (* the property to store the selection in *)
229 :     time : timestamp (* *)
230 :     }
231 :     | SelectionNotifyXEvt of {
232 :     requestor : win_id, (* the requestor of the selection *)
233 :     selection : atom, (* the selection *)
234 :     target : atom, (* the requested type of the selection *)
235 :     property : atom option, (* the property to store the selection in *)
236 :     time : timestamp (* *)
237 :     }
238 :     | ColormapNotifyXEvt of {
239 :     window : win_id, (* the affected window *)
240 :     cmap : colormap_id option, (* the colormap *)
241 :     new : bool, (* true, if the colormap attribute is changed *)
242 :     installed : bool (* true, if the colormap is installed *)
243 :     }
244 :     | ClientMessageXEvt of {
245 :     window : win_id, (* *)
246 :     typ : atom, (* the type of the message *)
247 :     value : raw_data (* the message value *)
248 :     }
249 :     | ModifierMappingNotifyXEvt (* really a MappingNotify event *)
250 :     | KeyboardMappingNotifyXEvt of { (* really a MappingNotify event *)
251 :     first_keycode : keycode,
252 :     count : int
253 :     }
254 :     | PointerMappingNotifyXEvt (* really a MappingNotify event *)
255 :    
256 :     fun maskOfXEvt XEVT_KeyPress = XEVTMASK(0w1 << 0w0)
257 :     | maskOfXEvt XEVT_KeyRelease = XEVTMASK(0w1 << 0w1)
258 :     | maskOfXEvt XEVT_ButtonPress = XEVTMASK(0w1 << 0w2)
259 :     | maskOfXEvt XEVT_ButtonRelease = XEVTMASK(0w1 << 0w3)
260 :     | maskOfXEvt XEVT_EnterWindow = XEVTMASK(0w1 << 0w4)
261 :     | maskOfXEvt XEVT_LeaveWindow = XEVTMASK(0w1 << 0w5)
262 :     | maskOfXEvt XEVT_PointerMotion = XEVTMASK(0w1 << 0w6)
263 :     | maskOfXEvt XEVT_PointerMotionHint = XEVTMASK(0w1 << 0w7)
264 :     | maskOfXEvt XEVT_Button1Motion = XEVTMASK(0w1 << 0w8)
265 :     | maskOfXEvt XEVT_Button2Motion = XEVTMASK(0w1 << 0w9)
266 :     | maskOfXEvt XEVT_Button3Motion = XEVTMASK(0w1 << 0w10)
267 :     | maskOfXEvt XEVT_Button4Motion = XEVTMASK(0w1 << 0w11)
268 :     | maskOfXEvt XEVT_Button5Motion = XEVTMASK(0w1 << 0w12)
269 :     | maskOfXEvt XEVT_ButtonMotion = XEVTMASK(0w1 << 0w13)
270 :     | maskOfXEvt XEVT_KeymapState = XEVTMASK(0w1 << 0w14)
271 :     | maskOfXEvt XEVT_Exposure = XEVTMASK(0w1 << 0w15)
272 :     | maskOfXEvt XEVT_VisibilityChange = XEVTMASK(0w1 << 0w16)
273 :     | maskOfXEvt XEVT_StructureNotify = XEVTMASK(0w1 << 0w17)
274 :     | maskOfXEvt XEVT_ResizeRedirect = XEVTMASK(0w1 << 0w18)
275 :     | maskOfXEvt XEVT_SubstructureNotify = XEVTMASK(0w1 << 0w19)
276 :     | maskOfXEvt XEVT_SubstructureRedirect = XEVTMASK(0w1 << 0w20)
277 :     | maskOfXEvt XEVT_FocusChange = XEVTMASK(0w1 << 0w21)
278 :     | maskOfXEvt XEVT_PropertyChange = XEVTMASK(0w1 << 0w22)
279 :     | maskOfXEvt XEVT_ColormapChange = XEVTMASK(0w1 << 0w23)
280 :     | maskOfXEvt XEVT_OwnerGrabButton = XEVTMASK(0w1 << 0w24)
281 :    
282 :     fun maskOfXEvtList l = let
283 :     fun f ([], m) = XEVTMASK m
284 :     | f (xevt::r, m) = let
285 :     val (XEVTMASK m') = maskOfXEvt xevt
286 :     in
287 :     f (r, m ++ m')
288 :     end
289 :     in
290 :     f (l, 0w0)
291 :     end
292 :    
293 :     fun unionXEvtMasks (XEVTMASK m1, XEVTMASK m2) = XEVTMASK(m1 ++ m2)
294 :     fun interXEvtMasks (XEVTMASK m1, XEVTMASK m2) = XEVTMASK(m1 & m2)
295 :    
296 :     end (* local *)
297 :     end (* XEventTypes *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0