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
|
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 {
|
if window, ok := m.windowMap[hwnd]; ok {
|
||||||
|
@ -264,11 +264,21 @@ func newMacEvents() macEvents {
|
|||||||
var Windows = newWindowsEvents()
|
var Windows = newWindowsEvents()
|
||||||
|
|
||||||
type windowsEvents struct {
|
type windowsEvents struct {
|
||||||
SystemThemeChanged ApplicationEventType
|
SystemThemeChanged ApplicationEventType
|
||||||
|
APMPowerStatusChange ApplicationEventType
|
||||||
|
APMSuspend ApplicationEventType
|
||||||
|
APMResumeAutomatic ApplicationEventType
|
||||||
|
APMResumeSuspend ApplicationEventType
|
||||||
|
APMPowerSettingChange ApplicationEventType
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWindowsEvents() windowsEvents {
|
func newWindowsEvents() windowsEvents {
|
||||||
return windowsEvents{
|
return windowsEvents{
|
||||||
SystemThemeChanged: 1146,
|
SystemThemeChanged: 1146,
|
||||||
|
APMPowerStatusChange: 1147,
|
||||||
|
APMSuspend: 1148,
|
||||||
|
APMResumeAutomatic: 1149,
|
||||||
|
APMResumeSuspend: 1150,
|
||||||
|
APMPowerSettingChange: 1151,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,4 +120,9 @@ mac:WebViewDidCommitNavigation
|
|||||||
mac:WindowFileDraggingEntered
|
mac:WindowFileDraggingEntered
|
||||||
mac:WindowFileDraggingPerformed
|
mac:WindowFileDraggingPerformed
|
||||||
mac:WindowFileDraggingExited
|
mac:WindowFileDraggingExited
|
||||||
windows:SystemThemeChanged
|
windows:SystemThemeChanged
|
||||||
|
windows:APMPowerStatusChange
|
||||||
|
windows:APMSuspend
|
||||||
|
windows:APMResumeAutomatic
|
||||||
|
windows:APMResumeSuspend
|
||||||
|
windows:APMPowerSettingChange
|
||||||
|
Loading…
Reference in New Issue
Block a user