Provide access to the X display number in the XGB Conn.
This commit is contained in:
parent
269a7b9cc6
commit
e635de5e1d
|
@ -141,8 +141,9 @@ func (c *Conn) dial(display string) error {
|
||||||
scr = display[dotIdx+1:]
|
scr = display[dotIdx+1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
dispnum, err := strconv.Atoi(c.display)
|
var err error
|
||||||
if err != nil || dispnum < 0 {
|
c.DisplayNumber, err = strconv.Atoi(c.display)
|
||||||
|
if err != nil || c.DisplayNumber < 0 {
|
||||||
return errors.New("bad display string: " + display0)
|
return errors.New("bad display string: " + display0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +161,8 @@ func (c *Conn) dial(display string) error {
|
||||||
if protocol == "" {
|
if protocol == "" {
|
||||||
protocol = "tcp"
|
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 {
|
} else {
|
||||||
c.conn, err = net.Dial("unix", "/tmp/.X11-unix/X"+c.display)
|
c.conn, err = net.Dial("unix", "/tmp/.X11-unix/X"+c.display)
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ type Conn struct {
|
||||||
host string
|
host string
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
display string
|
display string
|
||||||
|
DisplayNumber int
|
||||||
DefaultScreen int
|
DefaultScreen int
|
||||||
SetupBytes []byte
|
SetupBytes []byte
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue