Skip to content

Commit

Permalink
Merge pull request #588 from flexagoon/master
Browse files Browse the repository at this point in the history
fix: don't restore patched prototypes when suspending
  • Loading branch information
aunetx authored May 3, 2024
2 parents 8cb0e5f + 7af3721 commit ac35fdd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const OverviewBlur = class OverviewBlur {
{ name: 'bms-animation-backgroundgroup' }
);
this.enabled = false;
this.proto_patched = false;
}

enable() {
Expand All @@ -48,9 +49,9 @@ export const OverviewBlur = class OverviewBlur {

// part for the workspace animation switch

// make sure not to do this part if the extension was enabled prior, as
// make sure not to do this part if the functions were patched prior, as
// the functions would call themselves and cause infinite recursion
if (!this.enabled) {
if (!this.proto_patched) {
// store original workspace switching methods for restoring them on
// disable()
this._original_PrepareSwitch = wac_proto._prepareWorkspaceSwitch;
Expand Down Expand Up @@ -113,6 +114,8 @@ export const OverviewBlur = class OverviewBlur {

Main.uiGroup.remove_child(outer_this.animation_background_group);
};

this.proto_patched = true;
}

this.enabled = true;
Expand Down Expand Up @@ -184,18 +187,19 @@ export const OverviewBlur = class OverviewBlur {
style => Main.uiGroup.remove_style_class_name(style)
);

// make sure to absolutely not do this if the component was not enabled
// prior, as this would cause infinite recursion
if (this.enabled) {
// restore original behavior
this.connections.disconnect_all();
this.enabled = false;
}

restore_patched_proto() {
if (this.proto_patched) {
if (this._original_PrepareSwitch)
wac_proto._prepareWorkspaceSwitch = this._original_PrepareSwitch;
if (this._original_FinishSwitch)
wac_proto._finishWorkspaceSwitch = this._original_FinishSwitch;
}

this.connections.disconnect_all();
this.enabled = false;
this.proto_patched = false;
}
}

_log(str) {
Expand Down
1 change: 1 addition & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export default class BlurMyShell extends Extension {
// disable every component from user session mode
if (this._user_session_mode_enabled)
this._disable_user_session();
this._overview_blur.restore_patched_proto();

// disable lockscreen blur too
this._lockscreen_blur.disable();
Expand Down

0 comments on commit ac35fdd

Please sign in to comment.