Skip to content

Commit aa71064

Browse files
committed
Make sure rounded corners works when open Wayland application
After Gnome 43.1, we start use surface actor (Meta.WindowActor.first_child) It's necessary to detect the changes of size for surface actor, so that to make sure rounded corners has been updated properly when opening Wayland applications.
1 parent 91d1daa commit aa71064

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/manager/effect_manager.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// imports.gi
22
import * as Clutter from '@gi/Clutter'
3-
import { Source, timeout_add } from '@gi/GLib'
43
import * as Graphene from '@gi/Graphene'
54

65
// local modules
@@ -18,6 +17,7 @@ import { WM } from '@gi/Shell'
1817
import { global } from '@global'
1918
import * as Gio from '@gi/Gio'
2019
import { Display } from '@gi/Meta'
20+
import { shell_version } from '@me/utils/ui'
2121

2222
// --------------------------------------------------------------- [end imports]
2323

@@ -29,7 +29,6 @@ export class WindowActorTracker {
2929
* disconnect_all() to disconnect all signals when extension disabled
3030
*/
3131
private connections: Connections | null = null
32-
private timeout_id = 0
3332

3433
// ---------------------------------------------------------- [public methods]
3534

@@ -135,9 +134,6 @@ export class WindowActorTracker {
135134
// Disconnect all signal
136135
this.connections?.disconnect_all ()
137136
this.connections = null
138-
139-
// Remove main loop resource
140-
Source.remove (this.timeout_id)
141137
}
142138

143139
// ------------------------------------------------------- [private methods]
@@ -167,6 +163,17 @@ export class WindowActorTracker {
167163
}
168164
})
169165

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+
170177
// Update shadow actor when focus of window has changed.
171178
this.connections.connect (
172179
actor.meta_window,
@@ -191,10 +198,7 @@ export class WindowActorTracker {
191198
}
192199

193200
if (actor.first_child) {
194-
this.timeout_id = timeout_add (0, 500, () => {
195-
actor_is_ready ()
196-
return false
197-
})
201+
actor_is_ready ()
198202
} else {
199203
// In wayland session, Surface Actor of XWayland client not ready when
200204
// window created, waiting it
@@ -213,6 +217,7 @@ export class WindowActorTracker {
213217
this.connections.disconnect_all (actor.get_texture ())
214218
this.connections.disconnect_all (actor)
215219
this.connections.disconnect_all (actor.meta_window)
220+
this.connections.disconnect_all (actor.first_child)
216221
}
217222
this.run ((m) => m.on_remove_effect (actor))
218223
}

0 commit comments

Comments
 (0)