Page 1 of 1

Weird MoveDisplay() on OS4

Posted: Wed Nov 04, 2015 9:57 pm
by lazi
Ok, this is rather be an OS4 bug, but please test it on different configs. Maybe we can locate who should be addressed to solve it.

Displays a small window which changes it's vertical position along with horizontal mouse position.
It works.

Code: Select all

@DISPLAY {width=90,height=30,borderless=false,sizeable=false}

function p_move()
	MoveDisplay(200,MouseX())
endfunction

InstallEventHandler({onmousemove=p_move})

repeat
    WaitEvent
forever             
Now change it a bit to the window movement reflect on vertical mouse movement. (Change MouseX() to MouseY()).
This will make totally mad window movement. Could it be an OS bug?

Code: Select all

@DISPLAY {width=90,height=30,borderless=false,sizeable=false}


function p_move()
	MoveDisplay(200,MouseY())
endfunction

InstallEventHandler({onmousemove=p_move})

repeat
    WaitEvent
forever    

Re: Weird MoveDisplay() on OS4

Posted: Tue Nov 10, 2015 9:39 pm
by airsoftsoftwair
This code is asking for trouble :-) Moving the window is usually an asynchronous operation that is delegated to the window manager and might take some time until executed. Querying the mouse coordinates is always window-based (even if MouseX() and MouseY() return them in screen coordinates) so you might get some spurious coordinates in case they're polled while a window move is being executed. I get a strange behaviour on Windows too. This is no surprise because on Windows Hollywood runs the VM in its own thread while all the window management runs on the main thread, i.e. things have to be delegated back and forth. Code like this will then inevitably lead to strange behaviour. I'm afraid you'll have to live with that :)