Example #1
0
func newClient(X *xgbutil.XUtil, id xproto.Window) *client {
	X.Grab()
	defer X.Ungrab()

	if client := wingo.findManagedClient(id); client != nil {
		logger.Message.Printf("Already managing client: %s", client)
		return nil
	}

	win := xwindow.New(X, id)
	if _, err := win.Geometry(); err != nil {
		logger.Warning.Printf("Could not manage client %d because: %s", id, err)
		return nil
	}

	c := &client{
		X:           X,
		win:         win,
		name:        "N/A",
		state:       frame.Inactive,
		layer:       stack.LayerDefault,
		maximized:   false,
		iconified:   false,
		unmapIgnore: 0,
		floating:    false,
	}

	c.manage()
	if !c.iconified {
		c.Map()
		if c.primaryType == clientTypeNormal {
			focus.Focus(c)
		}
	}
	return c
}