Dont transmit animation control commands for non-animated images

This commit is contained in:
Kovid Goyal 2023-01-03 08:06:04 +05:30
parent 0b9b207513
commit eec4c6b802
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -248,6 +248,7 @@ func transmit_image(imgd *image_data) {
}
frame_control_cmd := graphics.GraphicsCommand{}
frame_control_cmd.SetAction(graphics.GRT_action_animate).SetImageNumber(imgd.image_number)
is_animated := len(imgd.frames) > 1
for frame_num, frame := range imgd.frames {
err := f(imgd, frame_num, frame)
@ -255,6 +256,7 @@ func transmit_image(imgd *image_data) {
print_error("\rFailed to transmit %s with error: %v", imgd.source_name, err)
return
}
if is_animated {
switch frame_num {
case 0:
// set gap for the first frame and number of loops for the animation
@ -274,7 +276,8 @@ func transmit_image(imgd *image_data) {
c.WriteWithPayloadToLoop(lp, nil)
}
}
if len(imgd.frames) > 1 {
}
if is_animated {
c := frame_control_cmd
c.SetAnimationControl(3) // set animation to normal mode
c.WriteWithPayloadToLoop(lp, nil)