@@ -22,6 +22,7 @@ import { connections } from '@me/utils/connections'
22
22
import { SchemasKeys , settings } from '@me/utils/settings'
23
23
import { Services } from '@me/dbus/services'
24
24
import { LinearFilterEffect } from '@me/effect/linear_filter_effect'
25
+ import { RoundedCornersEffect } from '@me/effect/rounded_corners_effect'
25
26
import { init_translations } from '@me/utils/i18n'
26
27
27
28
// types, which will be removed in output
@@ -182,11 +183,67 @@ export class Extension {
182
183
}
183
184
this . insert_child_below ( shadow_clone , window_container )
184
185
186
+ // In Gnome 43, preview windows in overview will be blurry if there are
187
+ // more than two workspaces using, We need add rounded corners to preview
188
+ // window in overview manually to avoid blurry preview windows.
189
+ type TypeRoundedCornersEffect =
190
+ | InstanceType < typeof RoundedCornersEffect >
191
+ | null
192
+ | undefined
193
+ let rounded_effect_of_window_actor : TypeRoundedCornersEffect = null
194
+ if ( UI . shell_version ( ) >= 43 ) {
195
+ // Name of rounded corners effect added to preview window
196
+ const name = 'Rounded Corners Effect (Overview)'
197
+
198
+ // Disabled rounded corners of window temporarily when enter overview
199
+ const window_actor : WindowActor = window . get_compositor_private ( )
200
+ rounded_effect_of_window_actor =
201
+ self . _rounded_corners_manager ?. get_rounded_corners_effect (
202
+ window_actor
203
+ )
204
+ rounded_effect_of_window_actor ?. set_enabled ( false )
205
+
206
+ // Add rounded corners effect to preview window actor
207
+ first_child . add_effect_with_name ( name , new RoundedCornersEffect ( ) )
208
+
209
+ // Update uniform variables of rounded corners effect when size of
210
+ // preview windows in overview changed.
211
+ const c = connections . get ( )
212
+ c . connect ( this , 'notify::width' , ( ) => {
213
+ const rounded_effect_of_preview_window = first_child ?. get_effect (
214
+ name
215
+ ) as TypeRoundedCornersEffect
216
+ if ( ! rounded_effect_of_preview_window ) {
217
+ return
218
+ }
219
+
220
+ const buf_rect = window . get_buffer_rect ( )
221
+ const frame_rect = window . get_frame_rect ( )
222
+ const scaled = this . window_container . get_width ( ) / frame_rect . width
223
+ const x1 = ( frame_rect . x - buf_rect . x ) * scaled
224
+ const y1 = ( frame_rect . y - buf_rect . y ) * scaled
225
+ const x2 = x1 + frame_rect . width * scaled
226
+ const y2 = y1 + frame_rect . height * scaled
227
+ rounded_effect_of_preview_window . update_uniforms (
228
+ scaled ,
229
+ settings ( ) . global_rounded_corner_settings ,
230
+ { x1, y1, x2, y2 }
231
+ )
232
+ } )
233
+ }
234
+
185
235
// Disconnect all signals when Window preview in overview is destroy
186
- const c = connections . get ( )
187
236
c . connect ( this , 'destroy' , ( ) => {
237
+ shadow_clone . destroy ( )
188
238
first_child ?. clear_effects ( )
189
239
first_child = null
240
+
241
+ // Enabled rounded corners of window actor when leaving overview,
242
+ // works for gnome 43.
243
+ if ( overview . _overview . controls . _workspacesDisplay . _leavingOverview ) {
244
+ rounded_effect_of_window_actor ?. set_enabled ( true )
245
+ }
246
+
190
247
c . disconnect_all ( this )
191
248
} )
192
249
}
@@ -384,7 +441,10 @@ const OverviewShadowActor = registerClass (
384
441
: this . _window_preview . get_allocation_box ( )
385
442
386
443
// Meta.Window contain the all information about a window
387
- const meta_win = this . _window_preview . _windowActor . meta_window
444
+ const meta_win = this . _window_preview . _windowActor . get_meta_window ( )
445
+ if ( ! meta_win ) {
446
+ return
447
+ }
388
448
389
449
// As we known, preview shown in overview has been scaled
390
450
// in overview
0 commit comments