GetClicks and GetMouse behave awkwardly under Linux

Hi,

I have just started using Psychtoolbox 3 and have difficulties with using the mouse as a response device.

I am running Ubuntu 10.04 (lucid lynx) using a logitech mx518 mouse.

When I run the code attached below the function will inevitably get stuck once it executes GetClicks. I tried running in full screen vs. window mode, using longer times for the click interval and also---getting desperate---collecting the results of GetClicks. Always the same, no matter how often the mouse is clicked, GetClicks never returns.

I also tried GetMouse. Interestingly, GetMouse returns a 32-element vector in buttons and, although no mouse button has been clicked one of these 32 values is always 1. So far, I "fixed" the problem by restricting the test for mouse buttons to the first three entries. I assume there is a better way to do this? Any suggestions would be very welcome!

My apologies, if this question has been raised and answered before. I could not find any hint to a solution in the online documentation, the PTB3-slides or this forum.

Code follows:

function MouseTest()
fixW = 2;
fixL = 60;
posOW = 3;
posOL = 100;
targetDist = 100;
fixOff = 20;

KbName('UnifyKeyNames');
KbCheck;
olddebuglevel=Screen('Preference', 'VisualDebuglevel', 3);
screenNumber=max(Screen('Screens'));

% open window
expWin = Screen('OpenWindow',screenNumber,[128, 128, 128],[250 50 1530 1074]);

[mx, my] = WindowCenter(expWin);
Priority(MaxPriority(expWin));

% create first texture
fixM = repmat(ones(1,1,3)*128,fixL,fixL);
fixM([30:31],:,:) = zeros(fixW,fixL,3);
fixM(:,[30:31],:) = zeros(fixL,fixW,3);
fix = Screen('MakeTexture',expWin,fixM);

% create second texture
posOM = repmat(zeros(1,1,3), posOL, posOW);
posO = Screen('MakeTexture',expWin,posOM);

% draw textures
Screen('DrawTexture',expWin, posO, [], [mx-targetDist-posOW my-round(posOL/2) mx-targetDist my+round(posOL/2)]);
Screen('DrawTexture',expWin, fix, [], [fixOff my-round(fixL/2) fixOff+fixL my+round(fixL/2)]);
Screen('Flip', expWin);

% wait for mouse (nothing ever happens even if mouse is clicked a thousand times)
GetClicks(expWin,0);
Screen('Flip', expWin);

Priority(0);
Screen('Preference', 'VisualDebuglevel', olddebuglevel);
sca