File: SCREENSetMouseHelper.c

package info (click to toggle)
psychtoolbox-3 3.0.9%2Bsvn2579.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 63,408 kB
  • sloc: ansic: 73,310; cpp: 11,139; objc: 3,129; sh: 1,669; python: 382; php: 272; makefile: 172; java: 113
file content (75 lines) | stat: -rwxr-xr-x 2,343 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
	SCREENSetMouseHelper.c	
  
	AUTHORS:

		Allen.Ingling@nyu.edu		awi 
		mario.kleiner@tuebingen.mpg.de  mk

	PLATFORMS:	
	
		All.
    
	HISTORY:

		12/14/02	awi		Created.
		10/12/04	awi		Changed "SCREEN" to "Screen" in useString.
		11/16/04	awi		Added "Helper" suffix. 
		11/18/04	awi		Renamed to SetMousHelper from PositionCursorHelper

	DESCRIPTION:
  
		Position the mouse pointer

	TO DO:
  
		-The hidecursor.m script should be modified to invoke hidecursor through screen only on OS X.  On other platforms it is a 
		separate mex file.  
  
		-If we store a pointer to the window and screen lists in shared memory (accessible between mex files) then 
		we could implement this a a seperate mex file.  Seems more natural to do it from SCREEN though.  Let's wait and
		see what Windows and Linux are like before changeing it to a separate mex file.  
  
		-Since all that we pass to the underlying CoreGraphics call is a screen ID, maybe we don't in face need to 
		have opened an onscreen window to more the mouse pointer.  Test that.   We will have to have enumberated the 
		displays though.  
  

*/


#include "Screen.h"


// If you change the useString then also change the corresponding synopsis string in ScreenSynopsis.c
static char useString[] = "Screen('SetMouseHelper', windowPntrOrScreenNumber, x, y [, mouseIndex]);";
//                                                  1                         2  3  4
static char synopsisString[] = 
	"This is a helper function called by SetMouse.  Do not call Screen(\'SetMouseHelper\'), use "
	"SetMouse instead.\n"

	"Move the mouse pointer";
static char seeAlsoString[] = "";
	 
PsychError SCREENSetMouseHelper(void) 
{
	int	screenNumber;
	int 	xPos, yPos;
	int     deviceIdx = -1;

	//all subfunctions should have these two lines.
	PsychPushHelp(useString, synopsisString, seeAlsoString);
	if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
	
	PsychErrorExit(PsychCapNumInputArgs(4));   //The maximum number of inputs
	PsychErrorExit(PsychCapNumOutputArgs(0));  //The maximum number of outputs
        
	PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
	PsychCopyInIntegerArg(2,TRUE, &xPos);
	PsychCopyInIntegerArg(3,TRUE, &yPos);
	PsychCopyInIntegerArg(4,FALSE, &deviceIdx);

	PsychPositionCursor(screenNumber, xPos, yPos, deviceIdx);

	return(PsychError_none);
}