Exemplo n.º 1
0
// Write request to wire for Offset
// offsetRequest writes a Offset request to a byte slice.
func offsetRequest(c *xgb.Conn, buf []byte, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16) []byte {
	size := 16
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 4 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	buf[b] = byte(DestinationKind)
	b += 1

	b += 3 // padding

	xgb.Put32(buf[b:], uint32(DestinationWindow))
	b += 4

	xgb.Put16(buf[b:], uint16(XOffset))
	b += 2

	xgb.Put16(buf[b:], uint16(YOffset))
	b += 2

	return buf
}
Exemplo n.º 2
0
// Write request to wire for QueryVersion
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn, buf []byte, MajorVersion uint16, MinorVersion uint16) []byte {
	size := 8
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["RECORD"]
	b += 1

	buf[b] = 0 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put16(buf[b:], MajorVersion)
	b += 2

	xgb.Put16(buf[b:], MinorVersion)
	b += 2

	return buf
}
Exemplo n.º 3
0
// Bytes writes a Range16 value to a byte slice.
func (v Range16) Bytes() []byte {
	buf := make([]byte, 4)
	b := 0

	xgb.Put16(buf[b:], v.First)
	b += 2

	xgb.Put16(buf[b:], v.Last)
	b += 2

	return buf
}
Exemplo n.º 4
0
// Write request to wire for GetImage
// getImageRequest writes a GetImage request to a byte slice.
func getImageRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32, Format byte, Shmseg Seg, Offset uint32) []byte {
	size := 32
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["MIT-SHM"]
	b += 1

	buf[b] = 4 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put16(buf[b:], uint16(X))
	b += 2

	xgb.Put16(buf[b:], uint16(Y))
	b += 2

	xgb.Put16(buf[b:], Width)
	b += 2

	xgb.Put16(buf[b:], Height)
	b += 2

	xgb.Put32(buf[b:], PlaneMask)
	b += 4

	buf[b] = Format
	b += 1

	b += 3 // padding

	xgb.Put32(buf[b:], uint32(Shmseg))
	b += 4

	xgb.Put32(buf[b:], Offset)
	b += 4

	return buf
}
Exemplo n.º 5
0
// Write request to wire for GetRectangles
// getRectanglesRequest writes a GetRectangles request to a byte slice.
func getRectanglesRequest(c *xgb.Conn, buf []byte, Window xproto.Window, SourceKind Kind) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 8 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	buf[b] = byte(SourceKind)
	b += 1

	b += 3 // padding

	return buf
}
Exemplo n.º 6
0
// Write request to wire for GetBuffers
// getBuffersRequest writes a GetBuffers request to a byte slice.
func getBuffersRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, Count uint32, Attachments []uint32) []byte {
	size := xgb.Pad((12 + xgb.Pad((len(Attachments) * 4))))
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 5 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], Count)
	b += 4

	for i := 0; i < int(len(Attachments)); i++ {
		xgb.Put32(buf[b:], Attachments[i])
		b += 4
	}
	b = xgb.Pad(b)

	return buf
}
Exemplo n.º 7
0
// Write request to wire for Authenticate
// authenticateRequest writes a Authenticate request to a byte slice.
func authenticateRequest(c *xgb.Conn, buf []byte, Window xproto.Window, Magic uint32) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 2 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	xgb.Put32(buf[b:], Magic)
	b += 4

	return buf
}
Exemplo n.º 8
0
// Write request to wire for GetParam
// getParamRequest writes a GetParam request to a byte slice.
func getParamRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, Param uint32) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 13 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], Param)
	b += 4

	return buf
}
Exemplo n.º 9
0
// Write request to wire for WaitSBC
// waitSBCRequest writes a WaitSBC request to a byte slice.
func waitSBCRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) []byte {
	size := 16
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 11 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], TargetSbcHi)
	b += 4

	xgb.Put32(buf[b:], TargetSbcLo)
	b += 4

	return buf
}
Exemplo n.º 10
0
// Write request to wire for CopyRegion
// copyRegionRequest writes a CopyRegion request to a byte slice.
func copyRegionRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, Region uint32, Dest uint32, Src uint32) []byte {
	size := 20
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], Region)
	b += 4

	xgb.Put32(buf[b:], Dest)
	b += 4

	xgb.Put32(buf[b:], Src)
	b += 4

	return buf
}
Exemplo n.º 11
0
// Write request to wire for QueryVersion
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn, buf []byte, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["COMPOSITE"]
	b += 1

	buf[b] = 0 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], ClientMajorVersion)
	b += 4

	xgb.Put32(buf[b:], ClientMinorVersion)
	b += 4

	return buf
}
Exemplo n.º 12
0
// Write request to wire for Attach
// attachRequest writes a Attach request to a byte slice.
func attachRequest(c *xgb.Conn, buf []byte, Shmseg Seg, Shmid uint32, ReadOnly bool) []byte {
	size := 16
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["MIT-SHM"]
	b += 1

	buf[b] = 1 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Shmseg))
	b += 4

	xgb.Put32(buf[b:], Shmid)
	b += 4

	if ReadOnly {
		buf[b] = 1
	} else {
		buf[b] = 0
	}
	b += 1

	b += 3 // padding

	return buf
}
Exemplo n.º 13
0
// Write request to wire for UnredirectSubwindows
// unredirectSubwindowsRequest writes a UnredirectSubwindows request to a byte slice.
func unredirectSubwindowsRequest(c *xgb.Conn, buf []byte, Window xproto.Window, Update byte) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["COMPOSITE"]
	b += 1

	buf[b] = 4 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	buf[b] = Update
	b += 1

	b += 3 // padding

	return buf
}
Exemplo n.º 14
0
// Bytes writes a CompletionEvent value to a byte slice.
func (v CompletionEvent) Bytes() []byte {
	buf := make([]byte, 32)
	b := 0

	// write event number
	buf[b] = 0
	b += 1

	b += 1 // padding

	b += 2 // skip sequence number

	xgb.Put32(buf[b:], uint32(v.Drawable))
	b += 4

	xgb.Put16(buf[b:], v.MinorEvent)
	b += 2

	buf[b] = v.MajorEvent
	b += 1

	b += 1 // padding

	xgb.Put32(buf[b:], uint32(v.Shmseg))
	b += 4

	xgb.Put32(buf[b:], v.Offset)
	b += 4

	return buf
}
Exemplo n.º 15
0
// Write request to wire for UnregisterClients
// unregisterClientsRequest writes a UnregisterClients request to a byte slice.
func unregisterClientsRequest(c *xgb.Conn, buf []byte, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) []byte {
	size := xgb.Pad((12 + xgb.Pad((int(NumClientSpecs) * 4))))
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["RECORD"]
	b += 1

	buf[b] = 3 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Context))
	b += 4

	xgb.Put32(buf[b:], NumClientSpecs)
	b += 4

	for i := 0; i < int(NumClientSpecs); i++ {
		xgb.Put32(buf[b:], uint32(ClientSpecs[i]))
		b += 4
	}
	b = xgb.Pad(b)

	return buf
}
Exemplo n.º 16
0
// Write request to wire for CreateRegionFromBorderClip
// createRegionFromBorderClipRequest writes a CreateRegionFromBorderClip request to a byte slice.
func createRegionFromBorderClipRequest(c *xgb.Conn, buf []byte, Region xfixes.Region, Window xproto.Window) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["COMPOSITE"]
	b += 1

	buf[b] = 5 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Region))
	b += 4

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	return buf
}
Exemplo n.º 17
0
// Write request to wire for GetBuffersWithFormat
// getBuffersWithFormatRequest writes a GetBuffersWithFormat request to a byte slice.
func getBuffersWithFormatRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) []byte {
	size := xgb.Pad((12 + xgb.Pad((len(Attachments) * 8))))
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 7 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], Count)
	b += 4

	b += AttachFormatListBytes(buf[b:], Attachments)

	return buf
}
Exemplo n.º 18
0
// Write request to wire for NameWindowPixmap
// nameWindowPixmapRequest writes a NameWindowPixmap request to a byte slice.
func nameWindowPixmapRequest(c *xgb.Conn, buf []byte, Window xproto.Window, Pixmap xproto.Pixmap) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["COMPOSITE"]
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	xgb.Put32(buf[b:], uint32(Pixmap))
	b += 4

	return buf
}
Exemplo n.º 19
0
// Write request to wire for SelectInput
// selectInputRequest writes a SelectInput request to a byte slice.
func selectInputRequest(c *xgb.Conn, buf []byte, DestinationWindow xproto.Window, Enable bool) []byte {
	size := 12
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(DestinationWindow))
	b += 4

	if Enable {
		buf[b] = 1
	} else {
		buf[b] = 0
	}
	b += 1

	b += 3 // padding

	return buf
}
Exemplo n.º 20
0
// Write request to wire for CreatePixmap
// createPixmapRequest writes a CreatePixmap request to a byte slice.
func createPixmapRequest(c *xgb.Conn, buf []byte, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) []byte {
	size := 28
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["MIT-SHM"]
	b += 1

	buf[b] = 5 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Pid))
	b += 4

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put16(buf[b:], Width)
	b += 2

	xgb.Put16(buf[b:], Height)
	b += 2

	buf[b] = Depth
	b += 1

	b += 3 // padding

	xgb.Put32(buf[b:], uint32(Shmseg))
	b += 4

	xgb.Put32(buf[b:], Offset)
	b += 4

	return buf
}
Exemplo n.º 21
0
// Write request to wire for Rectangles
// rectanglesRequest writes a Rectangles request to a byte slice.
func rectanglesRequest(c *xgb.Conn, buf []byte, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) []byte {
	size := xgb.Pad((16 + xgb.Pad((len(Rectangles) * 8))))
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 1 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	buf[b] = byte(Operation)
	b += 1

	buf[b] = byte(DestinationKind)
	b += 1

	buf[b] = Ordering
	b += 1

	b += 1 // padding

	xgb.Put32(buf[b:], uint32(DestinationWindow))
	b += 4

	xgb.Put16(buf[b:], uint16(XOffset))
	b += 2

	xgb.Put16(buf[b:], uint16(YOffset))
	b += 2

	b += xproto.RectangleListBytes(buf[b:], Rectangles)

	return buf
}
Exemplo n.º 22
0
// Bytes writes a NotifyEvent value to a byte slice.
func (v NotifyEvent) Bytes() []byte {
	buf := make([]byte, 32)
	b := 0

	// write event number
	buf[b] = 0
	b += 1

	buf[b] = byte(v.ShapeKind)
	b += 1

	b += 2 // skip sequence number

	xgb.Put32(buf[b:], uint32(v.AffectedWindow))
	b += 4

	xgb.Put16(buf[b:], uint16(v.ExtentsX))
	b += 2

	xgb.Put16(buf[b:], uint16(v.ExtentsY))
	b += 2

	xgb.Put16(buf[b:], v.ExtentsWidth)
	b += 2

	xgb.Put16(buf[b:], v.ExtentsHeight)
	b += 2

	xgb.Put32(buf[b:], uint32(v.ServerTime))
	b += 4

	if v.Shaped {
		buf[b] = 1
	} else {
		buf[b] = 0
	}
	b += 1

	b += 11 // padding

	return buf
}
Exemplo n.º 23
0
// Write request to wire for Mask
// maskRequest writes a Mask request to a byte slice.
func maskRequest(c *xgb.Conn, buf []byte, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) []byte {
	size := 20
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 2 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	buf[b] = byte(Operation)
	b += 1

	buf[b] = byte(DestinationKind)
	b += 1

	b += 2 // padding

	xgb.Put32(buf[b:], uint32(DestinationWindow))
	b += 4

	xgb.Put16(buf[b:], uint16(XOffset))
	b += 2

	xgb.Put16(buf[b:], uint16(YOffset))
	b += 2

	xgb.Put32(buf[b:], uint32(SourceBitmap))
	b += 4

	return buf
}
Exemplo n.º 24
0
// Write request to wire for RegisterClients
// registerClientsRequest writes a RegisterClients request to a byte slice.
func registerClientsRequest(c *xgb.Conn, buf []byte, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) []byte {
	size := xgb.Pad(((20 + xgb.Pad((int(NumClientSpecs) * 4))) + xgb.Pad((int(NumRanges) * 24))))
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["RECORD"]
	b += 1

	buf[b] = 2 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Context))
	b += 4

	buf[b] = byte(ElementHeader)
	b += 1

	b += 3 // padding

	xgb.Put32(buf[b:], NumClientSpecs)
	b += 4

	xgb.Put32(buf[b:], NumRanges)
	b += 4

	for i := 0; i < int(NumClientSpecs); i++ {
		xgb.Put32(buf[b:], uint32(ClientSpecs[i]))
		b += 4
	}
	b = xgb.Pad(b)

	b += RangeListBytes(buf[b:], Ranges)

	return buf
}
Exemplo n.º 25
0
// Write request to wire for QueryVersion
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn, buf []byte) []byte {
	size := 4
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["MIT-SHM"]
	b += 1

	buf[b] = 0 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	return buf
}
Exemplo n.º 26
0
// Write request to wire for SwapBuffers
// swapBuffersRequest writes a SwapBuffers request to a byte slice.
func swapBuffersRequest(c *xgb.Conn, buf []byte, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte {
	size := 32
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 8 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], TargetMscHi)
	b += 4

	xgb.Put32(buf[b:], TargetMscLo)
	b += 4

	xgb.Put32(buf[b:], DivisorHi)
	b += 4

	xgb.Put32(buf[b:], DivisorLo)
	b += 4

	xgb.Put32(buf[b:], RemainderHi)
	b += 4

	xgb.Put32(buf[b:], RemainderLo)
	b += 4

	return buf
}
Exemplo n.º 27
0
// Write request to wire for ReleaseOverlayWindow
// releaseOverlayWindowRequest writes a ReleaseOverlayWindow request to a byte slice.
func releaseOverlayWindowRequest(c *xgb.Conn, buf []byte, Window xproto.Window) []byte {
	size := 8
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["COMPOSITE"]
	b += 1

	buf[b] = 8 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	return buf
}
Exemplo n.º 28
0
// Write request to wire for InputSelected
// inputSelectedRequest writes a InputSelected request to a byte slice.
func inputSelectedRequest(c *xgb.Conn, buf []byte, DestinationWindow xproto.Window) []byte {
	size := 8
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 7 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(DestinationWindow))
	b += 4

	return buf
}
Exemplo n.º 29
0
// Write request to wire for GetContext
// getContextRequest writes a GetContext request to a byte slice.
func getContextRequest(c *xgb.Conn, buf []byte, Context Context) []byte {
	size := 8
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["RECORD"]
	b += 1

	buf[b] = 4 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Context))
	b += 4

	return buf
}
Exemplo n.º 30
0
// Write request to wire for Detach
// detachRequest writes a Detach request to a byte slice.
func detachRequest(c *xgb.Conn, buf []byte, Shmseg Seg) []byte {
	size := 8
	b := 0
	if cap(buf) >= size {
		buf = buf[:size]
	} else {
		buf = make([]byte, size)
	}

	buf[b] = c.Extensions["MIT-SHM"]
	b += 1

	buf[b] = 2 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Shmseg))
	b += 4

	return buf
}