本文整理匯總了Golang中github.com/Nightgunner5/xgbutil.XUtil.Dummy方法的典型用法代碼示例。如果您正苦於以下問題:Golang XUtil.Dummy方法的具體用法?Golang XUtil.Dummy怎麽用?Golang XUtil.Dummy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Nightgunner5/xgbutil.XUtil
的用法示例。
在下文中一共展示了XUtil.Dummy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Drag
// Drag is the public interface that will make the appropriate connections
// to register a drag event for three functions: the begin function, the
// step function and the end function.
// The 'grabwin' is the window that the grab is placed on (and therefore the
// window where all button events are redirected to after the drag has started),
// and the 'win' is the window that the initial 'begin' callback is set on.
// In typical use cases, these windows should be the same.
// If 'grab' is false, then no pointer grab is issued.
func Drag(xu *xgbutil.XUtil, grabwin xproto.Window, win xproto.Window,
buttonStr string, grab bool,
begin xgbutil.MouseDragBeginFun, step xgbutil.MouseDragFun,
end xgbutil.MouseDragFun) {
ButtonPressFun(
func(xu *xgbutil.XUtil, ev xevent.ButtonPressEvent) {
dragBegin(xu, ev, grabwin, win, begin, step, end)
}).Connect(xu, win, buttonStr, false, grab)
// If the grab win isn't the dummy, then setup event handlers for the
// grab window.
if grabwin != xu.Dummy() {
xevent.MotionNotifyFun(dragStep).Connect(xu, grabwin)
xevent.ButtonReleaseFun(dragEnd).Connect(xu, grabwin)
}
}
示例2: DummyGrab
// DummyGrab grabs the keyboard and sends all key events to the dummy window.
func DummyGrab(xu *xgbutil.XUtil) error {
return SmartGrab(xu, xu.Dummy())
}
示例3: Initialize
// Initialize attaches the appropriate callbacks to make mouse bindings easier.
// i.e., prep the dummy window to handle mouse dragging events
func Initialize(xu *xgbutil.XUtil) {
xevent.MotionNotifyFun(dragStep).Connect(xu, xu.Dummy())
xevent.ButtonReleaseFun(dragEnd).Connect(xu, xu.Dummy())
}