Page 1 of 1

love.mouse.setposition seems to have a random delay

Posted: Tue Aug 11, 2020 6:04 pm
by artless
A test code:

function love.update(dt)
print(love.mouse.getPosition())
x,y=love.mouse.getPosition()
x=x+10
love.mouse.setPosition(x, y)
print(x,y,love.mouse.getPosition())
end

Some of my output:
73 209
83 209 73 209 (x,y doesn't match getpostion in most cases)
83 209
93 209 83 209
83 209 (the cursor stayed on x=83 for two frames)
93 209 83 209
93 209
103 209 93 209
93 209
103 209 103 209 (x,y match getpostion in rare cases, it seems that getpostion is not simply delayed for one frame)
103 209
113 209 103 209
113 209
123 209 113 209
123 209
133 209 123 209
123 209
133 209 123 209
133 209
143 209 133 209
133 209
143 209 133 209
133 209 (133 lasts four frames)
143 209 133 209
143 209
153 209 143 209


(My system is windows 10.)

Re: love.mouse.setposition seems to have a random delay

Posted: Tue Aug 11, 2020 7:40 pm
by pgimeno
Works fine for me on X11. What's your windowing system? If it's not X11, it's probably the windowing system's fault.

Code: Select all

0	0
10	0	10	0
10	0
20	0	20	0
20	0
30	0	30	0
30	0
40	0	40	0
40	0
50	0	50	0
50	0
60	0	60	0
60	0
70	0	70	0
70	0