| 1956 | ) |
| 1957 | } |
| 1958 | func (wm *WindowManager) OnEnterNotify(event xproto.EnterNotifyEvent) { |
| 1959 | // set focus when we enter a window and change border color |
| 1960 | err := xproto.SetInputFocusChecked(wm.conn, xproto.InputFocusPointerRoot, event.Event, xproto.TimeCurrentTime).Check() |
| 1961 | Col := wm.config.BorderActive |
| 1962 | err = xproto.ChangeWindowAttributesChecked( |
| 1963 | wm.conn, |
| 1964 | event.Event, |
| 1965 | xproto.CwBackPixel|xproto.CwBorderPixel, |
| 1966 | []uint32{ |
| 1967 | Col, // background |
| 1968 | Col, // border color |
| 1969 | }, |
| 1970 | ).Check() |
| 1971 | if err != nil { |
| 1972 | slog.Error("couldn't set focus on window", "error:", err) |
| 1973 | } |
| 1974 | wm.setNetActiveWindow(event.Event) |
| 1975 | } |
| 1976 | |
| 1977 | func (wm *WindowManager) findWindow(window xproto.Window) (bool, int, xproto.Window) { |
| 1978 | // look through all workspaces and windows to find a window (this is for if a window is deleted by a window from another workspace, we need to search for it) |