mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-10 17:49:20 +08:00
[feat] add lock screen on disconnect option, refs #125
This commit is contained in:
@@ -45,6 +45,7 @@ int GuiApplication::RunUnattended(void* stop_event) {
|
||||
if (CreateConnectionPeer() != 0) CloseConnectionPeer();
|
||||
}
|
||||
HandleConnectionStatusChange();
|
||||
HandleScreenLock();
|
||||
HandleWindowsServiceIntegration();
|
||||
devices_.UpdateInteractions();
|
||||
ShareLocalCursorState();
|
||||
@@ -71,6 +72,7 @@ int GuiApplication::RunUnattended(void* stop_event) {
|
||||
devices_.DestroyDevices();
|
||||
devices_.DestroyFactories();
|
||||
privacy_.Shutdown();
|
||||
HandleScreenLock();
|
||||
WriteUnattendedStatus(settings_.ActiveIdentity(), false, session);
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @Author: DI JUNKUN
|
||||
* @Date: 2026-10-25
|
||||
* Copyright (c) 2026 by DI JUNKUN, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "screen_lock.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "rd_log.h"
|
||||
|
||||
namespace crossdesk {
|
||||
|
||||
bool LockScreen() {
|
||||
if (LockWorkStation()) return true;
|
||||
LOG_WARN("LockWorkStation failed: {}", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace crossdesk
|
||||
Reference in New Issue
Block a user