Esempio n. 1
0
// Shortcut for executing Client interface functions that have no parameters
// and no return values on the currently focused window.
func withFocused(f func(c *client)) {
	focused := focus.Current()
	if focused != nil {
		if client, ok := focused.(*client); ok {
			f(client)
		}
	}
}
Esempio n. 2
0
func (c *client) cbUnmapNotify() xevent.UnmapNotifyFun {
	f := func(X *xgbutil.XUtil, ev xevent.UnmapNotifyEvent) {
		// If a client has "iconified" set to true and we get an UnmapNotify
		// event, then that means we need to switch focus to the next window
		// in the focus stack.
		if c.iconified && focus.Current().Id() == c.Id() {
			wingo.focusFallback()
		}

		// When a client issues an Unmap request, the window manager should
		// unmanage it. However, when wingo unmaps the window, we shouldn't
		// unmanage it. Thus, every time wingo unmaps the window, the
		// unmapIgnore counter is incremented. Only when it is zero does it mean
		// that we should unmanage the client (i.e., the unmap request came
		// from somewhere other than Wingo.)
		if c.unmapIgnore > 0 {
			c.unmapIgnore--
			return
		}
		c.unmanage()
	}
	return xevent.UnmapNotifyFun(f)
}