aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xselinux
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2013-08-11 20:43:26 -0400
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:17 +0200
commit0685fb57e14104ee4ad9f70ec94f787a9a22c028 (patch)
treec52429c82379c154c95dbfafcfc52460ec9168c0 /nexgb/xselinux
parent4b20ffaf4f4cc756832a6d064d5dfe182f16b0e9 (diff)
downloadhaven-0685fb57e14104ee4ad9f70ec94f787a9a22c028.tar.gz
haven-0685fb57e14104ee4ad9f70ec94f787a9a22c028.tar.xz
haven-0685fb57e14104ee4ad9f70ec94f787a9a22c028.zip
Update to latest xproto XML.
Diffstat (limited to 'nexgb/xselinux')
-rw-r--r--nexgb/xselinux/xselinux.go1612
1 files changed, 806 insertions, 806 deletions
diff --git a/nexgb/xselinux/xselinux.go b/nexgb/xselinux/xselinux.go
index 6024d65..c7183bf 100644
--- a/nexgb/xselinux/xselinux.go
+++ b/nexgb/xselinux/xselinux.go
@@ -2,7 +2,7 @@
package xselinux
/*
- This file was generated by xselinux.xml on Jun 5 2012 12:12:00am EDT.
+ This file was generated by xselinux.xml on Aug 11 2013 8:39:44pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -40,30 +40,6 @@ func init() {
xgb.NewExtErrorFuncs["SELinux"] = make(map[int]xgb.NewErrorFun)
}
-// Skipping definition for base type 'Float'
-
-// Skipping definition for base type 'Card8'
-
-// Skipping definition for base type 'Int16'
-
-// Skipping definition for base type 'Int32'
-
-// Skipping definition for base type 'Void'
-
-// Skipping definition for base type 'Byte'
-
-// Skipping definition for base type 'Int8'
-
-// Skipping definition for base type 'Card16'
-
-// Skipping definition for base type 'Char'
-
-// Skipping definition for base type 'Card32'
-
-// Skipping definition for base type 'Double'
-
-// Skipping definition for base type 'Bool'
-
type ListItem struct {
Name xproto.Atom
ObjectContextLen uint32
@@ -156,188 +132,59 @@ func ListItemListSize(list []ListItem) int {
return size
}
-// QueryVersionCookie is a cookie used only for QueryVersion requests.
-type QueryVersionCookie struct {
- *xgb.Cookie
-}
-
-// QueryVersion sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
-func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie)
- return QueryVersionCookie{cookie}
-}
-
-// QueryVersionUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie)
- return QueryVersionCookie{cookie}
-}
-
-// QueryVersionReply represents the data returned from a QueryVersion request.
-type QueryVersionReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- ServerMajor uint16
- ServerMinor uint16
-}
-
-// Reply blocks and returns the reply data for a QueryVersion request.
-func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return queryVersionReply(buf), nil
-}
-
-// queryVersionReply reads a byte slice into a QueryVersionReply value.
-func queryVersionReply(buf []byte) *QueryVersionReply {
- v := new(QueryVersionReply)
- b := 1 // skip reply determinant
-
- b += 1 // padding
-
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
-
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
- b += 4
-
- v.ServerMajor = xgb.Get16(buf[b:])
- b += 2
-
- v.ServerMinor = xgb.Get16(buf[b:])
- b += 2
-
- return v
-}
-
-// Write request to wire for QueryVersion
-// queryVersionRequest writes a QueryVersion request to a byte slice.
-func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte {
- size := 8
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SELINUX"]
- 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
-
- buf[b] = ClientMajor
- b += 1
-
- buf[b] = ClientMinor
- b += 1
-
- return buf
-}
+// Skipping definition for base type 'Bool'
-// SetDeviceCreateContextCookie is a cookie used only for SetDeviceCreateContext requests.
-type SetDeviceCreateContextCookie struct {
- *xgb.Cookie
-}
+// Skipping definition for base type 'Byte'
-// SetDeviceCreateContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetDeviceCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setDeviceCreateContextRequest(c, ContextLen, Context), cookie)
- return SetDeviceCreateContextCookie{cookie}
-}
+// Skipping definition for base type 'Card8'
-// SetDeviceCreateContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetDeviceCreateContextCookie.Check()
-func SetDeviceCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setDeviceCreateContextRequest(c, ContextLen, Context), cookie)
- return SetDeviceCreateContextCookie{cookie}
-}
+// Skipping definition for base type 'Char'
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetDeviceCreateContextCookie) Check() error {
- return cook.Cookie.Check()
-}
+// Skipping definition for base type 'Void'
-// Write request to wire for SetDeviceCreateContext
-// setDeviceCreateContextRequest writes a SetDeviceCreateContext request to a byte slice.
-func setDeviceCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
- b := 0
- buf := make([]byte, size)
+// Skipping definition for base type 'Double'
- buf[b] = c.Extensions["SELINUX"]
- b += 1
+// Skipping definition for base type 'Float'
- buf[b] = 1 // request opcode
- b += 1
+// Skipping definition for base type 'Int16'
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
- b += 2
+// Skipping definition for base type 'Int32'
- xgb.Put32(buf[b:], ContextLen)
- b += 4
+// Skipping definition for base type 'Int8'
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
+// Skipping definition for base type 'Card16'
- return buf
-}
+// Skipping definition for base type 'Card32'
-// GetDeviceCreateContextCookie is a cookie used only for GetDeviceCreateContext requests.
-type GetDeviceCreateContextCookie struct {
+// GetClientContextCookie is a cookie used only for GetClientContext requests.
+type GetClientContextCookie struct {
*xgb.Cookie
}
-// GetDeviceCreateContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetDeviceCreateContextCookie.Reply()
-func GetDeviceCreateContext(c *xgb.Conn) GetDeviceCreateContextCookie {
+// GetClientContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetClientContextCookie.Reply()
+func GetClientContext(c *xgb.Conn, Resource uint32) GetClientContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getDeviceCreateContextRequest(c), cookie)
- return GetDeviceCreateContextCookie{cookie}
+ c.NewRequest(getClientContextRequest(c, Resource), cookie)
+ return GetClientContextCookie{cookie}
}
-// GetDeviceCreateContextUnchecked sends an unchecked request.
+// GetClientContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetDeviceCreateContextUnchecked(c *xgb.Conn) GetDeviceCreateContextCookie {
+func GetClientContextUnchecked(c *xgb.Conn, Resource uint32) GetClientContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getDeviceCreateContextRequest(c), cookie)
- return GetDeviceCreateContextCookie{cookie}
+ c.NewRequest(getClientContextRequest(c, Resource), cookie)
+ return GetClientContextCookie{cookie}
}
-// GetDeviceCreateContextReply represents the data returned from a GetDeviceCreateContext request.
-type GetDeviceCreateContextReply struct {
+// GetClientContextReply represents the data returned from a GetClientContext request.
+type GetClientContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -346,8 +193,8 @@ type GetDeviceCreateContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetDeviceCreateContext request.
-func (cook GetDeviceCreateContextCookie) Reply() (*GetDeviceCreateContextReply, error) {
+// Reply blocks and returns the reply data for a GetClientContext request.
+func (cook GetClientContextCookie) Reply() (*GetClientContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -355,12 +202,12 @@ func (cook GetDeviceCreateContextCookie) Reply() (*GetDeviceCreateContextReply,
if buf == nil {
return nil, nil
}
- return getDeviceCreateContextReply(buf), nil
+ return getClientContextReply(buf), nil
}
-// getDeviceCreateContextReply reads a byte slice into a GetDeviceCreateContextReply value.
-func getDeviceCreateContextReply(buf []byte) *GetDeviceCreateContextReply {
- v := new(GetDeviceCreateContextReply)
+// getClientContextReply reads a byte slice into a GetClientContextReply value.
+func getClientContextReply(buf []byte) *GetClientContextReply {
+ v := new(GetClientContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -386,83 +233,25 @@ func getDeviceCreateContextReply(buf []byte) *GetDeviceCreateContextReply {
return v
}
-// Write request to wire for GetDeviceCreateContext
-// getDeviceCreateContextRequest writes a GetDeviceCreateContext request to a byte slice.
-func getDeviceCreateContextRequest(c *xgb.Conn) []byte {
- size := 4
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SELINUX"]
- 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
-
- return buf
-}
-
-// SetDeviceContextCookie is a cookie used only for SetDeviceContext requests.
-type SetDeviceContextCookie struct {
- *xgb.Cookie
-}
-
-// SetDeviceContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetDeviceContext(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setDeviceContextRequest(c, Device, ContextLen, Context), cookie)
- return SetDeviceContextCookie{cookie}
-}
-
-// SetDeviceContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetDeviceContextCookie.Check()
-func SetDeviceContextChecked(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setDeviceContextRequest(c, Device, ContextLen, Context), cookie)
- return SetDeviceContextCookie{cookie}
-}
-
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetDeviceContextCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetDeviceContext
-// setDeviceContextRequest writes a SetDeviceContext request to a byte slice.
-func setDeviceContextRequest(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((12 + xgb.Pad((int(ContextLen) * 1))))
+// Write request to wire for GetClientContext
+// getClientContextRequest writes a GetClientContext request to a byte slice.
+func getClientContextRequest(c *xgb.Conn, Resource uint32) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 3 // request opcode
+ buf[b] = 22 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], Device)
- b += 4
-
- xgb.Put32(buf[b:], ContextLen)
+ xgb.Put32(buf[b:], Resource)
b += 4
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
-
return buf
}
@@ -565,93 +354,35 @@ func getDeviceContextRequest(c *xgb.Conn, Device uint32) []byte {
return buf
}
-// SetWindowCreateContextCookie is a cookie used only for SetWindowCreateContext requests.
-type SetWindowCreateContextCookie struct {
- *xgb.Cookie
-}
-
-// SetWindowCreateContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetWindowCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setWindowCreateContextRequest(c, ContextLen, Context), cookie)
- return SetWindowCreateContextCookie{cookie}
-}
-
-// SetWindowCreateContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetWindowCreateContextCookie.Check()
-func SetWindowCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setWindowCreateContextRequest(c, ContextLen, Context), cookie)
- return SetWindowCreateContextCookie{cookie}
-}
-
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetWindowCreateContextCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetWindowCreateContext
-// setWindowCreateContextRequest writes a SetWindowCreateContext request to a byte slice.
-func setWindowCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SELINUX"]
- 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:], ContextLen)
- b += 4
-
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
-
- return buf
-}
-
-// GetWindowCreateContextCookie is a cookie used only for GetWindowCreateContext requests.
-type GetWindowCreateContextCookie struct {
+// GetDeviceCreateContextCookie is a cookie used only for GetDeviceCreateContext requests.
+type GetDeviceCreateContextCookie struct {
*xgb.Cookie
}
-// GetWindowCreateContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetWindowCreateContextCookie.Reply()
-func GetWindowCreateContext(c *xgb.Conn) GetWindowCreateContextCookie {
+// GetDeviceCreateContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetDeviceCreateContextCookie.Reply()
+func GetDeviceCreateContext(c *xgb.Conn) GetDeviceCreateContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getWindowCreateContextRequest(c), cookie)
- return GetWindowCreateContextCookie{cookie}
+ c.NewRequest(getDeviceCreateContextRequest(c), cookie)
+ return GetDeviceCreateContextCookie{cookie}
}
-// GetWindowCreateContextUnchecked sends an unchecked request.
+// GetDeviceCreateContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetWindowCreateContextUnchecked(c *xgb.Conn) GetWindowCreateContextCookie {
+func GetDeviceCreateContextUnchecked(c *xgb.Conn) GetDeviceCreateContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getWindowCreateContextRequest(c), cookie)
- return GetWindowCreateContextCookie{cookie}
+ c.NewRequest(getDeviceCreateContextRequest(c), cookie)
+ return GetDeviceCreateContextCookie{cookie}
}
-// GetWindowCreateContextReply represents the data returned from a GetWindowCreateContext request.
-type GetWindowCreateContextReply struct {
+// GetDeviceCreateContextReply represents the data returned from a GetDeviceCreateContext request.
+type GetDeviceCreateContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -660,8 +391,8 @@ type GetWindowCreateContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetWindowCreateContext request.
-func (cook GetWindowCreateContextCookie) Reply() (*GetWindowCreateContextReply, error) {
+// Reply blocks and returns the reply data for a GetDeviceCreateContext request.
+func (cook GetDeviceCreateContextCookie) Reply() (*GetDeviceCreateContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -669,12 +400,12 @@ func (cook GetWindowCreateContextCookie) Reply() (*GetWindowCreateContextReply,
if buf == nil {
return nil, nil
}
- return getWindowCreateContextReply(buf), nil
+ return getDeviceCreateContextReply(buf), nil
}
-// getWindowCreateContextReply reads a byte slice into a GetWindowCreateContextReply value.
-func getWindowCreateContextReply(buf []byte) *GetWindowCreateContextReply {
- v := new(GetWindowCreateContextReply)
+// getDeviceCreateContextReply reads a byte slice into a GetDeviceCreateContextReply value.
+func getDeviceCreateContextReply(buf []byte) *GetDeviceCreateContextReply {
+ v := new(GetDeviceCreateContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -700,9 +431,9 @@ func getWindowCreateContextReply(buf []byte) *GetWindowCreateContextReply {
return v
}
-// Write request to wire for GetWindowCreateContext
-// getWindowCreateContextRequest writes a GetWindowCreateContext request to a byte slice.
-func getWindowCreateContextRequest(c *xgb.Conn) []byte {
+// Write request to wire for GetDeviceCreateContext
+// getDeviceCreateContextRequest writes a GetDeviceCreateContext request to a byte slice.
+func getDeviceCreateContextRequest(c *xgb.Conn) []byte {
size := 4
b := 0
buf := make([]byte, size)
@@ -710,7 +441,7 @@ func getWindowCreateContextRequest(c *xgb.Conn) []byte {
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 6 // request opcode
+ buf[b] = 2 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -719,35 +450,35 @@ func getWindowCreateContextRequest(c *xgb.Conn) []byte {
return buf
}
-// GetWindowContextCookie is a cookie used only for GetWindowContext requests.
-type GetWindowContextCookie struct {
+// GetPropertyContextCookie is a cookie used only for GetPropertyContext requests.
+type GetPropertyContextCookie struct {
*xgb.Cookie
}
-// GetWindowContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetWindowContextCookie.Reply()
-func GetWindowContext(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie {
+// GetPropertyContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetPropertyContextCookie.Reply()
+func GetPropertyContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getWindowContextRequest(c, Window), cookie)
- return GetWindowContextCookie{cookie}
+ c.NewRequest(getPropertyContextRequest(c, Window, Property), cookie)
+ return GetPropertyContextCookie{cookie}
}
-// GetWindowContextUnchecked sends an unchecked request.
+// GetPropertyContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetWindowContextUnchecked(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie {
+func GetPropertyContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getWindowContextRequest(c, Window), cookie)
- return GetWindowContextCookie{cookie}
+ c.NewRequest(getPropertyContextRequest(c, Window, Property), cookie)
+ return GetPropertyContextCookie{cookie}
}
-// GetWindowContextReply represents the data returned from a GetWindowContext request.
-type GetWindowContextReply struct {
+// GetPropertyContextReply represents the data returned from a GetPropertyContext request.
+type GetPropertyContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -756,8 +487,8 @@ type GetWindowContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetWindowContext request.
-func (cook GetWindowContextCookie) Reply() (*GetWindowContextReply, error) {
+// Reply blocks and returns the reply data for a GetPropertyContext request.
+func (cook GetPropertyContextCookie) Reply() (*GetPropertyContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -765,12 +496,12 @@ func (cook GetWindowContextCookie) Reply() (*GetWindowContextReply, error) {
if buf == nil {
return nil, nil
}
- return getWindowContextReply(buf), nil
+ return getPropertyContextReply(buf), nil
}
-// getWindowContextReply reads a byte slice into a GetWindowContextReply value.
-func getWindowContextReply(buf []byte) *GetWindowContextReply {
- v := new(GetWindowContextReply)
+// getPropertyContextReply reads a byte slice into a GetPropertyContextReply value.
+func getPropertyContextReply(buf []byte) *GetPropertyContextReply {
+ v := new(GetPropertyContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -796,17 +527,17 @@ func getWindowContextReply(buf []byte) *GetWindowContextReply {
return v
}
-// Write request to wire for GetWindowContext
-// getWindowContextRequest writes a GetWindowContext request to a byte slice.
-func getWindowContextRequest(c *xgb.Conn, Window xproto.Window) []byte {
- size := 8
+// Write request to wire for GetPropertyContext
+// getPropertyContextRequest writes a GetPropertyContext request to a byte slice.
+func getPropertyContextRequest(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 7 // request opcode
+ buf[b] = 12 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -815,64 +546,9 @@ func getWindowContextRequest(c *xgb.Conn, Window xproto.Window) []byte {
xgb.Put32(buf[b:], uint32(Window))
b += 4
- return buf
-}
-
-// SetPropertyCreateContextCookie is a cookie used only for SetPropertyCreateContext requests.
-type SetPropertyCreateContextCookie struct {
- *xgb.Cookie
-}
-
-// SetPropertyCreateContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetPropertyCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setPropertyCreateContextRequest(c, ContextLen, Context), cookie)
- return SetPropertyCreateContextCookie{cookie}
-}
-
-// SetPropertyCreateContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetPropertyCreateContextCookie.Check()
-func SetPropertyCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setPropertyCreateContextRequest(c, ContextLen, Context), cookie)
- return SetPropertyCreateContextCookie{cookie}
-}
-
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetPropertyCreateContextCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetPropertyCreateContext
-// setPropertyCreateContextRequest writes a SetPropertyCreateContext request to a byte slice.
-func setPropertyCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SELINUX"]
- 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:], ContextLen)
+ xgb.Put32(buf[b:], uint32(Property))
b += 4
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
-
return buf
}
@@ -972,60 +648,104 @@ func getPropertyCreateContextRequest(c *xgb.Conn) []byte {
return buf
}
-// SetPropertyUseContextCookie is a cookie used only for SetPropertyUseContext requests.
-type SetPropertyUseContextCookie struct {
+// GetPropertyDataContextCookie is a cookie used only for GetPropertyDataContext requests.
+type GetPropertyDataContextCookie struct {
*xgb.Cookie
}
-// SetPropertyUseContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetPropertyUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie {
+// GetPropertyDataContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetPropertyDataContextCookie.Reply()
+func GetPropertyDataContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(setPropertyUseContextRequest(c, ContextLen, Context), cookie)
- return SetPropertyUseContextCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getPropertyDataContextRequest(c, Window, Property), cookie)
+ return GetPropertyDataContextCookie{cookie}
}
-// SetPropertyUseContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetPropertyUseContextCookie.Check()
-func SetPropertyUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie {
+// GetPropertyDataContextUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetPropertyDataContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(setPropertyUseContextRequest(c, ContextLen, Context), cookie)
- return SetPropertyUseContextCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getPropertyDataContextRequest(c, Window, Property), cookie)
+ return GetPropertyDataContextCookie{cookie}
}
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetPropertyUseContextCookie) Check() error {
- return cook.Cookie.Check()
+// GetPropertyDataContextReply represents the data returned from a GetPropertyDataContext request.
+type GetPropertyDataContextReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ ContextLen uint32
+ // padding: 20 bytes
+ Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Write request to wire for SetPropertyUseContext
-// setPropertyUseContextRequest writes a SetPropertyUseContext request to a byte slice.
-func setPropertyUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
+// Reply blocks and returns the reply data for a GetPropertyDataContext request.
+func (cook GetPropertyDataContextCookie) Reply() (*GetPropertyDataContextReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getPropertyDataContextReply(buf), nil
+}
+
+// getPropertyDataContextReply reads a byte slice into a GetPropertyDataContextReply value.
+func getPropertyDataContextReply(buf []byte) *GetPropertyDataContextReply {
+ v := new(GetPropertyDataContextReply)
+ b := 1 // skip reply determinant
+
+ b += 1 // padding
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ b += 4
+
+ v.ContextLen = xgb.Get32(buf[b:])
+ b += 4
+
+ b += 20 // padding
+
+ {
+ byteString := make([]byte, v.ContextLen)
+ copy(byteString[:v.ContextLen], buf[b:])
+ v.Context = string(byteString)
+ b += xgb.Pad(int(v.ContextLen))
+ }
+
+ return v
+}
+
+// Write request to wire for GetPropertyDataContext
+// getPropertyDataContextRequest writes a GetPropertyDataContext request to a byte slice.
+func getPropertyDataContextRequest(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 10 // request opcode
+ 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:], ContextLen)
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
+ xgb.Put32(buf[b:], uint32(Property))
+ b += 4
return buf
}
@@ -1126,35 +846,35 @@ func getPropertyUseContextRequest(c *xgb.Conn) []byte {
return buf
}
-// GetPropertyContextCookie is a cookie used only for GetPropertyContext requests.
-type GetPropertyContextCookie struct {
+// GetSelectionContextCookie is a cookie used only for GetSelectionContext requests.
+type GetSelectionContextCookie struct {
*xgb.Cookie
}
-// GetPropertyContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetPropertyContextCookie.Reply()
-func GetPropertyContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie {
+// GetSelectionContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetSelectionContextCookie.Reply()
+func GetSelectionContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getPropertyContextRequest(c, Window, Property), cookie)
- return GetPropertyContextCookie{cookie}
+ c.NewRequest(getSelectionContextRequest(c, Selection), cookie)
+ return GetSelectionContextCookie{cookie}
}
-// GetPropertyContextUnchecked sends an unchecked request.
+// GetSelectionContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetPropertyContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie {
+func GetSelectionContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getPropertyContextRequest(c, Window, Property), cookie)
- return GetPropertyContextCookie{cookie}
+ c.NewRequest(getSelectionContextRequest(c, Selection), cookie)
+ return GetSelectionContextCookie{cookie}
}
-// GetPropertyContextReply represents the data returned from a GetPropertyContext request.
-type GetPropertyContextReply struct {
+// GetSelectionContextReply represents the data returned from a GetSelectionContext request.
+type GetSelectionContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -1163,8 +883,8 @@ type GetPropertyContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetPropertyContext request.
-func (cook GetPropertyContextCookie) Reply() (*GetPropertyContextReply, error) {
+// Reply blocks and returns the reply data for a GetSelectionContext request.
+func (cook GetSelectionContextCookie) Reply() (*GetSelectionContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1172,12 +892,12 @@ func (cook GetPropertyContextCookie) Reply() (*GetPropertyContextReply, error) {
if buf == nil {
return nil, nil
}
- return getPropertyContextReply(buf), nil
+ return getSelectionContextReply(buf), nil
}
-// getPropertyContextReply reads a byte slice into a GetPropertyContextReply value.
-func getPropertyContextReply(buf []byte) *GetPropertyContextReply {
- v := new(GetPropertyContextReply)
+// getSelectionContextReply reads a byte slice into a GetSelectionContextReply value.
+func getSelectionContextReply(buf []byte) *GetSelectionContextReply {
+ v := new(GetSelectionContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1203,60 +923,57 @@ func getPropertyContextReply(buf []byte) *GetPropertyContextReply {
return v
}
-// Write request to wire for GetPropertyContext
-// getPropertyContextRequest writes a GetPropertyContext request to a byte slice.
-func getPropertyContextRequest(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) []byte {
- size := 12
+// Write request to wire for GetSelectionContext
+// getSelectionContextRequest writes a GetSelectionContext request to a byte slice.
+func getSelectionContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 12 // request opcode
+ buf[b] = 19 // 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(Property))
+ xgb.Put32(buf[b:], uint32(Selection))
b += 4
return buf
}
-// GetPropertyDataContextCookie is a cookie used only for GetPropertyDataContext requests.
-type GetPropertyDataContextCookie struct {
+// GetSelectionCreateContextCookie is a cookie used only for GetSelectionCreateContext requests.
+type GetSelectionCreateContextCookie struct {
*xgb.Cookie
}
-// GetPropertyDataContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetPropertyDataContextCookie.Reply()
-func GetPropertyDataContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie {
+// GetSelectionCreateContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetSelectionCreateContextCookie.Reply()
+func GetSelectionCreateContext(c *xgb.Conn) GetSelectionCreateContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getPropertyDataContextRequest(c, Window, Property), cookie)
- return GetPropertyDataContextCookie{cookie}
+ c.NewRequest(getSelectionCreateContextRequest(c), cookie)
+ return GetSelectionCreateContextCookie{cookie}
}
-// GetPropertyDataContextUnchecked sends an unchecked request.
+// GetSelectionCreateContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetPropertyDataContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie {
+func GetSelectionCreateContextUnchecked(c *xgb.Conn) GetSelectionCreateContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getPropertyDataContextRequest(c, Window, Property), cookie)
- return GetPropertyDataContextCookie{cookie}
+ c.NewRequest(getSelectionCreateContextRequest(c), cookie)
+ return GetSelectionCreateContextCookie{cookie}
}
-// GetPropertyDataContextReply represents the data returned from a GetPropertyDataContext request.
-type GetPropertyDataContextReply struct {
+// GetSelectionCreateContextReply represents the data returned from a GetSelectionCreateContext request.
+type GetSelectionCreateContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -1265,8 +982,8 @@ type GetPropertyDataContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetPropertyDataContext request.
-func (cook GetPropertyDataContextCookie) Reply() (*GetPropertyDataContextReply, error) {
+// Reply blocks and returns the reply data for a GetSelectionCreateContext request.
+func (cook GetSelectionCreateContextCookie) Reply() (*GetSelectionCreateContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1274,12 +991,12 @@ func (cook GetPropertyDataContextCookie) Reply() (*GetPropertyDataContextReply,
if buf == nil {
return nil, nil
}
- return getPropertyDataContextReply(buf), nil
+ return getSelectionCreateContextReply(buf), nil
}
-// getPropertyDataContextReply reads a byte slice into a GetPropertyDataContextReply value.
-func getPropertyDataContextReply(buf []byte) *GetPropertyDataContextReply {
- v := new(GetPropertyDataContextReply)
+// getSelectionCreateContextReply reads a byte slice into a GetSelectionCreateContextReply value.
+func getSelectionCreateContextReply(buf []byte) *GetSelectionCreateContextReply {
+ v := new(GetSelectionCreateContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1305,70 +1022,64 @@ func getPropertyDataContextReply(buf []byte) *GetPropertyDataContextReply {
return v
}
-// Write request to wire for GetPropertyDataContext
-// getPropertyDataContextRequest writes a GetPropertyDataContext request to a byte slice.
-func getPropertyDataContextRequest(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) []byte {
- size := 12
+// Write request to wire for GetSelectionCreateContext
+// getSelectionCreateContextRequest writes a GetSelectionCreateContext request to a byte slice.
+func getSelectionCreateContextRequest(c *xgb.Conn) []byte {
+ size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 13 // request opcode
+ buf[b] = 16 // 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(Property))
- b += 4
-
return buf
}
-// ListPropertiesCookie is a cookie used only for ListProperties requests.
-type ListPropertiesCookie struct {
+// GetSelectionDataContextCookie is a cookie used only for GetSelectionDataContext requests.
+type GetSelectionDataContextCookie struct {
*xgb.Cookie
}
-// ListProperties sends a checked request.
-// If an error occurs, it will be returned with the reply by calling ListPropertiesCookie.Reply()
-func ListProperties(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie {
+// GetSelectionDataContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetSelectionDataContextCookie.Reply()
+func GetSelectionDataContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(listPropertiesRequest(c, Window), cookie)
- return ListPropertiesCookie{cookie}
+ c.NewRequest(getSelectionDataContextRequest(c, Selection), cookie)
+ return GetSelectionDataContextCookie{cookie}
}
-// ListPropertiesUnchecked sends an unchecked request.
+// GetSelectionDataContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ListPropertiesUnchecked(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie {
+func GetSelectionDataContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(listPropertiesRequest(c, Window), cookie)
- return ListPropertiesCookie{cookie}
+ c.NewRequest(getSelectionDataContextRequest(c, Selection), cookie)
+ return GetSelectionDataContextCookie{cookie}
}
-// ListPropertiesReply represents the data returned from a ListProperties request.
-type ListPropertiesReply struct {
+// GetSelectionDataContextReply represents the data returned from a GetSelectionDataContext request.
+type GetSelectionDataContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- PropertiesLen uint32
+ ContextLen uint32
// padding: 20 bytes
- Properties []ListItem // size: ListItemListSize(Properties)
+ Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a ListProperties request.
-func (cook ListPropertiesCookie) Reply() (*ListPropertiesReply, error) {
+// Reply blocks and returns the reply data for a GetSelectionDataContext request.
+func (cook GetSelectionDataContextCookie) Reply() (*GetSelectionDataContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1376,12 +1087,12 @@ func (cook ListPropertiesCookie) Reply() (*ListPropertiesReply, error) {
if buf == nil {
return nil, nil
}
- return listPropertiesReply(buf), nil
+ return getSelectionDataContextReply(buf), nil
}
-// listPropertiesReply reads a byte slice into a ListPropertiesReply value.
-func listPropertiesReply(buf []byte) *ListPropertiesReply {
- v := new(ListPropertiesReply)
+// getSelectionDataContextReply reads a byte slice into a GetSelectionDataContextReply value.
+func getSelectionDataContextReply(buf []byte) *GetSelectionDataContextReply {
+ v := new(GetSelectionDataContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1392,20 +1103,24 @@ func listPropertiesReply(buf []byte) *ListPropertiesReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.PropertiesLen = xgb.Get32(buf[b:])
+ v.ContextLen = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
- v.Properties = make([]ListItem, v.PropertiesLen)
- b += ListItemReadList(buf[b:], v.Properties)
+ {
+ byteString := make([]byte, v.ContextLen)
+ copy(byteString[:v.ContextLen], buf[b:])
+ v.Context = string(byteString)
+ b += xgb.Pad(int(v.ContextLen))
+ }
return v
}
-// Write request to wire for ListProperties
-// listPropertiesRequest writes a ListProperties request to a byte slice.
-func listPropertiesRequest(c *xgb.Conn, Window xproto.Window) []byte {
+// Write request to wire for GetSelectionDataContext
+// getSelectionDataContextRequest writes a GetSelectionDataContext request to a byte slice.
+func getSelectionDataContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1413,105 +1128,47 @@ func listPropertiesRequest(c *xgb.Conn, Window xproto.Window) []byte {
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 14 // 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
-}
-
-// SetSelectionCreateContextCookie is a cookie used only for SetSelectionCreateContext requests.
-type SetSelectionCreateContextCookie struct {
- *xgb.Cookie
-}
-
-// SetSelectionCreateContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetSelectionCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setSelectionCreateContextRequest(c, ContextLen, Context), cookie)
- return SetSelectionCreateContextCookie{cookie}
-}
-
-// SetSelectionCreateContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetSelectionCreateContextCookie.Check()
-func SetSelectionCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setSelectionCreateContextRequest(c, ContextLen, Context), cookie)
- return SetSelectionCreateContextCookie{cookie}
-}
-
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetSelectionCreateContextCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetSelectionCreateContext
-// setSelectionCreateContextRequest writes a SetSelectionCreateContext request to a byte slice.
-func setSelectionCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SELINUX"]
- b += 1
-
- buf[b] = 15 // request opcode
+ buf[b] = 20 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], ContextLen)
+ xgb.Put32(buf[b:], uint32(Selection))
b += 4
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
-
return buf
}
-// GetSelectionCreateContextCookie is a cookie used only for GetSelectionCreateContext requests.
-type GetSelectionCreateContextCookie struct {
+// GetSelectionUseContextCookie is a cookie used only for GetSelectionUseContext requests.
+type GetSelectionUseContextCookie struct {
*xgb.Cookie
}
-// GetSelectionCreateContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetSelectionCreateContextCookie.Reply()
-func GetSelectionCreateContext(c *xgb.Conn) GetSelectionCreateContextCookie {
+// GetSelectionUseContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetSelectionUseContextCookie.Reply()
+func GetSelectionUseContext(c *xgb.Conn) GetSelectionUseContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getSelectionCreateContextRequest(c), cookie)
- return GetSelectionCreateContextCookie{cookie}
+ c.NewRequest(getSelectionUseContextRequest(c), cookie)
+ return GetSelectionUseContextCookie{cookie}
}
-// GetSelectionCreateContextUnchecked sends an unchecked request.
+// GetSelectionUseContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetSelectionCreateContextUnchecked(c *xgb.Conn) GetSelectionCreateContextCookie {
+func GetSelectionUseContextUnchecked(c *xgb.Conn) GetSelectionUseContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getSelectionCreateContextRequest(c), cookie)
- return GetSelectionCreateContextCookie{cookie}
+ c.NewRequest(getSelectionUseContextRequest(c), cookie)
+ return GetSelectionUseContextCookie{cookie}
}
-// GetSelectionCreateContextReply represents the data returned from a GetSelectionCreateContext request.
-type GetSelectionCreateContextReply struct {
+// GetSelectionUseContextReply represents the data returned from a GetSelectionUseContext request.
+type GetSelectionUseContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -1520,8 +1177,8 @@ type GetSelectionCreateContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetSelectionCreateContext request.
-func (cook GetSelectionCreateContextCookie) Reply() (*GetSelectionCreateContextReply, error) {
+// Reply blocks and returns the reply data for a GetSelectionUseContext request.
+func (cook GetSelectionUseContextCookie) Reply() (*GetSelectionUseContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1529,12 +1186,12 @@ func (cook GetSelectionCreateContextCookie) Reply() (*GetSelectionCreateContextR
if buf == nil {
return nil, nil
}
- return getSelectionCreateContextReply(buf), nil
+ return getSelectionUseContextReply(buf), nil
}
-// getSelectionCreateContextReply reads a byte slice into a GetSelectionCreateContextReply value.
-func getSelectionCreateContextReply(buf []byte) *GetSelectionCreateContextReply {
- v := new(GetSelectionCreateContextReply)
+// getSelectionUseContextReply reads a byte slice into a GetSelectionUseContextReply value.
+func getSelectionUseContextReply(buf []byte) *GetSelectionUseContextReply {
+ v := new(GetSelectionUseContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1560,9 +1217,9 @@ func getSelectionCreateContextReply(buf []byte) *GetSelectionCreateContextReply
return v
}
-// Write request to wire for GetSelectionCreateContext
-// getSelectionCreateContextRequest writes a GetSelectionCreateContext request to a byte slice.
-func getSelectionCreateContextRequest(c *xgb.Conn) []byte {
+// Write request to wire for GetSelectionUseContext
+// getSelectionUseContextRequest writes a GetSelectionUseContext request to a byte slice.
+func getSelectionUseContextRequest(c *xgb.Conn) []byte {
size := 4
b := 0
buf := make([]byte, size)
@@ -1570,102 +1227,44 @@ func getSelectionCreateContextRequest(c *xgb.Conn) []byte {
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 16 // request opcode
- b += 1
-
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
- b += 2
-
- return buf
-}
-
-// SetSelectionUseContextCookie is a cookie used only for SetSelectionUseContext requests.
-type SetSelectionUseContextCookie struct {
- *xgb.Cookie
-}
-
-// SetSelectionUseContext sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetSelectionUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setSelectionUseContextRequest(c, ContextLen, Context), cookie)
- return SetSelectionUseContextCookie{cookie}
-}
-
-// SetSelectionUseContextChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetSelectionUseContextCookie.Check()
-func SetSelectionUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie {
- if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setSelectionUseContextRequest(c, ContextLen, Context), cookie)
- return SetSelectionUseContextCookie{cookie}
-}
-
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetSelectionUseContextCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetSelectionUseContext
-// setSelectionUseContextRequest writes a SetSelectionUseContext request to a byte slice.
-func setSelectionUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
- size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SELINUX"]
- b += 1
-
- buf[b] = 17 // request opcode
+ buf[b] = 18 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], ContextLen)
- b += 4
-
- copy(buf[b:], Context[:ContextLen])
- b += xgb.Pad(int(ContextLen))
-
return buf
}
-// GetSelectionUseContextCookie is a cookie used only for GetSelectionUseContext requests.
-type GetSelectionUseContextCookie struct {
+// GetWindowContextCookie is a cookie used only for GetWindowContext requests.
+type GetWindowContextCookie struct {
*xgb.Cookie
}
-// GetSelectionUseContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetSelectionUseContextCookie.Reply()
-func GetSelectionUseContext(c *xgb.Conn) GetSelectionUseContextCookie {
+// GetWindowContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetWindowContextCookie.Reply()
+func GetWindowContext(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getSelectionUseContextRequest(c), cookie)
- return GetSelectionUseContextCookie{cookie}
+ c.NewRequest(getWindowContextRequest(c, Window), cookie)
+ return GetWindowContextCookie{cookie}
}
-// GetSelectionUseContextUnchecked sends an unchecked request.
+// GetWindowContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetSelectionUseContextUnchecked(c *xgb.Conn) GetSelectionUseContextCookie {
+func GetWindowContextUnchecked(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getSelectionUseContextRequest(c), cookie)
- return GetSelectionUseContextCookie{cookie}
+ c.NewRequest(getWindowContextRequest(c, Window), cookie)
+ return GetWindowContextCookie{cookie}
}
-// GetSelectionUseContextReply represents the data returned from a GetSelectionUseContext request.
-type GetSelectionUseContextReply struct {
+// GetWindowContextReply represents the data returned from a GetWindowContext request.
+type GetWindowContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -1674,8 +1273,8 @@ type GetSelectionUseContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetSelectionUseContext request.
-func (cook GetSelectionUseContextCookie) Reply() (*GetSelectionUseContextReply, error) {
+// Reply blocks and returns the reply data for a GetWindowContext request.
+func (cook GetWindowContextCookie) Reply() (*GetWindowContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1683,12 +1282,12 @@ func (cook GetSelectionUseContextCookie) Reply() (*GetSelectionUseContextReply,
if buf == nil {
return nil, nil
}
- return getSelectionUseContextReply(buf), nil
+ return getWindowContextReply(buf), nil
}
-// getSelectionUseContextReply reads a byte slice into a GetSelectionUseContextReply value.
-func getSelectionUseContextReply(buf []byte) *GetSelectionUseContextReply {
- v := new(GetSelectionUseContextReply)
+// getWindowContextReply reads a byte slice into a GetWindowContextReply value.
+func getWindowContextReply(buf []byte) *GetWindowContextReply {
+ v := new(GetWindowContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1714,54 +1313,57 @@ func getSelectionUseContextReply(buf []byte) *GetSelectionUseContextReply {
return v
}
-// Write request to wire for GetSelectionUseContext
-// getSelectionUseContextRequest writes a GetSelectionUseContext request to a byte slice.
-func getSelectionUseContextRequest(c *xgb.Conn) []byte {
- size := 4
+// Write request to wire for GetWindowContext
+// getWindowContextRequest writes a GetWindowContext request to a byte slice.
+func getWindowContextRequest(c *xgb.Conn, Window xproto.Window) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 18 // request opcode
+ 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(Window))
+ b += 4
+
return buf
}
-// GetSelectionContextCookie is a cookie used only for GetSelectionContext requests.
-type GetSelectionContextCookie struct {
+// GetWindowCreateContextCookie is a cookie used only for GetWindowCreateContext requests.
+type GetWindowCreateContextCookie struct {
*xgb.Cookie
}
-// GetSelectionContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetSelectionContextCookie.Reply()
-func GetSelectionContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie {
+// GetWindowCreateContext sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetWindowCreateContextCookie.Reply()
+func GetWindowCreateContext(c *xgb.Conn) GetWindowCreateContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getSelectionContextRequest(c, Selection), cookie)
- return GetSelectionContextCookie{cookie}
+ c.NewRequest(getWindowCreateContextRequest(c), cookie)
+ return GetWindowCreateContextCookie{cookie}
}
-// GetSelectionContextUnchecked sends an unchecked request.
+// GetWindowCreateContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetSelectionContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie {
+func GetWindowCreateContextUnchecked(c *xgb.Conn) GetWindowCreateContextCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getSelectionContextRequest(c, Selection), cookie)
- return GetSelectionContextCookie{cookie}
+ c.NewRequest(getWindowCreateContextRequest(c), cookie)
+ return GetWindowCreateContextCookie{cookie}
}
-// GetSelectionContextReply represents the data returned from a GetSelectionContext request.
-type GetSelectionContextReply struct {
+// GetWindowCreateContextReply represents the data returned from a GetWindowCreateContext request.
+type GetWindowCreateContextReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
@@ -1770,8 +1372,8 @@ type GetSelectionContextReply struct {
Context string // size: xgb.Pad((int(ContextLen) * 1))
}
-// Reply blocks and returns the reply data for a GetSelectionContext request.
-func (cook GetSelectionContextCookie) Reply() (*GetSelectionContextReply, error) {
+// Reply blocks and returns the reply data for a GetWindowCreateContext request.
+func (cook GetWindowCreateContextCookie) Reply() (*GetWindowCreateContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1779,12 +1381,12 @@ func (cook GetSelectionContextCookie) Reply() (*GetSelectionContextReply, error)
if buf == nil {
return nil, nil
}
- return getSelectionContextReply(buf), nil
+ return getWindowCreateContextReply(buf), nil
}
-// getSelectionContextReply reads a byte slice into a GetSelectionContextReply value.
-func getSelectionContextReply(buf []byte) *GetSelectionContextReply {
- v := new(GetSelectionContextReply)
+// getWindowCreateContextReply reads a byte slice into a GetWindowCreateContextReply value.
+func getWindowCreateContextReply(buf []byte) *GetWindowCreateContextReply {
+ v := new(GetWindowCreateContextReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1810,67 +1412,64 @@ func getSelectionContextReply(buf []byte) *GetSelectionContextReply {
return v
}
-// Write request to wire for GetSelectionContext
-// getSelectionContextRequest writes a GetSelectionContext request to a byte slice.
-func getSelectionContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte {
- size := 8
+// Write request to wire for GetWindowCreateContext
+// getWindowCreateContextRequest writes a GetWindowCreateContext request to a byte slice.
+func getWindowCreateContextRequest(c *xgb.Conn) []byte {
+ size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 19 // request opcode
+ 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(Selection))
- b += 4
-
return buf
}
-// GetSelectionDataContextCookie is a cookie used only for GetSelectionDataContext requests.
-type GetSelectionDataContextCookie struct {
+// ListPropertiesCookie is a cookie used only for ListProperties requests.
+type ListPropertiesCookie struct {
*xgb.Cookie
}
-// GetSelectionDataContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetSelectionDataContextCookie.Reply()
-func GetSelectionDataContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie {
+// ListProperties sends a checked request.
+// If an error occurs, it will be returned with the reply by calling ListPropertiesCookie.Reply()
+func ListProperties(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getSelectionDataContextRequest(c, Selection), cookie)
- return GetSelectionDataContextCookie{cookie}
+ c.NewRequest(listPropertiesRequest(c, Window), cookie)
+ return ListPropertiesCookie{cookie}
}
-// GetSelectionDataContextUnchecked sends an unchecked request.
+// ListPropertiesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetSelectionDataContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie {
+func ListPropertiesUnchecked(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getSelectionDataContextRequest(c, Selection), cookie)
- return GetSelectionDataContextCookie{cookie}
+ c.NewRequest(listPropertiesRequest(c, Window), cookie)
+ return ListPropertiesCookie{cookie}
}
-// GetSelectionDataContextReply represents the data returned from a GetSelectionDataContext request.
-type GetSelectionDataContextReply struct {
+// ListPropertiesReply represents the data returned from a ListProperties request.
+type ListPropertiesReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- ContextLen uint32
+ PropertiesLen uint32
// padding: 20 bytes
- Context string // size: xgb.Pad((int(ContextLen) * 1))
+ Properties []ListItem // size: ListItemListSize(Properties)
}
-// Reply blocks and returns the reply data for a GetSelectionDataContext request.
-func (cook GetSelectionDataContextCookie) Reply() (*GetSelectionDataContextReply, error) {
+// Reply blocks and returns the reply data for a ListProperties request.
+func (cook ListPropertiesCookie) Reply() (*ListPropertiesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1878,12 +1477,12 @@ func (cook GetSelectionDataContextCookie) Reply() (*GetSelectionDataContextReply
if buf == nil {
return nil, nil
}
- return getSelectionDataContextReply(buf), nil
+ return listPropertiesReply(buf), nil
}
-// getSelectionDataContextReply reads a byte slice into a GetSelectionDataContextReply value.
-func getSelectionDataContextReply(buf []byte) *GetSelectionDataContextReply {
- v := new(GetSelectionDataContextReply)
+// listPropertiesReply reads a byte slice into a ListPropertiesReply value.
+func listPropertiesReply(buf []byte) *ListPropertiesReply {
+ v := new(ListPropertiesReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1894,24 +1493,20 @@ func getSelectionDataContextReply(buf []byte) *GetSelectionDataContextReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.ContextLen = xgb.Get32(buf[b:])
+ v.PropertiesLen = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
- {
- byteString := make([]byte, v.ContextLen)
- copy(byteString[:v.ContextLen], buf[b:])
- v.Context = string(byteString)
- b += xgb.Pad(int(v.ContextLen))
- }
+ v.Properties = make([]ListItem, v.PropertiesLen)
+ b += ListItemReadList(buf[b:], v.Properties)
return v
}
-// Write request to wire for GetSelectionDataContext
-// getSelectionDataContextRequest writes a GetSelectionDataContext request to a byte slice.
-func getSelectionDataContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte {
+// Write request to wire for ListProperties
+// listPropertiesRequest writes a ListProperties request to a byte slice.
+func listPropertiesRequest(c *xgb.Conn, Window xproto.Window) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1919,13 +1514,13 @@ func getSelectionDataContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte {
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 20 // request opcode
+ buf[b] = 14 // 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(Selection))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
return buf
@@ -2023,45 +1618,44 @@ func listSelectionsRequest(c *xgb.Conn) []byte {
return buf
}
-// GetClientContextCookie is a cookie used only for GetClientContext requests.
-type GetClientContextCookie struct {
+// QueryVersionCookie is a cookie used only for QueryVersion requests.
+type QueryVersionCookie struct {
*xgb.Cookie
}
-// GetClientContext sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetClientContextCookie.Reply()
-func GetClientContext(c *xgb.Conn, Resource uint32) GetClientContextCookie {
+// QueryVersion sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
+func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getClientContextRequest(c, Resource), cookie)
- return GetClientContextCookie{cookie}
+ c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie)
+ return QueryVersionCookie{cookie}
}
-// GetClientContextUnchecked sends an unchecked request.
+// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetClientContextUnchecked(c *xgb.Conn, Resource uint32) GetClientContextCookie {
+func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
if _, ok := c.Extensions["SELINUX"]; !ok {
- panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getClientContextRequest(c, Resource), cookie)
- return GetClientContextCookie{cookie}
+ c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie)
+ return QueryVersionCookie{cookie}
}
-// GetClientContextReply represents the data returned from a GetClientContext request.
-type GetClientContextReply struct {
+// QueryVersionReply represents the data returned from a QueryVersion request.
+type QueryVersionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- ContextLen uint32
- // padding: 20 bytes
- Context string // size: xgb.Pad((int(ContextLen) * 1))
+ ServerMajor uint16
+ ServerMinor uint16
}
-// Reply blocks and returns the reply data for a GetClientContext request.
-func (cook GetClientContextCookie) Reply() (*GetClientContextReply, error) {
+// Reply blocks and returns the reply data for a QueryVersion request.
+func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2069,12 +1663,12 @@ func (cook GetClientContextCookie) Reply() (*GetClientContextReply, error) {
if buf == nil {
return nil, nil
}
- return getClientContextReply(buf), nil
+ return queryVersionReply(buf), nil
}
-// getClientContextReply reads a byte slice into a GetClientContextReply value.
-func getClientContextReply(buf []byte) *GetClientContextReply {
- v := new(GetClientContextReply)
+// queryVersionReply reads a byte slice into a QueryVersionReply value.
+func queryVersionReply(buf []byte) *QueryVersionReply {
+ v := new(QueryVersionReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -2085,39 +1679,445 @@ func getClientContextReply(buf []byte) *GetClientContextReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.ContextLen = xgb.Get32(buf[b:])
+ v.ServerMajor = xgb.Get16(buf[b:])
+ b += 2
+
+ v.ServerMinor = xgb.Get16(buf[b:])
+ b += 2
+
+ return v
+}
+
+// Write request to wire for QueryVersion
+// queryVersionRequest writes a QueryVersion request to a byte slice.
+func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte {
+ size := 8
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ 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
+
+ buf[b] = ClientMajor
+ b += 1
+
+ buf[b] = ClientMinor
+ b += 1
+
+ return buf
+}
+
+// SetDeviceContextCookie is a cookie used only for SetDeviceContext requests.
+type SetDeviceContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetDeviceContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetDeviceContext(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setDeviceContextRequest(c, Device, ContextLen, Context), cookie)
+ return SetDeviceContextCookie{cookie}
+}
+
+// SetDeviceContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetDeviceContextCookie.Check()
+func SetDeviceContextChecked(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setDeviceContextRequest(c, Device, ContextLen, Context), cookie)
+ return SetDeviceContextCookie{cookie}
+}
+
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetDeviceContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetDeviceContext
+// setDeviceContextRequest writes a SetDeviceContext request to a byte slice.
+func setDeviceContextRequest(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((12 + xgb.Pad((int(ContextLen) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ 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:], Device)
b += 4
- b += 20 // padding
+ xgb.Put32(buf[b:], ContextLen)
+ b += 4
- {
- byteString := make([]byte, v.ContextLen)
- copy(byteString[:v.ContextLen], buf[b:])
- v.Context = string(byteString)
- b += xgb.Pad(int(v.ContextLen))
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
+ return buf
+}
+
+// SetDeviceCreateContextCookie is a cookie used only for SetDeviceCreateContext requests.
+type SetDeviceCreateContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetDeviceCreateContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetDeviceCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
}
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setDeviceCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetDeviceCreateContextCookie{cookie}
+}
- return v
+// SetDeviceCreateContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetDeviceCreateContextCookie.Check()
+func SetDeviceCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setDeviceCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetDeviceCreateContextCookie{cookie}
}
-// Write request to wire for GetClientContext
-// getClientContextRequest writes a GetClientContext request to a byte slice.
-func getClientContextRequest(c *xgb.Conn, Resource uint32) []byte {
- size := 8
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetDeviceCreateContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetDeviceCreateContext
+// setDeviceCreateContextRequest writes a SetDeviceCreateContext request to a byte slice.
+func setDeviceCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SELINUX"]
b += 1
- buf[b] = 22 // request opcode
+ 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:], Resource)
+ xgb.Put32(buf[b:], ContextLen)
+ b += 4
+
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
+ return buf
+}
+
+// SetPropertyCreateContextCookie is a cookie used only for SetPropertyCreateContext requests.
+type SetPropertyCreateContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetPropertyCreateContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetPropertyCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setPropertyCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetPropertyCreateContextCookie{cookie}
+}
+
+// SetPropertyCreateContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetPropertyCreateContextCookie.Check()
+func SetPropertyCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setPropertyCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetPropertyCreateContextCookie{cookie}
+}
+
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetPropertyCreateContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetPropertyCreateContext
+// setPropertyCreateContextRequest writes a SetPropertyCreateContext request to a byte slice.
+func setPropertyCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ 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:], ContextLen)
+ b += 4
+
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
+ return buf
+}
+
+// SetPropertyUseContextCookie is a cookie used only for SetPropertyUseContext requests.
+type SetPropertyUseContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetPropertyUseContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetPropertyUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setPropertyUseContextRequest(c, ContextLen, Context), cookie)
+ return SetPropertyUseContextCookie{cookie}
+}
+
+// SetPropertyUseContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetPropertyUseContextCookie.Check()
+func SetPropertyUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setPropertyUseContextRequest(c, ContextLen, Context), cookie)
+ return SetPropertyUseContextCookie{cookie}
+}
+
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetPropertyUseContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetPropertyUseContext
+// setPropertyUseContextRequest writes a SetPropertyUseContext request to a byte slice.
+func setPropertyUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ b += 1
+
+ buf[b] = 10 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ b += 2
+
+ xgb.Put32(buf[b:], ContextLen)
b += 4
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
+ return buf
+}
+
+// SetSelectionCreateContextCookie is a cookie used only for SetSelectionCreateContext requests.
+type SetSelectionCreateContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetSelectionCreateContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetSelectionCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setSelectionCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetSelectionCreateContextCookie{cookie}
+}
+
+// SetSelectionCreateContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetSelectionCreateContextCookie.Check()
+func SetSelectionCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setSelectionCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetSelectionCreateContextCookie{cookie}
+}
+
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetSelectionCreateContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetSelectionCreateContext
+// setSelectionCreateContextRequest writes a SetSelectionCreateContext request to a byte slice.
+func setSelectionCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ b += 1
+
+ buf[b] = 15 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ b += 2
+
+ xgb.Put32(buf[b:], ContextLen)
+ b += 4
+
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
+ return buf
+}
+
+// SetSelectionUseContextCookie is a cookie used only for SetSelectionUseContext requests.
+type SetSelectionUseContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetSelectionUseContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetSelectionUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setSelectionUseContextRequest(c, ContextLen, Context), cookie)
+ return SetSelectionUseContextCookie{cookie}
+}
+
+// SetSelectionUseContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetSelectionUseContextCookie.Check()
+func SetSelectionUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setSelectionUseContextRequest(c, ContextLen, Context), cookie)
+ return SetSelectionUseContextCookie{cookie}
+}
+
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetSelectionUseContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetSelectionUseContext
+// setSelectionUseContextRequest writes a SetSelectionUseContext request to a byte slice.
+func setSelectionUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ b += 1
+
+ buf[b] = 17 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ b += 2
+
+ xgb.Put32(buf[b:], ContextLen)
+ b += 4
+
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
+ return buf
+}
+
+// SetWindowCreateContextCookie is a cookie used only for SetWindowCreateContext requests.
+type SetWindowCreateContextCookie struct {
+ *xgb.Cookie
+}
+
+// SetWindowCreateContext sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetWindowCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setWindowCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetWindowCreateContextCookie{cookie}
+}
+
+// SetWindowCreateContextChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetWindowCreateContextCookie.Check()
+func SetWindowCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie {
+ if _, ok := c.Extensions["SELINUX"]; !ok {
+ panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setWindowCreateContextRequest(c, ContextLen, Context), cookie)
+ return SetWindowCreateContextCookie{cookie}
+}
+
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetWindowCreateContextCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetWindowCreateContext
+// setWindowCreateContextRequest writes a SetWindowCreateContext request to a byte slice.
+func setWindowCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte {
+ size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["SELINUX"]
+ 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:], ContextLen)
+ b += 4
+
+ copy(buf[b:], Context[:ContextLen])
+ b += xgb.Pad(int(ContextLen))
+
return buf
}