Beispiel #1
0
// SendEvent sends an event to a widget.
func sendEvent(dest sparta.Widget, comm sparta.CommandEvent) {
	dwin := dest.Window().(*window)
	var id w32.HWND
	if comm.Source != nil {
		id = comm.Source.Window().(*window).id
	}
	w32.PostMessage(dwin.id, w32.WM_USER, uintptr(id), uintptr(comm.Value))
}
Beispiel #2
0
// SendEvent sends an event to the window.
func sendEvent(dest sparta.Widget, comm sparta.CommandEvent) {
	dwin := dest.Window().(*window)
	var id xgb.Id
	if comm.Source != nil {
		id = comm.Source.Window().(*window).id
	}
	event := make([]byte, 32)
	event[0] = xgb.ClientMessage // id of the event
	event[1] = 32                // format
	put32(event[4:], uint32(dwin.id))
	put32(event[8:], uint32(atomMsg))     // message type (client message)
	put32(event[12:], uint32(id))         // sender of the event
	put32(event[16:], uint32(comm.Value)) // value of the event
	xwin.SendEvent(false, dwin.id, 0, event)
}