From 8d158251d087d9969d68b7d8c762cd5ed8d9b451 Mon Sep 17 00:00:00 2001 From: XZB-1248 Date: Wed, 1 Feb 2023 17:16:04 +0800 Subject: [PATCH] fix: desktop viewer doesn't work on unix-like system --- CHANGELOG.md | 2 ++ client/service/desktop/screenshot_others.go | 6 ++++-- server/handler/desktop/desktop.go | 2 +- server/handler/terminal/terminal.go | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 303ef5f..8f89b5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ ## v0.2.1 * Fix: desktop connection timeout. +* Fix: desktop viewer doesn't work on unix-like system. * Add: show resolution of desktop. * 修复:远程桌面连接超时。 +* 修复:远程桌面在类unix系统下无法显示。 * 新增:显示远程桌面的分辨率。 diff --git a/client/service/desktop/screenshot_others.go b/client/service/desktop/screenshot_others.go index 84b3111..d9a86bd 100644 --- a/client/service/desktop/screenshot_others.go +++ b/client/service/desktop/screenshot_others.go @@ -17,8 +17,10 @@ func (s *screen) init(displayIndex int) { } func (s *screen) capture(img *image.RGBA, _ image.Rectangle) error { - var err error - img, err = screenshot.CaptureDisplay(displayIndex) + image, err := screenshot.CaptureDisplay(displayIndex) + if err == nil { + *img = *image + } return err } diff --git a/server/handler/desktop/desktop.go b/server/handler/desktop/desktop.go index 429916b..7e7b069 100644 --- a/server/handler/desktop/desktop.go +++ b/server/handler/desktop/desktop.go @@ -63,7 +63,7 @@ func InitDesktop(ctx *gin.Context) { } // desktopEventWrapper returns a eventCallback function that will -// be called when device need to send a packet to browser terminal +// be called when device need to send a packet to browser func desktopEventWrapper(desktop *desktop) common.EventCallback { return func(pack modules.Packet, device *melody.Session) { if pack.Act == `RAW_DATA_ARRIVE` && pack.Data != nil { diff --git a/server/handler/terminal/terminal.go b/server/handler/terminal/terminal.go index f95d0b0..77f803f 100644 --- a/server/handler/terminal/terminal.go +++ b/server/handler/terminal/terminal.go @@ -64,7 +64,7 @@ func InitTerminal(ctx *gin.Context) { } // terminalEventWrapper returns a eventCallback function that will -// be called when device need to send a packet to browser terminal +// be called when device need to send a packet to browser func terminalEventWrapper(terminal *terminal) common.EventCallback { return func(pack modules.Packet, device *melody.Session) { if pack.Act == `RAW_DATA_ARRIVE` && pack.Data != nil {