2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2011 Nick Bolton
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2009 Sorin Sbarnea
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-02-28 13:06:25 +00:00
|
|
|
#import "platform/OSXScreenSaverUtil.h"
|
2014-02-28 12:36:45 +00:00
|
|
|
|
|
|
|
|
#import "platform/OSXScreenSaverControl.h"
|
|
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// screenSaverUtil functions
|
|
|
|
|
//
|
|
|
|
|
// Note: these helper functions exist only so we can avoid using ObjC++.
|
|
|
|
|
// autoconf/automake don't know about ObjC++ and I don't know how to
|
|
|
|
|
// teach them about it.
|
|
|
|
|
//
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void *screenSaverUtilCreatePool()
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
return [[NSAutoreleasePool alloc] init];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void screenSaverUtilReleasePool(void *pool)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
[(NSAutoreleasePool *)pool release];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void *screenSaverUtilCreateController()
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
return [[ScreenSaverController controller] retain];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void screenSaverUtilReleaseController(void *controller)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
[(ScreenSaverController *)controller release];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void screenSaverUtilEnable(void *controller)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
[(ScreenSaverController *)controller setScreenSaverCanRun:YES];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void screenSaverUtilDisable(void *controller)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
[(ScreenSaverController *)controller setScreenSaverCanRun:NO];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void screenSaverUtilActivate(void *controller)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
[(ScreenSaverController *)controller setScreenSaverCanRun:YES];
|
|
|
|
|
[(ScreenSaverController *)controller screenSaverStartNow];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
void screenSaverUtilDeactivate(void *controller, int isEnabled)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
[(ScreenSaverController *)controller screenSaverStopNow];
|
|
|
|
|
[(ScreenSaverController *)controller setScreenSaverCanRun:isEnabled];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-18 01:42:03 +00:00
|
|
|
int screenSaverUtilIsActive(void *controller)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2024-12-18 01:42:03 +00:00
|
|
|
return [(ScreenSaverController *)controller screenSaverIsRunning];
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|