1
1
// imports.gi
2
2
import * as Clutter from '@gi/Clutter'
3
- import { Source , timeout_add } from '@gi/GLib'
4
3
import * as Graphene from '@gi/Graphene'
5
4
6
5
// local modules
@@ -18,6 +17,7 @@ import { WM } from '@gi/Shell'
18
17
import { global } from '@global'
19
18
import * as Gio from '@gi/Gio'
20
19
import { Display } from '@gi/Meta'
20
+ import { shell_version } from '@me/utils/ui'
21
21
22
22
// --------------------------------------------------------------- [end imports]
23
23
@@ -29,7 +29,6 @@ export class WindowActorTracker {
29
29
* disconnect_all() to disconnect all signals when extension disabled
30
30
*/
31
31
private connections : Connections | null = null
32
- private timeout_id = 0
33
32
34
33
// ---------------------------------------------------------- [public methods]
35
34
@@ -135,9 +134,6 @@ export class WindowActorTracker {
135
134
// Disconnect all signal
136
135
this . connections ?. disconnect_all ( )
137
136
this . connections = null
138
-
139
- // Remove main loop resource
140
- Source . remove ( this . timeout_id )
141
137
}
142
138
143
139
// ------------------------------------------------------- [private methods]
@@ -167,6 +163,17 @@ export class WindowActorTracker {
167
163
}
168
164
} )
169
165
166
+ if ( shell_version ( ) >= 43.1 ) {
167
+ // let's update effects when surface size of window actor changed in the
168
+ // first time. After Gnome 43.1, we need do this to make sure effects
169
+ // works when wayland client opened.
170
+ const id = actor . first_child . connect ( 'notify::size' , ( ) => {
171
+ this . run ( ( m ) => m . on_size_changed ( actor ) )
172
+ // Now updated, just disconnect it
173
+ actor . first_child . disconnect ( id )
174
+ } )
175
+ }
176
+
170
177
// Update shadow actor when focus of window has changed.
171
178
this . connections . connect (
172
179
actor . meta_window ,
@@ -191,10 +198,7 @@ export class WindowActorTracker {
191
198
}
192
199
193
200
if ( actor . first_child ) {
194
- this . timeout_id = timeout_add ( 0 , 500 , ( ) => {
195
- actor_is_ready ( )
196
- return false
197
- } )
201
+ actor_is_ready ( )
198
202
} else {
199
203
// In wayland session, Surface Actor of XWayland client not ready when
200
204
// window created, waiting it
@@ -213,6 +217,7 @@ export class WindowActorTracker {
213
217
this . connections . disconnect_all ( actor . get_texture ( ) )
214
218
this . connections . disconnect_all ( actor )
215
219
this . connections . disconnect_all ( actor . meta_window )
220
+ this . connections . disconnect_all ( actor . first_child )
216
221
}
217
222
this . run ( ( m ) => m . on_remove_effect ( actor ) )
218
223
}
0 commit comments