func Focus(c Client) { Remove(c) if c.CanFocus() || c.SendFocusNotify() { Clients = append(Clients, c) c.PrepareForFocus() c.Focused() } if c.CanFocus() { c.Win().Focus() } if c.SendFocusNotify() { protsAtm, err := xprop.Atm(X, "WM_PROTOCOLS") if err != nil { logger.Warning.Println(err) return } takeFocusAtm, err := xprop.Atm(X, "WM_TAKE_FOCUS") if err != nil { logger.Warning.Println(err) return } cm, err := xevent.NewClientMessage(32, c.Id(), protsAtm, int(takeFocusAtm), int(X.TimeGet())) if err != nil { logger.Warning.Println(err) return } xproto.SendEvent(X.Conn(), false, c.Id(), 0, string(cm.Bytes())) } }
func (c *Client) sendConfigureNotify() { geom := c.Frame().Geom() ev := xproto.ConfigureNotifyEvent{ Event: c.Id(), Window: c.Id(), AboveSibling: 0, X: int16(geom.X()), Y: int16(geom.Y()), Width: uint16(c.win.Geom.Width()), Height: uint16(c.win.Geom.Height()), BorderWidth: 0, OverrideRedirect: false, } xproto.SendEvent(wm.X.Conn(), false, c.Id(), xproto.EventMaskStructureNotify, string(ev.Bytes())) }
// announce sends a ClientMessage event to the root window to let everyone // know that Wingo is the boss. (As per ICCCM 2.8.) func announce(X *xgbutil.XUtil) { typAtom, err := xprop.Atm(X, "MANAGER") if err != nil { logger.Warning.Println(err) return } manSelAtom, err := managerAtom(X) if err != nil { logger.Warning.Println(err) return } cm, err := xevent.NewClientMessage(32, X.RootWin(), typAtom, int(X.TimeGet()), int(manSelAtom), int(X.Dummy())) xproto.SendEvent(X.Conn(), false, X.RootWin(), xproto.EventMaskStructureNotify, string(cm.Bytes())) }
func (sock *XEmbedSocket) sendMessage(msg XEmbedMessage, detail, data1, data2 int) (err error) { if xembedAtom == 0 { xembedAtom, err = xprop.Atom(sock.X, "_XEMBED", false) if err != nil { return } } clientMsg, err := xevent.NewClientMessage(32, sock.id, xembedAtom, detail, data1, data2) if err == nil { xproto.SendEvent(sock.X.Conn(), false, sock.id, xproto.EventMaskNoEvent, string(clientMsg.Bytes())) } return }