| 497 | } |
| 498 | |
| 499 | func (wm *WindowManager) pointerToWindow(window xproto.Window) error { |
| 500 | geom, err := xproto.GetGeometry(wm.conn, xproto.Drawable(window)).Reply() |
| 501 | if err != nil { |
| 502 | return err |
| 503 | } |
| 504 | |
| 505 | trans, err := xproto.TranslateCoordinates(wm.conn, window, xproto.Setup(wm.conn).DefaultScreen(wm.conn).Root, 0, 0).Reply() |
| 506 | if err != nil { |
| 507 | return err |
| 508 | } |
| 509 | |
| 510 | x := int16(trans.DstX) + int16(geom.Width)/2 |
| 511 | y := int16(trans.DstY) + int16(geom.Height)/2 |
| 512 | |
| 513 | return xproto.WarpPointerChecked(wm.conn, 0, xproto.Setup(wm.conn).DefaultScreen(wm.conn).Root, 0, 0, 0, 0, x, y).Check() |
| 514 | } |
| 515 | |
| 516 | func (wm *WindowManager) Run() { |
| 517 | fmt.Println("window manager up and running") |