doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
showcursor.c
Go to the documentation of this file.
1 /*
2  cc -o showcursor showcursor.c -framework IOKit
3 */
4 
5 #include <IOKit/IOKitLib.h>
6 #include <IOKit/hidsystem/IOHIDShared.h>
7 #include <assert.h>
8 
9 mach_port_t masterPort;
10 
11 io_connect_t OpenEventDriver( void )
12 {
13  register kern_return_t kr;
14  mach_port_t ev, service, iter;
15 
16  kr = IOServiceGetMatchingServices( masterPort, IOServiceMatching( kIOHIDSystemClass ), &iter);
17  assert( KERN_SUCCESS == kr);
18 
19  service = IOIteratorNext( iter );
20  assert(service);
21 
22  kr = IOServiceOpen( service, mach_task_self(), kIOHIDParamConnectType, &ev);
23  assert( KERN_SUCCESS == kr );
24 
25  IOObjectRelease( service );
26  IOObjectRelease( iter );
27 
28  return( ev );
29 }
30 
31 
32 void TestParams( io_connect_t ev, boolean_t show )
33 {
34  kern_return_t kr;
35 
36  kr = IOHIDSetCursorEnable( ev, show );
37  assert(KERN_SUCCESS == kr);
38 }
39 
40 int main(int argc, char **argv)
41 {
42  kern_return_t kr;
43  boolean_t show;
44 
45  if (argc != 2)
46  show = 1;
47  else
48  show = (atoi(argv[0]) != 0);
49 
50  assert( KERN_SUCCESS == ( kr = IOMasterPort( bootstrap_port, &masterPort) ));
51  TestParams( OpenEventDriver(), show);
52 
53  return( 0 );
54 }
assert(prefInfo.fullscreenBtn)
int main(int argc, char **argv)
Definition: showcursor.c:40
io_connect_t OpenEventDriver(void)
Definition: showcursor.c:11
void TestParams(io_connect_t ev, boolean_t show)
Definition: showcursor.c:32
mach_port_t masterPort
Definition: showcursor.c:9
#define show(x)
Definition: getpart.c:36