slightly better remote desktop
This commit is contained in:
@@ -684,6 +684,18 @@ func HandleCommand(ctx context.Context, env *runtime.Env, envelope map[string]in
|
||||
capture.SetQualityAndCodec(quality, codec)
|
||||
sendCommandResultSafe(env, cmdID, true, "")
|
||||
return nil
|
||||
case "desktop_set_resolution":
|
||||
payload, _ := envelope["payload"].(map[string]interface{})
|
||||
maxH := 0 // default = 1080p cap
|
||||
if payload != nil {
|
||||
if v, ok := payloadInt(payload, "maxHeight"); ok {
|
||||
maxH = v
|
||||
}
|
||||
}
|
||||
log.Printf("desktop: set max resolution height=%d", maxH)
|
||||
capture.SetMaxResolution(maxH)
|
||||
sendCommandResultSafe(env, cmdID, true, "")
|
||||
return nil
|
||||
case "desktop_mouse_move":
|
||||
if !env.MouseControl {
|
||||
sendCommandResultSafe(env, cmdID, true, "")
|
||||
|
||||
@@ -8,6 +8,11 @@ func resolveDesktopPoint(display int, x, y int32) (int32, int32) {
|
||||
return x, y
|
||||
}
|
||||
|
||||
if scale := capture.EffectiveScaleForInput(); scale > 0 && scale < 1 {
|
||||
x = int32(float64(x) / scale)
|
||||
y = int32(float64(y) / scale)
|
||||
}
|
||||
|
||||
absX := int32(bounds.Min.X) + x
|
||||
absY := int32(bounds.Min.Y) + y
|
||||
|
||||
|
||||
Reference in New Issue
Block a user