@@ -44,7 +44,7 @@ var WindowPickerServiceProvider = class WindowPickerServiceProvider {
4444 lookingGlass . open ( ) ;
4545 lookingGlass . hide ( ) ;
4646
47- const inspector = new LookingGlass . Inspector ( Main . createLookingGlass ( ) ) ;
47+ const inspector = new MyInspector ( Main . createLookingGlass ( ) ) ;
4848
4949 // Release the global grab, so that we can move around freely (specially, free to use Ctrl+`
5050 // to switch windows) and pick a window that is on another workspace.
@@ -96,6 +96,9 @@ var WindowPickerServiceProvider = class WindowPickerServiceProvider {
9696 // Restore the global grab to prevent the error 'incorrect pop' thrown by LookingGlass.close/Main.popModal(this._grab)
9797 lookingGlass . _grab = Main . pushModal ( lookingGlass , { actionMode : Shell . ActionMode . LOOKING_GLASS } ) ;
9898 lookingGlass . close ( ) ;
99+ } ) ;
100+
101+ inspector . connect ( 'WindowPickCancelled' , ( ) => {
99102 this . _dbus . emit_signal ( 'WindowPickCancelled' , null ) ;
100103 } ) ;
101104 }
@@ -111,4 +114,22 @@ var WindowPickerServiceProvider = class WindowPickerServiceProvider {
111114 destroy ( ) {
112115 this . _dbus . unexport ( ) ;
113116 }
114- } ;
117+ } ;
118+
119+ var MyInspector = GObject . registerClass ( {
120+ Signals : {
121+ 'WindowPickCancelled' : { }
122+ }
123+ } , class MyInspector extends LookingGlass . Inspector {
124+ _init ( lookingGlass ) {
125+ super . _init ( lookingGlass ) ;
126+ }
127+
128+ _onKeyPressEvent ( actor , event ) {
129+ if ( event . get_key_symbol ( ) === Clutter . KEY_Escape ) {
130+ this . emit ( 'WindowPickCancelled' ) ;
131+ this . _close ( ) ;
132+ }
133+ return Clutter . EVENT_STOP ;
134+ }
135+ } ) ;
0 commit comments