@@ -29,30 +29,23 @@ import * as AltTab from "resource:///org/gnome/shell/ui/altTab.js";
2929
3030import * as Overview from "resource:///org/gnome/shell/ui/overview.js" ;
3131
32- const seat = Clutter . get_default_backend ( ) . get_default_seat ( ) ;
33- const vdevice = seat . create_virtual_device (
34- Clutter . InputDeviceType . POINTER_DEVICE
35- ) ;
36-
37- function movePointer ( ) {
38- const [ x , y ] = global . get_pointer ( ) ;
39- vdevice . notify_absolute_motion ( global . get_current_time ( ) , x , y ) ;
40- }
4132
4233export default class AltTabScrollWorkaroundExtension extends Extension {
43- constructor ( metadata ) {
44- super ( metadata ) ;
34+ enable ( ) {
4535 this . _injectionManager = new InjectionManager ( ) ;
46- }
36+ const seat = Clutter . get_default_backend ( ) . get_default_seat ( ) ;
37+ this . vdevice = seat . create_virtual_device (
38+ Clutter . InputDeviceType . POINTER_DEVICE
39+ ) ;
4740
48- enable ( ) {
4941 // Fix for Alt+Tab (switch windows)
5042 this . _injectionManager . overrideMethod (
5143 AltTab . WindowSwitcherPopup . prototype ,
5244 "_finish" ,
5345 ( originalMethod ) => {
46+ let that = this ;
5447 return function ( ) {
55- movePointer ( ) ;
48+ that . movePointer ( ) ;
5649 originalMethod . call ( this ) ;
5750 } ;
5851 }
@@ -63,9 +56,10 @@ export default class AltTabScrollWorkaroundExtension extends Extension {
6356 AltTab . AppSwitcherPopup . prototype ,
6457 "_finish" ,
6558 ( originalMethod ) => {
59+ let that = this ;
6660 return function ( timestamp ) {
6761 if ( this . _currentWindow < 0 ) {
68- movePointer ( ) ;
62+ that . movePointer ( ) ;
6963 }
7064 originalMethod . call ( this , timestamp ) ;
7165 } ;
@@ -77,8 +71,9 @@ export default class AltTabScrollWorkaroundExtension extends Extension {
7771 AltTab . WindowCyclerPopup . prototype ,
7872 "_finish" ,
7973 ( originalMethod ) => {
74+ let that = this ;
8075 return function ( ) {
81- movePointer ( ) ;
76+ that . movePointer ( ) ;
8277 originalMethod . call ( this ) ;
8378 } ;
8479 }
@@ -89,15 +84,23 @@ export default class AltTabScrollWorkaroundExtension extends Extension {
8984 Overview . Overview . prototype ,
9085 '_showDone' ,
9186 ( originalMethod ) => {
87+ let that = this ;
9288 return function ( ) {
93- movePointer ( ) ;
89+ that . movePointer ( ) ;
9490 originalMethod . call ( this ) ;
9591 } ;
9692 }
9793 ) ;
9894 }
9995
96+ movePointer ( ) {
97+ const [ x , y ] = global . get_pointer ( ) ;
98+ this . vdevice . notify_absolute_motion ( global . get_current_time ( ) , x , y ) ;
99+ }
100+
100101 disable ( ) {
101102 this . _injectionManager . clear ( ) ;
103+ this . _injectionManager = null ;
104+ this . vdevice = null ;
102105 }
103106}
0 commit comments