[v3 windows] Add APM Events

This commit is contained in:
Lea Anthony
2023-05-30 16:31:48 +08:00
committed by Misite Bao
parent f08ae2fc62
commit 402b743553
3 changed files with 32 additions and 3 deletions
+14
View File
@@ -139,6 +139,20 @@ func (m *windowsApp) wndProc(hwnd w32.HWND, msg uint32, wParam, lParam uintptr)
}
}
return 0
case w32.WM_POWERBROADCAST:
switch wParam {
case w32.PBT_APMPOWERSTATUSCHANGE:
applicationEvents <- uint(events.Windows.APMPowerStatusChange)
case w32.PBT_APMSUSPEND:
applicationEvents <- uint(events.Windows.APMSuspend)
case w32.PBT_APMRESUMEAUTOMATIC:
applicationEvents <- uint(events.Windows.APMResumeAutomatic)
case w32.PBT_APMRESUMESUSPEND:
applicationEvents <- uint(events.Windows.APMResumeSuspend)
case w32.PBT_POWERSETTINGCHANGE:
applicationEvents <- uint(events.Windows.APMPowerSettingChange)
}
return 0
}
if window, ok := m.windowMap[hwnd]; ok {
+12 -2
View File
@@ -264,11 +264,21 @@ func newMacEvents() macEvents {
var Windows = newWindowsEvents()
type windowsEvents struct {
SystemThemeChanged ApplicationEventType
SystemThemeChanged ApplicationEventType
APMPowerStatusChange ApplicationEventType
APMSuspend ApplicationEventType
APMResumeAutomatic ApplicationEventType
APMResumeSuspend ApplicationEventType
APMPowerSettingChange ApplicationEventType
}
func newWindowsEvents() windowsEvents {
return windowsEvents{
SystemThemeChanged: 1146,
SystemThemeChanged: 1146,
APMPowerStatusChange: 1147,
APMSuspend: 1148,
APMResumeAutomatic: 1149,
APMResumeSuspend: 1150,
APMPowerSettingChange: 1151,
}
}
+6 -1
View File
@@ -120,4 +120,9 @@ mac:WebViewDidCommitNavigation
mac:WindowFileDraggingEntered
mac:WindowFileDraggingPerformed
mac:WindowFileDraggingExited
windows:SystemThemeChanged
windows:SystemThemeChanged
windows:APMPowerStatusChange
windows:APMSuspend
windows:APMResumeAutomatic
windows:APMResumeSuspend
windows:APMPowerSettingChange