1 | /*
|
---|
2 | * synergy -- mouse and keyboard sharing utility
|
---|
3 | * Copyright (C) 2004 Chris Schoeneman
|
---|
4 | *
|
---|
5 | * This package is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * found in the file COPYING that should have accompanied this file.
|
---|
8 | *
|
---|
9 | * This package is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | * GNU General Public License for more details.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #import "COSXScreenSaverUtil.h"
|
---|
16 | #import "OSXScreenSaverControl.h"
|
---|
17 | #import <Foundation/NSAutoreleasePool.h>
|
---|
18 |
|
---|
19 | //
|
---|
20 | // screenSaverUtil functions
|
---|
21 | //
|
---|
22 | // Note: these helper functions exist only so we can avoid using ObjC++.
|
---|
23 | // autoconf/automake don't know about ObjC++ and I don't know how to
|
---|
24 | // teach them about it.
|
---|
25 | //
|
---|
26 |
|
---|
27 | void*
|
---|
28 | screenSaverUtilCreatePool()
|
---|
29 | {
|
---|
30 | return [[NSAutoreleasePool alloc] init];
|
---|
31 | }
|
---|
32 |
|
---|
33 | void
|
---|
34 | screenSaverUtilReleasePool(void* pool)
|
---|
35 | {
|
---|
36 | [(NSAutoreleasePool*)pool release];
|
---|
37 | }
|
---|
38 |
|
---|
39 | void*
|
---|
40 | screenSaverUtilCreateController()
|
---|
41 | {
|
---|
42 | return [[ScreenSaverController controller] retain];
|
---|
43 | }
|
---|
44 |
|
---|
45 | void
|
---|
46 | screenSaverUtilReleaseController(void* controller)
|
---|
47 | {
|
---|
48 | [(ScreenSaverController*)controller release];
|
---|
49 | }
|
---|
50 |
|
---|
51 | void
|
---|
52 | screenSaverUtilEnable(void* controller)
|
---|
53 | {
|
---|
54 | [(ScreenSaverController*)controller setScreenSaverCanRun:YES];
|
---|
55 | }
|
---|
56 |
|
---|
57 | void
|
---|
58 | screenSaverUtilDisable(void* controller)
|
---|
59 | {
|
---|
60 | [(ScreenSaverController*)controller setScreenSaverCanRun:NO];
|
---|
61 | }
|
---|
62 |
|
---|
63 | void
|
---|
64 | screenSaverUtilActivate(void* controller)
|
---|
65 | {
|
---|
66 | [(ScreenSaverController*)controller setScreenSaverCanRun:YES];
|
---|
67 | [(ScreenSaverController*)controller screenSaverStartNow];
|
---|
68 | }
|
---|
69 |
|
---|
70 | void
|
---|
71 | screenSaverUtilDeactivate(void* controller, int isEnabled)
|
---|
72 | {
|
---|
73 | [(ScreenSaverController*)controller screenSaverStopNow];
|
---|
74 | [(ScreenSaverController*)controller setScreenSaverCanRun:isEnabled];
|
---|
75 | }
|
---|
76 |
|
---|
77 | int
|
---|
78 | screenSaverUtilIsActive(void* controller)
|
---|
79 | {
|
---|
80 | return [(ScreenSaverController*)controller screenSaverIsRunning];
|
---|
81 | }
|
---|