Skip to content

Commit

Permalink
LockScreen placeholder in kext
Browse files Browse the repository at this point in the history
  • Loading branch information
integralpro committed Aug 16, 2012
1 parent b1176ae commit 03eb3fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions NoSleep/NoSleepKext/NoSleepKext/NoSleepExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#include <IOKit/IOPlatformExpert.h>
#include <IOKit/IOUserClient.h>

#include <mach/port.h>
#include <mach/task.h>
#include <kern/task.h>
#include <kern/task.h>

#define super IOService
OSDefineMetaClassAndStructors( NoSleepExtension, IOService );

Expand Down Expand Up @@ -58,7 +63,16 @@ IOReturn NoSleepExtension::clamshellEventInterestHandler(UInt32 messageType, IOS
if(clamshellShouldSleep) {
pRootDomain->receivePowerNotification(kIOPMDisableClamshell);
}

// Lock screen when lid closed
if(clamshellState == true && oldClamshellState == false) {
//notify_post("com.apple.loginwindow.notify");
//mach_port_t bp = bootstrap_port;
//task_get_bootstrap_port(bootstrap_port, &bp);
}
}

oldClamshellState = clamshellState;
}

return kIOReturnSuccess;
Expand Down Expand Up @@ -96,6 +110,9 @@ bool NoSleepExtension::start( IOService * provider )
if( !super::start( provider ))
return( false );

task_t x = current_task();
//IOLog("task: %p, %p\n", x, bootstrap_port);

delayTimer = thread_call_allocate(_switchOffUserSleepDisabled, (thread_call_param_t) this);

isSleepStateInitialized = false;
Expand Down
1 change: 1 addition & 0 deletions NoSleep/NoSleepKext/NoSleepKext/NoSleepExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class NoSleepExtension : public IOService

bool isClamshellStateInitialized:1;
bool clamshellState:1;
bool oldClamshellState:1;
bool clamshellShouldSleep:1;

bool forceClientMessage;
Expand Down

0 comments on commit 03eb3fb

Please sign in to comment.