@@ -770,35 +770,41 @@ static void nxagentToggleAutoGrab(void)
770770 }
771771}
772772
773- /* TODO: drop inputlock when switching to Fullscreen */
774- static void nxagentLockInput (void )
773+ static void nxagentEnableInputlock (void )
775774{
776- #ifdef DEBUG
777- if (inputlock )
778- fprintf (stderr , "releasing inputlock\n" );
779- else
780- fprintf (stderr , "activating inputlock\n" );
781- #endif
775+ #ifdef DEBUG
776+ fprintf (stderr , "activating inputlock\n" );
777+ #endif
778+ setWinNameSuffix ("input locked" );
779+ XGrabPointer (nxagentDisplay ,nxagentDefaultWindows [0 ], True ,
780+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask | EnterWindowMask | LeaveWindowMask ,
781+ GrabModeAsync , GrabModeAsync , nxagentDefaultWindows [0 ], None , CurrentTime );
782+ inputlock = True ;
783+ }
784+
785+ static void nxagentDisableInputlock (void )
786+ {
787+ #ifdef DEBUG
788+ fprintf (stderr , "deactivating inputlock\n" );
789+ #endif
790+ nxagentUngrabPointerAndKeyboard (NULL );
791+ XTextProperty name = {
792+ .value = (unsigned char * )nxagentWindowName ,
793+ .encoding = XA_STRING ,
794+ .format = 8 ,
795+ .nitems = strlen ((char * ) name .value )
796+ };
797+ setWinNameSuffix (NULL );
798+ inputlock = False ;
799+ }
782800
801+ /* TODO: drop inputlock when switching to Fullscreen */
802+ static void nxagentToggleInputLock (void )
803+ {
783804 if (!inputlock )
784- {
785- setWinNameSuffix ("input locked" );
786- XGrabPointer (nxagentDisplay ,nxagentDefaultWindows [0 ], True ,
787- ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask | EnterWindowMask | LeaveWindowMask ,
788- GrabModeAsync , GrabModeAsync , nxagentDefaultWindows [0 ], None , CurrentTime );
789- }
805+ nxagentEnableInputlock ();
790806 else
791- {
792- nxagentUngrabPointerAndKeyboard (NULL );
793- XTextProperty name = {
794- .value = (unsigned char * )nxagentWindowName ,
795- .encoding = XA_STRING ,
796- .format = 8 ,
797- .nitems = strlen ((char * ) name .value )
798- };
799- setWinNameSuffix (NULL );
800- }
801- inputlock = !inputlock ;
807+ nxagentDisableInputlock ();
802808}
803809
804810static Bool nxagentExposurePredicate (Display * display , XEvent * event , XPointer window )
@@ -1200,9 +1206,9 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
12001206
12011207 break ;
12021208 }
1203- case doLockInput :
1209+ case doInputLock :
12041210 {
1205- nxagentLockInput ();
1211+ nxagentToggleInputLock ();
12061212
12071213 break ;
12081214 }
0 commit comments