mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-06 16:49:12 +08:00
[v3 windows] Add APM Events
This commit is contained in:
parent
f08ae2fc62
commit
402b743553
@ -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 {
|
||||
|
@ -265,10 +265,20 @@ var Windows = newWindowsEvents()
|
||||
|
||||
type windowsEvents struct {
|
||||
SystemThemeChanged ApplicationEventType
|
||||
APMPowerStatusChange ApplicationEventType
|
||||
APMSuspend ApplicationEventType
|
||||
APMResumeAutomatic ApplicationEventType
|
||||
APMResumeSuspend ApplicationEventType
|
||||
APMPowerSettingChange ApplicationEventType
|
||||
}
|
||||
|
||||
func newWindowsEvents() windowsEvents {
|
||||
return windowsEvents{
|
||||
SystemThemeChanged: 1146,
|
||||
APMPowerStatusChange: 1147,
|
||||
APMSuspend: 1148,
|
||||
APMResumeAutomatic: 1149,
|
||||
APMResumeSuspend: 1150,
|
||||
APMPowerSettingChange: 1151,
|
||||
}
|
||||
}
|
||||
|
@ -121,3 +121,8 @@ mac:WindowFileDraggingEntered
|
||||
mac:WindowFileDraggingPerformed
|
||||
mac:WindowFileDraggingExited
|
||||
windows:SystemThemeChanged
|
||||
windows:APMPowerStatusChange
|
||||
windows:APMSuspend
|
||||
windows:APMResumeAutomatic
|
||||
windows:APMResumeSuspend
|
||||
windows:APMPowerSettingChange
|
||||
|
Loading…
Reference in New Issue
Block a user