Skip to content

Commit fd20bbe

Browse files
committed
magnifier.js: Don't try to disable keybindings unless they've
been enabled.
1 parent 83f4a20 commit fd20bbe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

js/ui/magnifier.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,7 @@ MagnifierInputHandler.prototype = {
17151715

17161716
this._zoom_in_id = 0;
17171717
this._zoom_out_id = 0;
1718+
this._zoom_enabled = false;
17181719

17191720
this.a11y_settings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA });
17201721
this.a11y_settings.connect("changed::" + SHOW_KEY, Lang.bind(this, this._refresh_state));
@@ -1750,6 +1751,8 @@ MagnifierInputHandler.prototype = {
17501751
Meta.KeyBindingFlags.NONE,
17511752
this._zoom_reset.bind(this)
17521753
);
1754+
1755+
this._zoom_enabled = true;
17531756
},
17541757

17551758
_disable_zoom: function() {
@@ -1764,6 +1767,8 @@ MagnifierInputHandler.prototype = {
17641767
global.display.remove_keybinding("magnifier-zoom-in")
17651768
global.display.remove_keybinding("magnifier-zoom-out")
17661769
global.display.remove_keybinding("magnifier-zoom-reset")
1770+
1771+
this._zoom_enabled = false;
17671772
},
17681773

17691774
_refresh_state: function() {
@@ -1775,10 +1780,13 @@ MagnifierInputHandler.prototype = {
17751780
this.current_zoom = zr.getMagFactor()[0];
17761781
}
17771782

1778-
if (this.a11y_settings.get_boolean(SHOW_KEY))
1783+
let should_enable = this.a11y_settings.get_boolean(SHOW_KEY);
1784+
1785+
if (should_enable && !this._zoom_enabled) {
17791786
this._enable_zoom();
1780-
else
1787+
} else if (!should_enable && this._zoom_enabled) {
17811788
this._disable_zoom();
1789+
}
17821790
},
17831791

17841792
_zoom_in: function(display, screen, event, kb, action) {

0 commit comments

Comments
 (0)