Apply patch from https://github.com/synergy/synergy/issues/3749

Patch taken from https://github.com/synergy/synergy/issues/3749
Original patch author is Pavel Pergamenshchik