mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Separate libslic3r code from slic3r application code
This commit is contained in:
parent
7eb3a70649
commit
7e1fac8f76
7 changed files with 9 additions and 9 deletions
39
xs/src/slic3r/GUI/GUI.cpp
Normal file
39
xs/src/slic3r/GUI/GUI.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "GUI.hpp"
|
||||
|
||||
#if __APPLE__
|
||||
#import <IOKit/pwr_mgt/IOPMLib.h>
|
||||
#elif _WIN32
|
||||
#include <Windows.h>
|
||||
#pragma comment(lib, "user32.lib")
|
||||
#endif
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
#if __APPLE__
|
||||
IOPMAssertionID assertionID;
|
||||
#endif
|
||||
|
||||
void
|
||||
disable_screensaver()
|
||||
{
|
||||
#if __APPLE__
|
||||
CFStringRef reasonForActivity = CFSTR("Slic3r");
|
||||
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
|
||||
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
|
||||
// ignore result: success == kIOReturnSuccess
|
||||
#elif _WIN32
|
||||
SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_CONTINUOUS);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
enable_screensaver()
|
||||
{
|
||||
#if __APPLE__
|
||||
IOReturn success = IOPMAssertionRelease(assertionID);
|
||||
#elif _WIN32
|
||||
SetThreadExecutionState(ES_CONTINUOUS);
|
||||
#endif
|
||||
}
|
||||
|
||||
} }
|
Loading…
Add table
Add a link
Reference in a new issue