Package xevent

import "github.com/BurntSushi/xgbutil/xevent"
Overview
Index

Overview ▾

Package xevent provides an event handler interface for attaching callback functions to X events, and an implementation of an X event loop.

The X event loop

One of the biggest conveniences offered by xgbutil is its event handler system. That is, the ability to attach an arbitrary callback function to any X event. In order for such things to work, xgbutil needs to control the main X event loop and act as a dispatcher for all event handlers created by you.

To run the X event loop, use xevent.Main or xevent.MainPing. The former runs a normal event loop in the current goroutine and processes events. The latter runs the event loop in a new goroutine and returns a pingBefore and a pingAfter channel. The pingBefore channel is sent a benign value right before an event is dequeued, and the pingAfter channel is sent a benign value right after after all callbacks for that event have finished execution. These synchronization points in the main event loop can be combined with a 'select' statement to process data from other input sources. An example of this is given in the documentation for the MainPing function. A complete example called multiple-source-event-loop can also be found in the examples directory of the xgbutil package.

To quit the main event loop, you may use xevent.Quit, but there is nothing inherently wrong with stopping dead using os.Exit. xevent.Quit is provided for your convenience should you need to run any clean-up code after the main event loop returns.

The X event queue

xgbutil's event queue contains values that are either events or errors. (Never both and never neither.) Namely, errors are received in the event loop from unchecked requests. (Errors generated by checked requests are guaranteed to be returned to the caller and are never received in the event loop.) Also, a default error handler function can be set with xevent.ErrorHandlerSet.

To this end, xgbutil's event queue can be inspected. This is advantageous when information about what events will be processed in the future could be helpful (i.e., if there is an UnmapNotify event waiting to be processed.) The event queue can also be manipulated to facilitate event compression. (Two events that are common candidates for compression are ConfigureNotify and MotionNotify.)

Detach events

Whenever a window can no longer receive events (i.e., when it is destroyed), all event handlers related to that window should be detached. (If this is omitted, then Go's garbage collector will not be able to reuse memory occupied by the now-unused event handlers for that window.) Moreover, its possible that a window id can be reused after it has been discarded, which could result in odd behavior in your application.

To detach a window from all event handlers in the xevent package, use xevent.Detach. If you're also using the keybind and mousebind packages, you'll need to call keybind.Detach and mousebind.Detach too. So to detach your window from all possible event handlers in xgbutil, use something like:

xevent.Detach(XUtilValue, your-window-id)
keybind.Detach(XUtilValue, your-window-id)
mousebind.Detach(XUtilValue, your-window-id)

Quick example

A small example that shows how to respond to ConfigureNotify events sent to your-window-id.

xevent.ConfigureNotifyFun(
	func(X *xgbutil.XUtil, e xevent.ConfigureNotifyEvent) {
		fmt.Printf("(%d, %d) %dx%d\n", e.X, e.Y, e.Width, e.Height)
	}).Connect(XUtilValue, your-window-id)

More examples

The xevent package is used in several of the examples in the examples directory in the xgbutil package.

Index ▾

Constants
Variables
func Dequeue(xu *xgbutil.XUtil) (xgb.Event, xgb.Error)
func DequeueAt(xu *xgbutil.XUtil, i int)
func Detach(xu *xgbutil.XUtil, win xproto.Window)
func Empty(xu *xgbutil.XUtil) bool
func Enqueue(xu *xgbutil.XUtil, ev xgb.Event, err xgb.Error)
func ErrorHandlerGet(xu *xgbutil.XUtil) xgbutil.ErrorHandlerFun
func ErrorHandlerSet(xu *xgbutil.XUtil, fun xgbutil.ErrorHandlerFun)
func Main(xu *xgbutil.XUtil)
func MainPing(xu *xgbutil.XUtil) (chan struct{}, chan struct{}, chan struct{})
func Peek(xu *xgbutil.XUtil) []xgbutil.EventOrError
func Quit(xu *xgbutil.XUtil)
func Quitting(xu *xgbutil.XUtil) bool
func Read(xu *xgbutil.XUtil, block bool)
func RedirectKeyEvents(xu *xgbutil.XUtil, wid xproto.Window)
func RedirectKeyGet(xu *xgbutil.XUtil) xproto.Window
func ReplayPointer(xu *xgbutil.XUtil)
func SendRootEvent(xu *xgbutil.XUtil, ev xgb.Event, evMask uint32) error
type ButtonPressEvent
    func (ev ButtonPressEvent) String() string
type ButtonPressFun
    func (callback ButtonPressFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ButtonPressFun) Run(xu *xgbutil.XUtil, event interface{})
type ButtonReleaseEvent
    func (ev ButtonReleaseEvent) String() string
type ButtonReleaseFun
    func (callback ButtonReleaseFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ButtonReleaseFun) Run(xu *xgbutil.XUtil, event interface{})
type CirculateNotifyEvent
    func (ev CirculateNotifyEvent) String() string
type CirculateNotifyFun
    func (callback CirculateNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback CirculateNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type CirculateRequestEvent
    func (ev CirculateRequestEvent) String() string
type CirculateRequestFun
    func (callback CirculateRequestFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback CirculateRequestFun) Run(xu *xgbutil.XUtil, event interface{})
type ClientMessageEvent
    func NewClientMessage(Format byte, Window xproto.Window, Type xproto.Atom, data ...interface{}) (*ClientMessageEvent, error)
type ClientMessageFun
    func (callback ClientMessageFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ClientMessageFun) Run(xu *xgbutil.XUtil, event interface{})
type ColormapNotifyEvent
    func (ev ColormapNotifyEvent) String() string
type ColormapNotifyFun
    func (callback ColormapNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ColormapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type ConfigureNotifyEvent
    func NewConfigureNotify(Event, Window, AboveSibling xproto.Window, X, Y, Width, Height int, BorderWidth uint16, OverrideRedirect bool) *ConfigureNotifyEvent
type ConfigureNotifyFun
    func (callback ConfigureNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ConfigureNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type ConfigureRequestEvent
    func (ev ConfigureRequestEvent) String() string
type ConfigureRequestFun
    func (callback ConfigureRequestFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ConfigureRequestFun) Run(xu *xgbutil.XUtil, event interface{})
type CreateNotifyEvent
    func (ev CreateNotifyEvent) String() string
type CreateNotifyFun
    func (callback CreateNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback CreateNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type DestroyNotifyEvent
    func (ev DestroyNotifyEvent) String() string
type DestroyNotifyFun
    func (callback DestroyNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback DestroyNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type EnterNotifyEvent
    func (ev EnterNotifyEvent) String() string
type EnterNotifyFun
    func (callback EnterNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback EnterNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type ExposeEvent
    func (ev ExposeEvent) String() string
type ExposeFun
    func (callback ExposeFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ExposeFun) Run(xu *xgbutil.XUtil, event interface{})
type FocusInEvent
    func (ev FocusInEvent) String() string
type FocusInFun
    func (callback FocusInFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback FocusInFun) Run(xu *xgbutil.XUtil, event interface{})
type FocusOutEvent
    func (ev FocusOutEvent) String() string
type FocusOutFun
    func (callback FocusOutFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback FocusOutFun) Run(xu *xgbutil.XUtil, event interface{})
type GraphicsExposureEvent
    func (ev GraphicsExposureEvent) String() string
type GraphicsExposureFun
    func (callback GraphicsExposureFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback GraphicsExposureFun) Run(xu *xgbutil.XUtil, event interface{})
type GravityNotifyEvent
    func (ev GravityNotifyEvent) String() string
type GravityNotifyFun
    func (callback GravityNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback GravityNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type HookFun
    func (callback HookFun) Connect(xu *xgbutil.XUtil)
    func (callback HookFun) Run(xu *xgbutil.XUtil, event interface{}) bool
type KeyPressEvent
    func (ev KeyPressEvent) String() string
type KeyPressFun
    func (callback KeyPressFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback KeyPressFun) Run(xu *xgbutil.XUtil, event interface{})
type KeyReleaseEvent
    func (ev KeyReleaseEvent) String() string
type KeyReleaseFun
    func (callback KeyReleaseFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback KeyReleaseFun) Run(xu *xgbutil.XUtil, event interface{})
type KeymapNotifyEvent
    func (ev KeymapNotifyEvent) String() string
type KeymapNotifyFun
    func (callback KeymapNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback KeymapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type LeaveNotifyEvent
    func (ev LeaveNotifyEvent) String() string
type LeaveNotifyFun
    func (callback LeaveNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback LeaveNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type MapNotifyEvent
    func (ev MapNotifyEvent) String() string
type MapNotifyFun
    func (callback MapNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback MapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type MapRequestEvent
    func (ev MapRequestEvent) String() string
type MapRequestFun
    func (callback MapRequestFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback MapRequestFun) Run(xu *xgbutil.XUtil, event interface{})
type MappingNotifyEvent
    func (ev MappingNotifyEvent) String() string
type MappingNotifyFun
    func (callback MappingNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback MappingNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type MotionNotifyEvent
    func (ev MotionNotifyEvent) String() string
type MotionNotifyFun
    func (callback MotionNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback MotionNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type NoExposureEvent
    func (ev NoExposureEvent) String() string
type NoExposureFun
    func (callback NoExposureFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback NoExposureFun) Run(xu *xgbutil.XUtil, event interface{})
type PropertyNotifyEvent
    func (ev PropertyNotifyEvent) String() string
type PropertyNotifyFun
    func (callback PropertyNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback PropertyNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type ReparentNotifyEvent
    func (ev ReparentNotifyEvent) String() string
type ReparentNotifyFun
    func (callback ReparentNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ReparentNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type ResizeRequestEvent
    func (ev ResizeRequestEvent) String() string
type ResizeRequestFun
    func (callback ResizeRequestFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ResizeRequestFun) Run(xu *xgbutil.XUtil, event interface{})
type SelectionClearEvent
    func (ev SelectionClearEvent) String() string
type SelectionClearFun
    func (callback SelectionClearFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback SelectionClearFun) Run(xu *xgbutil.XUtil, event interface{})
type SelectionNotifyEvent
    func (ev SelectionNotifyEvent) String() string
type SelectionNotifyFun
    func (callback SelectionNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback SelectionNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type SelectionRequestEvent
    func (ev SelectionRequestEvent) String() string
type SelectionRequestFun
    func (callback SelectionRequestFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback SelectionRequestFun) Run(xu *xgbutil.XUtil, event interface{})
type ShapeNotifyEvent
    func (ev ShapeNotifyEvent) String() string
type ShapeNotifyFun
    func (callback ShapeNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback ShapeNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type UnmapNotifyEvent
    func (ev UnmapNotifyEvent) String() string
type UnmapNotifyFun
    func (callback UnmapNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback UnmapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})
type VisibilityNotifyEvent
    func (ev VisibilityNotifyEvent) String() string
type VisibilityNotifyFun
    func (callback VisibilityNotifyFun) Connect(xu *xgbutil.XUtil, win xproto.Window)
    func (callback VisibilityNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

Package files

callback.go doc.go eventloop.go types_auto.go types_manual.go xevent.go

Constants

const ButtonPress = xproto.ButtonPress
const ButtonRelease = xproto.ButtonRelease
const CirculateNotify = xproto.CirculateNotify
const CirculateRequest = xproto.CirculateRequest
const ClientMessage = xproto.ClientMessage
const ColormapNotify = xproto.ColormapNotify
const ConfigureNotify = xproto.ConfigureNotify
const ConfigureRequest = xproto.ConfigureRequest
const CreateNotify = xproto.CreateNotify
const DestroyNotify = xproto.DestroyNotify
const EnterNotify = xproto.EnterNotify
const Expose = xproto.Expose
const FocusIn = xproto.FocusIn
const FocusOut = xproto.FocusOut
const GraphicsExposure = xproto.GraphicsExposure
const GravityNotify = xproto.GravityNotify
const KeyPress = xproto.KeyPress
const KeyRelease = xproto.KeyRelease
const KeymapNotify = xproto.KeymapNotify
const LeaveNotify = xproto.LeaveNotify
const MapNotify = xproto.MapNotify
const MapRequest = xproto.MapRequest
const MappingNotify = xproto.MappingNotify
const MotionNotify = xproto.MotionNotify
const NoExposure = xproto.NoExposure
const PropertyNotify = xproto.PropertyNotify
const ReparentNotify = xproto.ReparentNotify
const ResizeRequest = xproto.ResizeRequest
const SelectionClear = xproto.SelectionClear
const SelectionNotify = xproto.SelectionNotify
const SelectionRequest = xproto.SelectionRequest
const ShapeNotify = shape.Notify
const UnmapNotify = xproto.UnmapNotify
const VisibilityNotify = xproto.VisibilityNotify

Variables

var IgnoreMods []uint16 = []uint16{
    0,
    xproto.ModMaskLock,
    xproto.ModMask2,
    xproto.ModMaskLock | xproto.ModMask2,
}

IgnoreMods is a list of X modifiers that we don't want interfering with our mouse or key bindings. In particular, for each mouse or key binding issued, there is a seperate mouse or key binding made for each of the modifiers specified.

You may modify this slice to add (or remove) modifiers, but it should be done before *any* key or mouse bindings are attached with the keybind and mousebind packages. It should not be modified afterwards.

TODO: We're assuming numlock is in the 'mod2' modifier, which is a pretty common setup, but by no means guaranteed. This should be modified to actually inspect the modifiers table and look for the special Num_Lock keysym.

var NoWindow xproto.Window = 0

Sometimes we need to specify NO WINDOW when a window is typically expected. (Like connecting to MappingNotify or KeymapNotify events.) Use this value to do that.

func Dequeue

func Dequeue(xu *xgbutil.XUtil) (xgb.Event, xgb.Error)

Dequeue pops an event/error from the queue and returns it. The queue item is unwrapped and returned as multiple return values. Only one of the return values can be nil.

func DequeueAt

func DequeueAt(xu *xgbutil.XUtil, i int)

DequeueAt removes a particular item from the queue. This is primarily useful when attempting to compress events.

func Detach

func Detach(xu *xgbutil.XUtil, win xproto.Window)

Detach removes all callbacks associated with a particular window. Note that if you're also using the keybind and mousebind packages, a complete detachment should look like:

keybind.Detach(XUtilValue, window-id)
mousebind.Detach(XUtilValue, window-id)
xevent.Detach(XUtilValue, window-id)

If a window is no longer receiving events, these methods should be called. Otherwise, the memory used to store the handler info for that window will never be released.

func Empty

func Empty(xu *xgbutil.XUtil) bool

Empty returns whether the event queue is empty or not.

func Enqueue

func Enqueue(xu *xgbutil.XUtil, ev xgb.Event, err xgb.Error)

Enqueue queues up an event read from X. Note that an event read may return an error, in which case, this queue entry will be an error and not an event.

ev, err := XUtilValue.Conn().WaitForEvent()
xevent.Enqueue(XUtilValue, ev, err)

You probably shouldn't have to enqueue events yourself. This is done automatically if you're using xevent.Main{Ping} and/or xevent.Read.

func ErrorHandlerGet

func ErrorHandlerGet(xu *xgbutil.XUtil) xgbutil.ErrorHandlerFun

ErrorHandlerGet retrieves the default error handler.

func ErrorHandlerSet

func ErrorHandlerSet(xu *xgbutil.XUtil, fun xgbutil.ErrorHandlerFun)

ErrorHandlerSet sets the default error handler for errors that come into the main event loop. (This may be removed in the future in favor of a particular callback interface like events, but these sorts of errors aren't handled often in practice, so maybe not.) This is only called for errors returned from unchecked (asynchronous error handling) requests. The default error handler just emits them to stderr.

func Main

func Main(xu *xgbutil.XUtil)

Main starts the main X event loop. It will read events and call appropriate callback functions. N.B. If you have multiple X connections in the same program, you should be able to run this in different goroutines concurrently. However, only *one* of these should run for *each* connection.

func MainPing

func MainPing(xu *xgbutil.XUtil) (chan struct{}, chan struct{}, chan struct{})

MainPing starts the main X event loop, and returns three "ping" channels: the first is pinged before an event is dequeued, the second is pinged after all callbacks for a particular event have been called and the last is pinged when the event loop stops (e.g., after a call to xevent.Quit). pingAfter channel.

This is useful if your event loop needs to draw from other sources. e.g.,

pingBefore, pingAfter, pingQuit := xevent.MainPing()
for {
	select {
	case <-pingBefore:
		// Wait for event processing to finish.
		<-pingAfter
	case val <- someOtherChannel:
		// do some work with val
	case <-pingQuit:
		fmt.Printf("xevent loop has quit")
		return
	}
}

Note that an unbuffered channel is returned, which implies that any work done with 'val' will delay further X event processing.

A complete example using MainPing can be found in the examples directory in the xgbutil package under the name multiple-source-event-loop.

func Peek

func Peek(xu *xgbutil.XUtil) []xgbutil.EventOrError

Peek returns a *copy* of the current queue so we can examine it. This can be useful when trying to determine if a particular kind of event will be processed in the future.

func Quit

func Quit(xu *xgbutil.XUtil)

Quit elegantly exits out of the main event loop. "Elegantly" in this case means that it finishes processing the current event, and breaks out of the loop afterwards. There is no particular reason to use this instead of something like os.Exit other than you might have code to run after the main event loop exits to "clean up."

func Quitting

func Quitting(xu *xgbutil.XUtil) bool

Quitting returns whether it's time to quit. This is only used in the main event loop in xevent.

func Read

func Read(xu *xgbutil.XUtil, block bool)

Read reads one or more events and queues them in XUtil. If 'block' is True, then call 'WaitForEvent' before sucking up all events that have been queued by XGB.

func RedirectKeyEvents

func RedirectKeyEvents(xu *xgbutil.XUtil, wid xproto.Window)

RedirectKeyEvents, when set to a window id (greater than 0), will force *all* Key{Press,Release} to callbacks attached to the specified window. This is close to emulating a Keyboard grab without the racing. To stop redirecting key events, use window identifier '0'.

func RedirectKeyGet

func RedirectKeyGet(xu *xgbutil.XUtil) xproto.Window

RedirectKeyGet gets the window that key events are being redirected to. If 0, then no redirection occurs.

func ReplayPointer

func ReplayPointer(xu *xgbutil.XUtil)

ReplayPointer is a quick alias to AllowEvents with 'ReplayPointer' mode.

func SendRootEvent

func SendRootEvent(xu *xgbutil.XUtil, ev xgb.Event, evMask uint32) error

SendRootEvent takes a type implementing the xgb.Event interface, converts it to raw X bytes, and sends it to the root window using the SendEvent request.

type ButtonPressEvent

type ButtonPressEvent struct {
    *xproto.ButtonPressEvent
}

func (ButtonPressEvent) String

func (ev ButtonPressEvent) String() string

type ButtonPressFun

type ButtonPressFun func(xu *xgbutil.XUtil, event ButtonPressEvent)

func (ButtonPressFun) Connect

func (callback ButtonPressFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ButtonPressFun) Run

func (callback ButtonPressFun) Run(xu *xgbutil.XUtil, event interface{})

type ButtonReleaseEvent

type ButtonReleaseEvent struct {
    *xproto.ButtonReleaseEvent
}

func (ButtonReleaseEvent) String

func (ev ButtonReleaseEvent) String() string

type ButtonReleaseFun

type ButtonReleaseFun func(xu *xgbutil.XUtil, event ButtonReleaseEvent)

func (ButtonReleaseFun) Connect

func (callback ButtonReleaseFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ButtonReleaseFun) Run

func (callback ButtonReleaseFun) Run(xu *xgbutil.XUtil, event interface{})

type CirculateNotifyEvent

type CirculateNotifyEvent struct {
    *xproto.CirculateNotifyEvent
}

func (CirculateNotifyEvent) String

func (ev CirculateNotifyEvent) String() string

type CirculateNotifyFun

type CirculateNotifyFun func(xu *xgbutil.XUtil, event CirculateNotifyEvent)

func (CirculateNotifyFun) Connect

func (callback CirculateNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (CirculateNotifyFun) Run

func (callback CirculateNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type CirculateRequestEvent

type CirculateRequestEvent struct {
    *xproto.CirculateRequestEvent
}

func (CirculateRequestEvent) String

func (ev CirculateRequestEvent) String() string

type CirculateRequestFun

type CirculateRequestFun func(xu *xgbutil.XUtil, event CirculateRequestEvent)

func (CirculateRequestFun) Connect

func (callback CirculateRequestFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (CirculateRequestFun) Run

func (callback CirculateRequestFun) Run(xu *xgbutil.XUtil, event interface{})

type ClientMessageEvent

type ClientMessageEvent struct {
    *xproto.ClientMessageEvent
}

ClientMessageEvent embeds the struct by the same name from the xgb library.

func NewClientMessage

func NewClientMessage(Format byte, Window xproto.Window, Type xproto.Atom,
    data ...interface{}) (*ClientMessageEvent, error)

NewClientMessage takes all arguments required to build a ClientMessageEvent struct and hides the messy details. The variadic parameters coincide with the "data" part of a client message. The type of the variadic parameters depends upon the value of Format. If Format is 8, 'data' should have type byte. If Format is 16, 'data' should have type int16. If Format is 32, 'data' should have type int. Any other value of Format returns an error.

type ClientMessageFun

type ClientMessageFun func(xu *xgbutil.XUtil, event ClientMessageEvent)

func (ClientMessageFun) Connect

func (callback ClientMessageFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ClientMessageFun) Run

func (callback ClientMessageFun) Run(xu *xgbutil.XUtil, event interface{})

type ColormapNotifyEvent

type ColormapNotifyEvent struct {
    *xproto.ColormapNotifyEvent
}

func (ColormapNotifyEvent) String

func (ev ColormapNotifyEvent) String() string

type ColormapNotifyFun

type ColormapNotifyFun func(xu *xgbutil.XUtil, event ColormapNotifyEvent)

func (ColormapNotifyFun) Connect

func (callback ColormapNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ColormapNotifyFun) Run

func (callback ColormapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type ConfigureNotifyEvent

type ConfigureNotifyEvent struct {
    *xproto.ConfigureNotifyEvent
}

ConfigureNotifyEvent embeds the struct by the same name in XGB.

func NewConfigureNotify

func NewConfigureNotify(Event, Window, AboveSibling xproto.Window,
    X, Y, Width, Height int, BorderWidth uint16,
    OverrideRedirect bool) *ConfigureNotifyEvent

NewConfigureNotify takes all arguments required to build a ConfigureNotifyEvent struct and returns a ConfigureNotifyEvent value.

type ConfigureNotifyFun

type ConfigureNotifyFun func(xu *xgbutil.XUtil, event ConfigureNotifyEvent)

func (ConfigureNotifyFun) Connect

func (callback ConfigureNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ConfigureNotifyFun) Run

func (callback ConfigureNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type ConfigureRequestEvent

type ConfigureRequestEvent struct {
    *xproto.ConfigureRequestEvent
}

func (ConfigureRequestEvent) String

func (ev ConfigureRequestEvent) String() string

type ConfigureRequestFun

type ConfigureRequestFun func(xu *xgbutil.XUtil, event ConfigureRequestEvent)

func (ConfigureRequestFun) Connect

func (callback ConfigureRequestFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ConfigureRequestFun) Run

func (callback ConfigureRequestFun) Run(xu *xgbutil.XUtil, event interface{})

type CreateNotifyEvent

type CreateNotifyEvent struct {
    *xproto.CreateNotifyEvent
}

func (CreateNotifyEvent) String

func (ev CreateNotifyEvent) String() string

type CreateNotifyFun

type CreateNotifyFun func(xu *xgbutil.XUtil, event CreateNotifyEvent)

func (CreateNotifyFun) Connect

func (callback CreateNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (CreateNotifyFun) Run

func (callback CreateNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type DestroyNotifyEvent

type DestroyNotifyEvent struct {
    *xproto.DestroyNotifyEvent
}

func (DestroyNotifyEvent) String

func (ev DestroyNotifyEvent) String() string

type DestroyNotifyFun

type DestroyNotifyFun func(xu *xgbutil.XUtil, event DestroyNotifyEvent)

func (DestroyNotifyFun) Connect

func (callback DestroyNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (DestroyNotifyFun) Run

func (callback DestroyNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type EnterNotifyEvent

type EnterNotifyEvent struct {
    *xproto.EnterNotifyEvent
}

func (EnterNotifyEvent) String

func (ev EnterNotifyEvent) String() string

type EnterNotifyFun

type EnterNotifyFun func(xu *xgbutil.XUtil, event EnterNotifyEvent)

func (EnterNotifyFun) Connect

func (callback EnterNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (EnterNotifyFun) Run

func (callback EnterNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type ExposeEvent

type ExposeEvent struct {
    *xproto.ExposeEvent
}

func (ExposeEvent) String

func (ev ExposeEvent) String() string

type ExposeFun

type ExposeFun func(xu *xgbutil.XUtil, event ExposeEvent)

func (ExposeFun) Connect

func (callback ExposeFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ExposeFun) Run

func (callback ExposeFun) Run(xu *xgbutil.XUtil, event interface{})

type FocusInEvent

type FocusInEvent struct {
    *xproto.FocusInEvent
}

func (FocusInEvent) String

func (ev FocusInEvent) String() string

type FocusInFun

type FocusInFun func(xu *xgbutil.XUtil, event FocusInEvent)

func (FocusInFun) Connect

func (callback FocusInFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (FocusInFun) Run

func (callback FocusInFun) Run(xu *xgbutil.XUtil, event interface{})

type FocusOutEvent

type FocusOutEvent struct {
    *xproto.FocusOutEvent
}

func (FocusOutEvent) String

func (ev FocusOutEvent) String() string

type FocusOutFun

type FocusOutFun func(xu *xgbutil.XUtil, event FocusOutEvent)

func (FocusOutFun) Connect

func (callback FocusOutFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (FocusOutFun) Run

func (callback FocusOutFun) Run(xu *xgbutil.XUtil, event interface{})

type GraphicsExposureEvent

type GraphicsExposureEvent struct {
    *xproto.GraphicsExposureEvent
}

func (GraphicsExposureEvent) String

func (ev GraphicsExposureEvent) String() string

type GraphicsExposureFun

type GraphicsExposureFun func(xu *xgbutil.XUtil, event GraphicsExposureEvent)

func (GraphicsExposureFun) Connect

func (callback GraphicsExposureFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (GraphicsExposureFun) Run

func (callback GraphicsExposureFun) Run(xu *xgbutil.XUtil, event interface{})

type GravityNotifyEvent

type GravityNotifyEvent struct {
    *xproto.GravityNotifyEvent
}

func (GravityNotifyEvent) String

func (ev GravityNotifyEvent) String() string

type GravityNotifyFun

type GravityNotifyFun func(xu *xgbutil.XUtil, event GravityNotifyEvent)

func (GravityNotifyFun) Connect

func (callback GravityNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (GravityNotifyFun) Run

func (callback GravityNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type HookFun

type HookFun func(xu *xgbutil.XUtil, event interface{}) bool

func (HookFun) Connect

func (callback HookFun) Connect(xu *xgbutil.XUtil)

func (HookFun) Run

func (callback HookFun) Run(xu *xgbutil.XUtil, event interface{}) bool

type KeyPressEvent

type KeyPressEvent struct {
    *xproto.KeyPressEvent
}

func (KeyPressEvent) String

func (ev KeyPressEvent) String() string

type KeyPressFun

type KeyPressFun func(xu *xgbutil.XUtil, event KeyPressEvent)

func (KeyPressFun) Connect

func (callback KeyPressFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (KeyPressFun) Run

func (callback KeyPressFun) Run(xu *xgbutil.XUtil, event interface{})

type KeyReleaseEvent

type KeyReleaseEvent struct {
    *xproto.KeyReleaseEvent
}

func (KeyReleaseEvent) String

func (ev KeyReleaseEvent) String() string

type KeyReleaseFun

type KeyReleaseFun func(xu *xgbutil.XUtil, event KeyReleaseEvent)

func (KeyReleaseFun) Connect

func (callback KeyReleaseFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (KeyReleaseFun) Run

func (callback KeyReleaseFun) Run(xu *xgbutil.XUtil, event interface{})

type KeymapNotifyEvent

type KeymapNotifyEvent struct {
    *xproto.KeymapNotifyEvent
}

func (KeymapNotifyEvent) String

func (ev KeymapNotifyEvent) String() string

type KeymapNotifyFun

type KeymapNotifyFun func(xu *xgbutil.XUtil, event KeymapNotifyEvent)

func (KeymapNotifyFun) Connect

func (callback KeymapNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (KeymapNotifyFun) Run

func (callback KeymapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type LeaveNotifyEvent

type LeaveNotifyEvent struct {
    *xproto.LeaveNotifyEvent
}

func (LeaveNotifyEvent) String

func (ev LeaveNotifyEvent) String() string

type LeaveNotifyFun

type LeaveNotifyFun func(xu *xgbutil.XUtil, event LeaveNotifyEvent)

func (LeaveNotifyFun) Connect

func (callback LeaveNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (LeaveNotifyFun) Run

func (callback LeaveNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type MapNotifyEvent

type MapNotifyEvent struct {
    *xproto.MapNotifyEvent
}

func (MapNotifyEvent) String

func (ev MapNotifyEvent) String() string

type MapNotifyFun

type MapNotifyFun func(xu *xgbutil.XUtil, event MapNotifyEvent)

func (MapNotifyFun) Connect

func (callback MapNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (MapNotifyFun) Run

func (callback MapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type MapRequestEvent

type MapRequestEvent struct {
    *xproto.MapRequestEvent
}

func (MapRequestEvent) String

func (ev MapRequestEvent) String() string

type MapRequestFun

type MapRequestFun func(xu *xgbutil.XUtil, event MapRequestEvent)

func (MapRequestFun) Connect

func (callback MapRequestFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (MapRequestFun) Run

func (callback MapRequestFun) Run(xu *xgbutil.XUtil, event interface{})

type MappingNotifyEvent

type MappingNotifyEvent struct {
    *xproto.MappingNotifyEvent
}

func (MappingNotifyEvent) String

func (ev MappingNotifyEvent) String() string

type MappingNotifyFun

type MappingNotifyFun func(xu *xgbutil.XUtil, event MappingNotifyEvent)

func (MappingNotifyFun) Connect

func (callback MappingNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (MappingNotifyFun) Run

func (callback MappingNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type MotionNotifyEvent

type MotionNotifyEvent struct {
    *xproto.MotionNotifyEvent
}

func (MotionNotifyEvent) String

func (ev MotionNotifyEvent) String() string

type MotionNotifyFun

type MotionNotifyFun func(xu *xgbutil.XUtil, event MotionNotifyEvent)

func (MotionNotifyFun) Connect

func (callback MotionNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (MotionNotifyFun) Run

func (callback MotionNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type NoExposureEvent

type NoExposureEvent struct {
    *xproto.NoExposureEvent
}

func (NoExposureEvent) String

func (ev NoExposureEvent) String() string

type NoExposureFun

type NoExposureFun func(xu *xgbutil.XUtil, event NoExposureEvent)

func (NoExposureFun) Connect

func (callback NoExposureFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (NoExposureFun) Run

func (callback NoExposureFun) Run(xu *xgbutil.XUtil, event interface{})

type PropertyNotifyEvent

type PropertyNotifyEvent struct {
    *xproto.PropertyNotifyEvent
}

func (PropertyNotifyEvent) String

func (ev PropertyNotifyEvent) String() string

type PropertyNotifyFun

type PropertyNotifyFun func(xu *xgbutil.XUtil, event PropertyNotifyEvent)

func (PropertyNotifyFun) Connect

func (callback PropertyNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (PropertyNotifyFun) Run

func (callback PropertyNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type ReparentNotifyEvent

type ReparentNotifyEvent struct {
    *xproto.ReparentNotifyEvent
}

func (ReparentNotifyEvent) String

func (ev ReparentNotifyEvent) String() string

type ReparentNotifyFun

type ReparentNotifyFun func(xu *xgbutil.XUtil, event ReparentNotifyEvent)

func (ReparentNotifyFun) Connect

func (callback ReparentNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ReparentNotifyFun) Run

func (callback ReparentNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type ResizeRequestEvent

type ResizeRequestEvent struct {
    *xproto.ResizeRequestEvent
}

func (ResizeRequestEvent) String

func (ev ResizeRequestEvent) String() string

type ResizeRequestFun

type ResizeRequestFun func(xu *xgbutil.XUtil, event ResizeRequestEvent)

func (ResizeRequestFun) Connect

func (callback ResizeRequestFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ResizeRequestFun) Run

func (callback ResizeRequestFun) Run(xu *xgbutil.XUtil, event interface{})

type SelectionClearEvent

type SelectionClearEvent struct {
    *xproto.SelectionClearEvent
}

func (SelectionClearEvent) String

func (ev SelectionClearEvent) String() string

type SelectionClearFun

type SelectionClearFun func(xu *xgbutil.XUtil, event SelectionClearEvent)

func (SelectionClearFun) Connect

func (callback SelectionClearFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (SelectionClearFun) Run

func (callback SelectionClearFun) Run(xu *xgbutil.XUtil, event interface{})

type SelectionNotifyEvent

type SelectionNotifyEvent struct {
    *xproto.SelectionNotifyEvent
}

func (SelectionNotifyEvent) String

func (ev SelectionNotifyEvent) String() string

type SelectionNotifyFun

type SelectionNotifyFun func(xu *xgbutil.XUtil, event SelectionNotifyEvent)

func (SelectionNotifyFun) Connect

func (callback SelectionNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (SelectionNotifyFun) Run

func (callback SelectionNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type SelectionRequestEvent

type SelectionRequestEvent struct {
    *xproto.SelectionRequestEvent
}

func (SelectionRequestEvent) String

func (ev SelectionRequestEvent) String() string

type SelectionRequestFun

type SelectionRequestFun func(xu *xgbutil.XUtil, event SelectionRequestEvent)

func (SelectionRequestFun) Connect

func (callback SelectionRequestFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (SelectionRequestFun) Run

func (callback SelectionRequestFun) Run(xu *xgbutil.XUtil, event interface{})

type ShapeNotifyEvent

type ShapeNotifyEvent struct {
    *shape.NotifyEvent
}

func (ShapeNotifyEvent) String

func (ev ShapeNotifyEvent) String() string

type ShapeNotifyFun

type ShapeNotifyFun func(xu *xgbutil.XUtil, event ShapeNotifyEvent)

func (ShapeNotifyFun) Connect

func (callback ShapeNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (ShapeNotifyFun) Run

func (callback ShapeNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type UnmapNotifyEvent

type UnmapNotifyEvent struct {
    *xproto.UnmapNotifyEvent
}

func (UnmapNotifyEvent) String

func (ev UnmapNotifyEvent) String() string

type UnmapNotifyFun

type UnmapNotifyFun func(xu *xgbutil.XUtil, event UnmapNotifyEvent)

func (UnmapNotifyFun) Connect

func (callback UnmapNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (UnmapNotifyFun) Run

func (callback UnmapNotifyFun) Run(xu *xgbutil.XUtil, event interface{})

type VisibilityNotifyEvent

type VisibilityNotifyEvent struct {
    *xproto.VisibilityNotifyEvent
}

func (VisibilityNotifyEvent) String

func (ev VisibilityNotifyEvent) String() string

type VisibilityNotifyFun

type VisibilityNotifyFun func(xu *xgbutil.XUtil, event VisibilityNotifyEvent)

func (VisibilityNotifyFun) Connect

func (callback VisibilityNotifyFun) Connect(xu *xgbutil.XUtil,
    win xproto.Window)

func (VisibilityNotifyFun) Run

func (callback VisibilityNotifyFun) Run(xu *xgbutil.XUtil, event interface{})