Weird MoveDisplay() on OS4

Report any Hollywood bugs here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Weird MoveDisplay() on OS4

Post 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    
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Weird MoveDisplay() on OS4

Post 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 :)
Post Reply