From 0c50dc6241fa21712e041cfa2bfb9db4ccaef10a Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 17:01:42 -0400 Subject: a huge commit. splitting extensions into their own sub-packages. --- nexgb/conn.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'nexgb/conn.go') 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) } -- cgit v1.2.3-54-g00ecf