Avoid to send the command twice, once on mouse down, once on mouse up.
Move the code handling user input from scrcpy.c to a separate file, screencontrol.c.