示例#1
0
文件: pointer.go 项目: wSCP/scpwm-old
func (m *MotionRecorder) update() {
	geo, _ := xproto.GetGeometry(m.Window.Conn, xproto.Drawable(m.root)).Reply()

	if geo != nil {
		m.Resize(geo.Width, geo.Height)
	}
}
示例#2
0
// RawGeometry isn't smart. It just queries the window given for geometry.
func RawGeometry(xu *xgbutil.XUtil, win xproto.Drawable) (xrect.Rect, error) {
	xgeom, err := xproto.GetGeometry(xu.Conn(), win).Reply()
	if err != nil {
		return nil, err
	}
	return xrect.New(int(xgeom.X), int(xgeom.Y),
		int(xgeom.Width), int(xgeom.Height)), nil
}
示例#3
0
文件: xrace.go 项目: droundy/xgbutil
func main() {
	sleepy := time.Millisecond
	X, _ := xgbutil.NewConn()
	conn := X.Conn()

	aDesktop := "_NET_WM_DESKTOP"
	aActive := "_NET_ACTIVE_WINDOW"

	xwindow.Listen(X, X.RootWin(), xproto.EventMaskPropertyChange)
	xevent.PropertyNotifyFun(
		func(X *xgbutil.XUtil, ev xevent.PropertyNotifyEvent) {
			for i := 0; i < 1; i++ {
				log.Println("PROPERTY CHANGE")
			}
		}).Connect(X, X.RootWin())

	go func() {
		for {
			reply, err := xproto.InternAtom(conn, true, uint16(len(aDesktop)),
				aDesktop).Reply()
			if err != nil {
				log.Fatal(err)
			}

			log.Println("A1-299", reply.Sequence, reply.Atom)
			time.Sleep(sleepy)
		}
	}()

	go func() {
		for {
			reply, err := xproto.InternAtom(conn, true, uint16(len(aActive)),
				aActive).Reply()
			if err != nil {
				log.Fatal(err)
			}

			log.Println("A2-294", reply.Sequence, reply.Atom)
			time.Sleep(sleepy)
		}
	}()

	go func() {
		for {
			reply, err := xproto.GetGeometry(conn, 0x1).Reply()
			if err != nil {
				log.Println("0x1:", err)
			} else {
				log.Println("0x1:", reply)
			}
			time.Sleep(sleepy)
		}
	}()

	go func() {
		for {
			reply, err := xproto.GetGeometry(conn, 0x2).Reply()
			if err != nil {
				log.Println("0x2:", err)
			} else {
				log.Println("0x2:", reply)
			}
			time.Sleep(sleepy)
		}
	}()

	go xevent.Main(X)
	select {}
}