Windows dual monitor mode, mouse scrolls into the other monitor.

Hello,

I am running an experiment on windows, one monitor where it displays the stimuli

are in another room and the other is in the operating room where I can see the

progress of the experiment from Matlab.

I want to have the subject to use the mouse to move a pointer on the screen and

indicate a location.

the problem is that in windows the dual mode is an extended monitor mode,

and perhaps because of this, the mouse would move beyond the actual stimuli monitor.

In addition, when I get the screen parameters with 


[window, windowRect] = PsychImaging('OpenWindow', Scrn.num, black);

% Get the size of the on screen window in pixels.

[Scrn.Xpix, Scrn.Ypix] = Screen('WindowSize', window);


% Get the centre coordinate of the window

[Scrn.Xcen, Scrn.Ycen] = RectCenter(windowRect); % pixel


and then do 

SetMouse(Scrn.Xcen, Scrn.Ycen, window);


the mouse won't show in the center, but somewhere in the other monitor.

Also, when I move around the mouse, the x coordinate goes to minus.

When I look at the Scrn parameters, the size (resolution) is correct - 

it shows the dimensions for the stimuli display monitor, which is 1280 x 1024,

and for the center coordinates it gives correctly 

Scrn.Xcen = 640;

Scrn.Ycen = 512;


Does anyone have any advice on how I should make my mouse cursor locate in the center in this case?

Thank you.



XX---In PSYCHTOOLBOX@yahoogroups.com, <zzw5ytnwfgqi6qwhts5teupdvuvnnme5ske7jljr@...> wrote :

Hello,

I am running an experiment on windows, one monitor where it displays the stimuli

are in another room and the other is in the operating room where I can see the

progress of the experiment from Matlab.


-> Windows 10? Earlier Windows versions can be highly troublesome with more than 1 display connected, if you care about precise visual stimulation timing or stimulus integrity during animations/non-static stimuli. Ideally you should switch to Linux, but at least Windows-10 is less worse in my experience for dual-display setups with 1 GUI monitor, 1 stimulation monitor.


I want to have the subject to use the mouse to move a pointer on the screen and

indicate a location.

the problem is that in windows the dual mode is an extended monitor mode,

and perhaps because of this, the mouse would move beyond the actual stimuli monitor.


-> PTB currently doesn't support pointer confinement, although it would be rather simple to implement for Windows and Linux. Maybe a future feature to consider.


-> The best you could do is use GetMouse to poll the mouse position in your code and then SetMouse to reposition the cursor if it leaves the Window. However, if your subject manages to do even 1 single mouse click outside the PTB window then visual stimulation timing will be broken/no longer trustworthy for the rest of the session -- Windows 10 doesn't seem to have that specific problem as much - but no guarantee.


In addition, when I get the screen parameters with 


[window, windowRect] = PsychImaging('OpenWindow', Scrn.num, black);

% Get the size of the on screen window in pixels.

[Scrn.Xpix, Scrn.Ypix] = Screen('WindowSize', window);


% Get the centre coordinate of the window

[Scrn.Xcen, Scrn.Ycen] = RectCenter(windowRect); % pixel


and then do 

SetMouse(Scrn.Xcen, Scrn.Ycen, window);


the mouse won't show in the center, but somewhere in the other monitor.

Also, when I move around the mouse, the x coordinate goes to minus.

When I look at the Scrn parameters, the size (resolution) is correct - 

it shows the dimensions for the stimuli display monitor, which is 1280 x 1024,

and for the center coordinates it gives correctly 

Scrn.Xcen = 640;

Scrn.Ycen = 512;


-> Is your Psychtoolbox the latest 3.0.14 beta? This should work according to my development logs, unless your operating system has a bug. In your case the coordinates should be considered relative to the origin of the screen on which the 'window' was opened, ie. to screen 'Scrn.num'. What is the output of Screen('GlobalRect', Scrn.num)? I assume Scrn.num == 2 or at least not zero?


-mario



Does anyone have any advice on how I should make my mouse cursor locate in the center in this case?

Thank you.