Skip to content

Commit

Permalink
Fix blurry text when un-minimized window
Browse files Browse the repository at this point in the history
Reproduce this issues in Gnome 43.3 (Wayland)

When minimized Matlab then un-minimized it in Wayland, application
will be blurry until you have move mouse over application to
update elements.

Now, extensions will try to call queue_relayout() after 300ms timeout
to active window then remove blurry glitch.

See #104, #111
  • Loading branch information
yilozt committed Mar 13, 2023
1 parent 68818b5 commit cd77b23
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/manager/rounded_corners_manager.ts
@@ -1,5 +1,6 @@
// imports.gi
import * as Clutter from '@gi/Clutter'
import * as GLib from '@gi/GLib'
import { ShadowMode, WindowType } from '@gi/Meta'
import { WindowClientType } from '@gi/Meta'
import { Bin } from '@gi/St'
Expand Down Expand Up @@ -76,7 +77,11 @@ export class RoundedCornersManager implements EffectManager {
const visible_binding = actor.bind_property (prop, shadow, prop, flag)

// Store shadow, app type, visible binding, so that we can query them later
actor.__rwc_rounded_window_info = { shadow, visible_binding }
actor.__rwc_rounded_window_info = {
shadow,
visible_binding,
unminimized_timeout_id: 0,
}
}

on_remove_effect (actor: ExtensionsWindowActor): void {
Expand All @@ -96,6 +101,10 @@ export class RoundedCornersManager implements EffectManager {
shadow.clear_effects ()
shadow.destroy ()
}

// Remove all timeout handler
const timeout_id = actor.__rwc_rounded_window_info?.unminimized_timeout_id
if (timeout_id) GLib.source_remove (timeout_id)
delete actor.__rwc_rounded_window_info
}

Expand All @@ -111,6 +120,22 @@ export class RoundedCornersManager implements EffectManager {

on_unminimize (actor: ExtensionsWindowActor): void {
this._restore_shadow (actor)

// Requeue layout after 300ms
if (actor.first_child && actor.__rwc_rounded_window_info) {
const info = actor.__rwc_rounded_window_info

// Clear prev handler
let id = info.unminimized_timeout_id
if (id) GLib.source_remove (id)
id = GLib.timeout_add (GLib.PRIORITY_DEFAULT, 300, () => {
actor.first_child.queue_relayout ()
return false
})

// update handler, it will be clear when window is closed
info.unminimized_timeout_id = id
}
}

on_switch_workspace (actor: types.ExtensionsWindowActor) {
Expand Down
1 change: 1 addition & 0 deletions src/utils/types.ts
Expand Up @@ -69,6 +69,7 @@ export type ExtensionsWindowActor = WindowActor & {
__rwc_rounded_window_info?: {
shadow: Bin
visible_binding: Binding
unminimized_timeout_id: number
}
__rwc_blurred_window_info?: {
blur_actor: Actor
Expand Down

0 comments on commit cd77b23

Please sign in to comment.