Skip to content

Commit

Permalink
Extensions: Fix critical errors (#804)
Browse files Browse the repository at this point in the history
* DesktopCube: Fix critical errors

* smart-panel: Fix critical errors
  • Loading branch information
claudiux authored Jan 3, 2025
1 parent 2145922 commit fe76390
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 3 additions & 1 deletion DesktopCube@yare/files/DesktopCube@yare/5.4/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ Cube.prototype = {
},

_keyPressEvent: function(actor, event) {
if (!enabled) return Clutter.EVENT_PROPAGATE;
let workspace;
let windows;
let window;
Expand Down Expand Up @@ -755,7 +756,8 @@ Cube.prototype = {
}
},

_keyReleaseEvent: function() {
_keyReleaseEvent: function(actor, event) {
if (!enabled) return Clutter.EVENT_PROPAGATE;
let [x, y, mods] = global.get_pointer();
let state = mods & this._modifierMask;

Expand Down
2 changes: 1 addition & 1 deletion DesktopCube@yare/files/DesktopCube@yare/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"4.6",
"5.4"
],
"version": "2.0.2",
"version": "2.0.3",
"uuid": "DesktopCube@yare",
"name": "Desktop Cube",
"description": "Compiz Cube-like animation for workspace switching",
Expand Down
25 changes: 14 additions & 11 deletions smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,18 @@ SmartPanelExt.prototype = {
},

disable: function() {
this._panel.disconnect(this.sr);
this._panel.disconnect(this.en);
this._panel.disconnect(this.lv);
this._panel.disconnect(this.bp);
this._panel.disconnect(this.br);
this.is_disabled = true;
// FIXME: These lines make Cinnamon unstable!
//~ if (this.sr != null) this._panel.disconnect(this.sr);
//~ if (this.en != null) this._panel.disconnect(this.en);
//~ if (this.lv != null) this._panel.disconnect(this.lv);
//~ if (this.bp != null) this._panel.disconnect(this.bp);
//~ if (this.br != null) this._panel.disconnect(this.br);
},

enable: function() {
this._panel.reactive = true;
this.is_disabled = false;
this.sr = this._panel.connect('scroll-event' , Lang.bind(this, this._onScroll));
this.en = this._panel.connect('enter-event' , Lang.bind(this, this._onEntered));
this.lv = this._panel.connect('leave-event' , Lang.bind(this, this._onLeave));
Expand All @@ -115,13 +118,13 @@ SmartPanelExt.prototype = {
},

_onEntered : function(actor, event) {
if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.is_disabled || this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
this.p = false
return;
},

_onLeave : function(actor, event) {
if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.is_disabled || this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.p && this.use_gestures) {
let v = Math.abs(global.get_pointer()[0] - this.ppos[0]) < 33;
let e = Math.abs(global.get_pointer()[1] - this.ppos[1]) > this._panel.get_height() - 2;
Expand All @@ -132,7 +135,7 @@ SmartPanelExt.prototype = {
},

_onButtonPress : function(actor, event) {
if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.is_disabled || this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
let button = event.get_button();
if (button == 1) {
this.p = true;
Expand All @@ -153,7 +156,7 @@ SmartPanelExt.prototype = {
},

_onButtonRelease : function(actor, event) {
if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.is_disabled || this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.p && this.use_gestures) {
let v = global.get_pointer()[0] - this.ppos[0];
if (v > 22) this.Do(this.to_right);
Expand All @@ -164,7 +167,7 @@ SmartPanelExt.prototype = {
},

_onScroll : function(actor, event) {
if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
if (this.is_disabled || this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE;
let currentTime = Date.now();
let direction = event.get_scroll_direction();

Expand Down Expand Up @@ -377,7 +380,7 @@ SmartPanelExt.prototype = {
if (this.workspaceSwitcherExt) {
this.workspaceSwitcherExt.ExtSwitchToWorkspace(reqWs);
} else {
reqWs.activate(global.get_current_time());
reqWs.activate(global.get_current_time());
this.showWorkspaceOSD();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
],
"description": "Switch between workspaces, show desktop, activate overview or expo, ... by scrolling, double click, mouse gestures etc on free space of the panel.",
"name": "Smart Panel",
"version": "1.4.2",
"version": "1.4.3",
"uuid": "smart-panel@mohammad-sn",
"url": "https://cinnamon-spices.linuxmint.com/extensions/view/80",
"author": "mohammad-sn"
Expand Down

0 comments on commit fe76390

Please sign in to comment.