fix: remove extra 'suspend'/'resume' handling from powerMonitor (#47162)
fix: remove extra 'suspend'/'resume' handling from powerMonitor
This commit is contained in:
parent
7112c592c9
commit
7b77a24211
2 changed files with 0 additions and 35 deletions
|
|
@ -34,17 +34,6 @@
|
||||||
selector:@selector(onScreenUnlocked:)
|
selector:@selector(onScreenUnlocked:)
|
||||||
name:@"com.apple.screenIsUnlocked"
|
name:@"com.apple.screenIsUnlocked"
|
||||||
object:nil];
|
object:nil];
|
||||||
// A notification that the workspace posts before the machine goes to sleep.
|
|
||||||
[distributed_center addObserver:self
|
|
||||||
selector:@selector(isSuspending:)
|
|
||||||
name:NSWorkspaceWillSleepNotification
|
|
||||||
object:nil];
|
|
||||||
// A notification that the workspace posts when the machine wakes from
|
|
||||||
// sleep.
|
|
||||||
[distributed_center addObserver:self
|
|
||||||
selector:@selector(isResuming:)
|
|
||||||
name:NSWorkspaceDidWakeNotification
|
|
||||||
object:nil];
|
|
||||||
|
|
||||||
NSNotificationCenter* shared_center =
|
NSNotificationCenter* shared_center =
|
||||||
[[NSWorkspace sharedWorkspace] notificationCenter];
|
[[NSWorkspace sharedWorkspace] notificationCenter];
|
||||||
|
|
@ -73,18 +62,6 @@
|
||||||
self->emitters.push_back(monitor_);
|
self->emitters.push_back(monitor_);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)isSuspending:(NSNotification*)notify {
|
|
||||||
for (auto* emitter : self->emitters) {
|
|
||||||
emitter->Emit("suspend");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)isResuming:(NSNotification*)notify {
|
|
||||||
for (auto* emitter : self->emitters) {
|
|
||||||
emitter->Emit("resume");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)onScreenLocked:(NSNotification*)notification {
|
- (void)onScreenLocked:(NSNotification*)notification {
|
||||||
for (auto* emitter : self->emitters) {
|
for (auto* emitter : self->emitters) {
|
||||||
emitter->Emit("lock-screen");
|
emitter->Emit("lock-screen");
|
||||||
|
|
|
||||||
|
|
@ -88,18 +88,6 @@ LRESULT CALLBACK PowerMonitor::WndProc(HWND hwnd,
|
||||||
base::Unretained(this)));
|
base::Unretained(this)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (message == WM_POWERBROADCAST) {
|
|
||||||
if (wparam == PBT_APMRESUMEAUTOMATIC) {
|
|
||||||
content::GetUIThreadTaskRunner({})->PostTask(
|
|
||||||
FROM_HERE,
|
|
||||||
base::BindOnce([](PowerMonitor* pm) { pm->Emit("resume"); },
|
|
||||||
base::Unretained(this)));
|
|
||||||
} else if (wparam == PBT_APMSUSPEND) {
|
|
||||||
content::GetUIThreadTaskRunner({})->PostTask(
|
|
||||||
FROM_HERE,
|
|
||||||
base::BindOnce([](PowerMonitor* pm) { pm->Emit("suspend"); },
|
|
||||||
base::Unretained(this)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ::DefWindowProc(hwnd, message, wparam, lparam);
|
return ::DefWindowProc(hwnd, message, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue