|
|
|
@ -161,6 +161,21 @@ func (backend *Backend) handleButtonRelease (
|
|
|
|
backend.channel <- stone.EventRelease(buttonEvent.Detail)
|
|
|
|
backend.channel <- stone.EventRelease(buttonEvent.Detail)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (backend *Backend) handleMotionNotify (
|
|
|
|
|
|
|
|
connection *xgbutil.XUtil,
|
|
|
|
|
|
|
|
event xevent.MotionNotifyEvent,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
motionEvent := *event.MotionNotifyEvent
|
|
|
|
|
|
|
|
x, y := backend.cellAt (image.Point {
|
|
|
|
|
|
|
|
X: int(motionEvent.EventX),
|
|
|
|
|
|
|
|
Y: int(motionEvent.EventY),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
backend.channel <- stone.EventMouseMove {
|
|
|
|
|
|
|
|
X: x,
|
|
|
|
|
|
|
|
Y: y,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (backend *Backend) compressConfigureNotify (
|
|
|
|
func (backend *Backend) compressConfigureNotify (
|
|
|
|
firstEvent xproto.ConfigureNotifyEvent,
|
|
|
|
firstEvent xproto.ConfigureNotifyEvent,
|
|
|
|
) (
|
|
|
|
) (
|
|
|
|
@ -292,6 +307,12 @@ func (backend *Backend) drawRune (x, y int, character rune) {
|
|
|
|
draw.Over)
|
|
|
|
draw.Over)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (backend *Backend) cellAt (onScreen image.Point) (x, y int) {
|
|
|
|
|
|
|
|
x = (onScreen.X - backend.metrics.paddingX) / backend.metrics.cellWidth
|
|
|
|
|
|
|
|
y = (onScreen.Y - backend.metrics.paddingY) / backend.metrics.cellHeight
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (backend *Backend) cellSubImage (x, y int) (cell *xgraphics.Image) {
|
|
|
|
func (backend *Backend) cellSubImage (x, y int) (cell *xgraphics.Image) {
|
|
|
|
cell = backend.canvas.SubImage(backend.boundsOfCell(x, y)).(*xgraphics.Image)
|
|
|
|
cell = backend.canvas.SubImage(backend.boundsOfCell(x, y)).(*xgraphics.Image)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
@ -375,7 +396,7 @@ func factory (application *stone.Application) (output stone.Backend, err error)
|
|
|
|
// keyboard buttons (uncompressed)
|
|
|
|
// keyboard buttons (uncompressed)
|
|
|
|
err = backend.window.Listen (
|
|
|
|
err = backend.window.Listen (
|
|
|
|
xproto.EventMaskStructureNotify,
|
|
|
|
xproto.EventMaskStructureNotify,
|
|
|
|
// xproto.EventMaskPointerMotion,
|
|
|
|
xproto.EventMaskPointerMotion,
|
|
|
|
// xproto.EventMaskKeyPress,
|
|
|
|
// xproto.EventMaskKeyPress,
|
|
|
|
// xproto.EventMaskKeyRelease,
|
|
|
|
// xproto.EventMaskKeyRelease,
|
|
|
|
xproto.EventMaskButtonPress,
|
|
|
|
xproto.EventMaskButtonPress,
|
|
|