fix default message handler
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
e1d11c19bb
commit
b5a9437686
31
client.go
31
client.go
@ -254,6 +254,35 @@ func (*DefaultClientMessageHandler) Handle(c Conn) error {
|
||||
serverMessages[m.Type()] = m
|
||||
}
|
||||
|
||||
spf := &SetPixelFormat{PF: *cfg.PixelFormat}
|
||||
if err = spf.Write(c); err != nil {
|
||||
// cfg.ErrorCh <- err
|
||||
return err
|
||||
}
|
||||
|
||||
senc := &SetEncodings{
|
||||
EncNum: uint16(len(cfg.Encodings)),
|
||||
Encodings: make([]EncodingType, 0, len(cfg.Encodings)),
|
||||
}
|
||||
|
||||
for _, enc := range cfg.Encodings {
|
||||
senc.Encodings = append(senc.Encodings, enc.Type())
|
||||
}
|
||||
if err = senc.Write(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fbur := &FramebufferUpdateRequest{
|
||||
Inc: 0,
|
||||
X: 0,
|
||||
Y: 0,
|
||||
Width: c.Width(),
|
||||
Height: c.Height(),
|
||||
}
|
||||
if err = fbur.Write(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for {
|
||||
@ -279,7 +308,7 @@ func (*DefaultClientMessageHandler) Handle(c Conn) error {
|
||||
}
|
||||
msg, ok := serverMessages[messageType]
|
||||
if !ok {
|
||||
err = fmt.Errorf("unknown message-type: %v", messageType)
|
||||
err = fmt.Errorf("unknown message-type: %#+v", messageType)
|
||||
cfg.ErrorCh <- err
|
||||
return
|
||||
}
|
||||
|
@ -257,7 +257,9 @@ type DefaultClientServerInitHandler struct{}
|
||||
// Handle provide default server init handler
|
||||
func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
||||
var err error
|
||||
|
||||
srvInit := ServerInit{}
|
||||
pf := PixelFormat{}
|
||||
|
||||
if err = binary.Read(c, binary.BigEndian, &srvInit.FBWidth); err != nil {
|
||||
return err
|
||||
@ -265,9 +267,11 @@ func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
||||
if err = binary.Read(c, binary.BigEndian, &srvInit.FBHeight); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = binary.Read(c, binary.BigEndian, &srvInit.PixelFormat); err != nil {
|
||||
if err = binary.Read(c, binary.BigEndian, &pf); err != nil {
|
||||
return err
|
||||
}
|
||||
srvInit.PixelFormat = &pf
|
||||
|
||||
if err = binary.Read(c, binary.BigEndian, &srvInit.NameLength); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -276,7 +280,9 @@ func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
||||
if err = binary.Read(c, binary.BigEndian, &srvInit.NameText); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.SetDesktopName(srvInit.NameText)
|
||||
|
||||
if c.Protocol() == "aten1" {
|
||||
c.SetWidth(800)
|
||||
c.SetHeight(600)
|
||||
@ -286,6 +292,7 @@ func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
||||
c.SetHeight(srvInit.FBHeight)
|
||||
c.SetPixelFormat(srvInit.PixelFormat)
|
||||
}
|
||||
|
||||
if c.Protocol() == "aten1" {
|
||||
ikvm := struct {
|
||||
_ [8]byte
|
||||
|
Loading…
Reference in New Issue
Block a user