fix: desktop viewer doesn't work on unix-like system

This commit is contained in:
XZB-1248
2023-02-01 17:16:04 +08:00
parent 763cd95cf3
commit 8d158251d0
4 changed files with 8 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
## v0.2.1 ## v0.2.1
* Fix: desktop connection timeout. * Fix: desktop connection timeout.
* Fix: desktop viewer doesn't work on unix-like system.
* Add: show resolution of desktop. * Add: show resolution of desktop.
* 修复:远程桌面连接超时。 * 修复:远程桌面连接超时。
* 修复远程桌面在类unix系统下无法显示。
* 新增:显示远程桌面的分辨率。 * 新增:显示远程桌面的分辨率。

View File

@@ -17,8 +17,10 @@ func (s *screen) init(displayIndex int) {
} }
func (s *screen) capture(img *image.RGBA, _ image.Rectangle) error { func (s *screen) capture(img *image.RGBA, _ image.Rectangle) error {
var err error image, err := screenshot.CaptureDisplay(displayIndex)
img, err = screenshot.CaptureDisplay(displayIndex) if err == nil {
*img = *image
}
return err return err
} }

View File

@@ -63,7 +63,7 @@ func InitDesktop(ctx *gin.Context) {
} }
// desktopEventWrapper returns a eventCallback function that will // 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 { func desktopEventWrapper(desktop *desktop) common.EventCallback {
return func(pack modules.Packet, device *melody.Session) { return func(pack modules.Packet, device *melody.Session) {
if pack.Act == `RAW_DATA_ARRIVE` && pack.Data != nil { if pack.Act == `RAW_DATA_ARRIVE` && pack.Data != nil {

View File

@@ -64,7 +64,7 @@ func InitTerminal(ctx *gin.Context) {
} }
// terminalEventWrapper returns a eventCallback function that will // 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 { func terminalEventWrapper(terminal *terminal) common.EventCallback {
return func(pack modules.Packet, device *melody.Session) { return func(pack modules.Packet, device *melody.Session) {
if pack.Act == `RAW_DATA_ARRIVE` && pack.Data != nil { if pack.Act == `RAW_DATA_ARRIVE` && pack.Data != nil {