// See native interface. func (o *osx) readDispatch(r *nrefs) *userInput { gsu := &C.GSEvent{0, -1, -1, 0, 0, 0} C.gs_read_dispatch(C.long(r.display), gsu) o.in, o.in1 = o.in1, o.in // transfer/translate the native event into the input buffer. in := o.in in.id = events[int(gsu.event)] if in.id != 0 { in.button = mouseButtons[int(gsu.event)] in.key = int(gsu.key) in.scroll = int(gsu.scroll) } else { in.button, in.key, in.scroll = 0, 0, 0 } in.mods = int(gsu.mods) & (controlKeyMask | shiftKeyMask | functionKeyMask) in.mouseX = int(gsu.mousex) in.mouseY = int(gsu.mousey) return in }
// See native interface. func (w *win) readDispatch(r *nrefs) *userInput { gsu := &C.GSEvent{0, -1, -1, 0, 0, 0} C.gs_read_dispatch(C.long(r.display), gsu) w.in, w.in1 = w.in1, w.in // transfer/translate the native event into the input buffer. in := w.in in.id = events[int(gsu.event)] if in.id != 0 { in.button = mouseButtons[int(gsu.event)] in.key = int(gsu.key) in.scroll = int(gsu.scroll) } else { in.button, in.key, in.scroll = 0, 0, 0 } in.mods = int(gsu.mods) in.mouseX = int(gsu.mousex) in.mouseY = int(gsu.mousey) return in }
// Implement native interface. func (w *win) readDispatch(r *nrefs, in *userInput) *userInput { w.gsu.event = 0 w.gsu.mousex = -1 w.gsu.mousey = -1 w.gsu.key = 0 w.gsu.mods = 0 w.gsu.scroll = 0 C.gs_read_dispatch(C.long(r.display), w.gsu) // transfer/translate the native event into the input buffer. in.id = events[int(w.gsu.event)] if in.id != 0 { in.button = mouseButtons[int(w.gsu.event)] in.key = int(w.gsu.key) in.scroll = int(w.gsu.scroll) } else { in.button, in.key, in.scroll = 0, 0, 0 } in.mods = int(w.gsu.mods) in.mouseX = int(w.gsu.mousex) in.mouseY = int(w.gsu.mousey) return in }
// Implement native interface. func (o *osx) readDispatch(r *nrefs, in *userInput) *userInput { o.gsu.event = 0 o.gsu.mousex = -1 o.gsu.mousey = -1 o.gsu.key = 0 o.gsu.scroll = 0 // o.gsu.mods retain the modifier key state between calls. C.gs_read_dispatch(C.long(r.display), o.gsu) // transfer/translate the native event into the input buffer. in.id = events[int(o.gsu.event)] if in.id != 0 { in.button = mouseButtons[int(o.gsu.event)] in.key = int(o.gsu.key) in.scroll = int(o.gsu.scroll) } else { in.button, in.key, in.scroll = 0, 0, 0 } in.mods = int(o.gsu.mods) & (controlKeyMask | shiftKeyMask | functionKeyMask | commandKeyMask | altKeyMask) in.mouseX = int(o.gsu.mousex) in.mouseY = int(o.gsu.mousey) return in }