diff options
| author | Andrew Gallant <[email protected]> | 2013-01-26 12:51:21 -0500 |
|---|---|---|
| committer | Andrew Gallant <[email protected]> | 2013-01-26 12:51:21 -0500 |
| commit | 0faa267d653d815a370a50be59480a3801bc440f (patch) | |
| tree | d3c1dfdaddf72cd8e36583df2b38697846b000f6 | |
| parent | 94ba2d1333e1ab229fe08f58b5b963e05a4af083 (diff) | |
Provide access to the X display number in the XGB Conn.
| -rw-r--r-- | conn.go | 8 | ||||
| -rw-r--r-- | xgb.go | 1 |
2 files changed, 6 insertions, 3 deletions
@@ -141,8 +141,9 @@ func (c *Conn) dial(display string) error { scr = display[dotIdx+1:] } - dispnum, err := strconv.Atoi(c.display) - if err != nil || dispnum < 0 { + var err error + c.DisplayNumber, err = strconv.Atoi(c.display) + if err != nil || c.DisplayNumber < 0 { return errors.New("bad display string: " + display0) } @@ -160,7 +161,8 @@ func (c *Conn) dial(display string) error { if protocol == "" { protocol = "tcp" } - c.conn, err = net.Dial(protocol, c.host+":"+strconv.Itoa(6000+dispnum)) + c.conn, err = net.Dial(protocol, + c.host+":"+strconv.Itoa(6000+c.DisplayNumber)) } else { c.conn, err = net.Dial("unix", "/tmp/.X11-unix/X"+c.display) } @@ -49,6 +49,7 @@ type Conn struct { host string conn net.Conn display string + DisplayNumber int DefaultScreen int SetupBytes []byte |
