@@ -550,12 +550,7 @@ def onEndSession(evt):
550550 wx .CallAfter (audioDucking .initialize )
551551
552552 from winAPI .messageWindow import WindowMessage
553- from winAPI .sessionTracking import (
554- handleSessionChange ,
555- registerSessionNotification ,
556- unregisterSessionNotification ,
557- WindowsTrackedSession ,
558- )
553+ from winAPI import sessionTracking
559554 import winUser
560555 # #3763: In wxPython 3, the class name of frame windows changed from wxWindowClassNR to wxWindowNR.
561556 # NVDA uses the main frame to check for and quit another instance of NVDA.
@@ -584,8 +579,8 @@ def __init__(self, windowName=None):
584579 self .orientationCoordsCache = (0 ,0 )
585580 self .handlePowerStatusChange ()
586581
587- # Call must be paired with a call to unregisterSessionNotification
588- self ._isSessionTrackingRegistered = registerSessionNotification (self .handle )
582+ # Call must be paired with a call to sessionTracking.unregister
583+ self ._isSessionTrackingRegistered = sessionTracking . register (self .handle )
589584
590585 def warnIfSessionTrackingNotRegistered (self ) -> None :
591586 if self ._isSessionTrackingRegistered :
@@ -613,18 +608,18 @@ def destroy(self):
613608 """
614609 if self ._isSessionTrackingRegistered :
615610 # Requires an active message window and a handle to unregister.
616- unregisterSessionNotification (self .handle )
611+ sessionTracking . unregister (self .handle )
617612 super ().destroy ()
618613
619614 def windowProc (self , hwnd , msg , wParam , lParam ):
620615 post_windowMessageReceipt .notify (msg = msg , wParam = wParam , lParam = lParam )
621- if msg == WindowMessage .POWERBROADCAST and wParam == self .PBT_APMPOWERSTATUSCHANGE :
616+ if msg == WindowMessage .POWER_BROADCAST and wParam == self .PBT_APMPOWERSTATUSCHANGE :
622617 self .handlePowerStatusChange ()
623618 elif msg == winUser .WM_DISPLAYCHANGE :
624619 self .handleScreenOrientationChange (lParam )
625- elif msg == WindowMessage .WTSSESSION_CHANGE :
626- # If we are receiving WTSSESSION_CHANGE events, _isSessionTrackingRegistered should be True
627- handleSessionChange (WindowsTrackedSession (wParam ), lParam )
620+ elif msg == WindowMessage .WTS_SESSION_CHANGE :
621+ # If we are receiving WTS_SESSION_CHANGE events, _isSessionTrackingRegistered should be True
622+ sessionTracking . handleSessionChange (sessionTracking . WindowsTrackedSession (wParam ), lParam )
628623
629624 def handleScreenOrientationChange (self , lParam ):
630625 # TODO: move to winAPI
0 commit comments