aboutsummaryrefslogtreecommitdiff
path: root/nexgb/conn.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-10 17:01:42 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-10 17:01:42 -0400
commit0c50dc6241fa21712e041cfa2bfb9db4ccaef10a (patch)
tree90a3200414c8ad6df8e7983a8e73fedfbe2b324e /nexgb/conn.go
parente239bb3c68a4981a3916534203c2fbd6b96f593c (diff)
downloadhaven-0c50dc6241fa21712e041cfa2bfb9db4ccaef10a.tar.gz
haven-0c50dc6241fa21712e041cfa2bfb9db4ccaef10a.tar.xz
haven-0c50dc6241fa21712e041cfa2bfb9db4ccaef10a.zip
a huge commit. splitting extensions into their own sub-packages.
Diffstat (limited to 'nexgb/conn.go')
-rw-r--r--nexgb/conn.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/nexgb/conn.go b/nexgb/conn.go
index af78be9..662a059 100644
--- a/nexgb/conn.go
+++ b/nexgb/conn.go
@@ -38,7 +38,7 @@ func (c *Conn) connect(display string) error {
return errors.New("unsupported auth protocol " + authName)
}
- buf := make([]byte, 12+pad(len(authName))+pad(len(authData)))
+ buf := make([]byte, 12+Pad(len(authName))+Pad(len(authData)))
buf[0] = 0x6c
buf[1] = 0
Put16(buf[2:], 11)
@@ -47,7 +47,7 @@ func (c *Conn) connect(display string) error {
Put16(buf[8:], uint16(len(authData)))
Put16(buf[10:], 0)
copy(buf[12:], []byte(authName))
- copy(buf[12+pad(len(authName)):], authData)
+ copy(buf[12+Pad(len(authName)):], authData)
if _, err = c.conn.Write(buf); err != nil {
return err
}
@@ -78,11 +78,14 @@ func (c *Conn) connect(display string) error {
string(reason))
}
- ReadSetupInfo(buf, &c.Setup)
+ // Unfortunately, it isn't really feasible to read the setup bytes here,
+ // since the code to do so is in a different package.
+ // Users must call 'xproto.Setup(X)' to get the setup info.
+ c.SetupBytes = buf
- if c.defaultScreen >= len(c.Setup.Roots) {
- c.defaultScreen = 0
- }
+ // But also read stuff that we *need* to get started.
+ c.setupResourceIdBase = Get32(buf[12:])
+ c.setupResourceIdMask = Get32(buf[16:])
return nil
}
@@ -137,7 +140,7 @@ func (c *Conn) dial(display string) error {
}
if len(scr) != 0 {
- c.defaultScreen, err = strconv.Atoi(scr)
+ c.DefaultScreen, err = strconv.Atoi(scr)
if err != nil {
return errors.New("bad display string: " + display0)
}