Skip to content

Commit edfb868

Browse files
authored
mouse-click-effects@anaximeno: Version 1.0.3 (#756)
* Add support for deactivate in fullscrenn to the pointer movement tracker
1 parent 23a4cdd commit edfb868

File tree

3 files changed

+43
-21
lines changed

3 files changed

+43
-21
lines changed

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/extension.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ class MouseClickEffects {
355355
if (this.mouse_movement_tracker_enabled) {
356356
const icon = this.get_click_icon(this.icon_mode, ClickType.MOUSE_MOV, this.mouse_movement_color);
357357
this.mouse_movement_tracker = new MouseMovementTracker(
358-
icon, this.size, this.general_opacity,
359-
this.mouse_movement_tracker_persist_on_stopped_enabled);
358+
this, icon, this.size, this.general_opacity,
359+
this.mouse_movement_tracker_persist_on_stopped_enabled,
360+
);
360361
this.mouse_movement_tracker.start();
361362
}
362363

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/mouseMovementTracker.js

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
const { St } = imports.gi;
22
const Main = imports.ui.main;
3+
const SignalManager = imports.misc.signalManager;
34

45
const PointerWatcher = require("./pointerWatcher.js").getPointerWatcher();
5-
const { POINTER_WATCH_MS, UUID, MOUSE_PARADE_DELAY_MS } = require("./constants.js");
6+
const { POINTER_WATCH_MS, MOUSE_PARADE_DELAY_MS } = require("./constants.js");
67
const { Debouncer, logInfo } = require("./helpers.js");
78

89

910
var MouseMovementTracker = class MouseMovementTracker {
10-
constructor(icon, size, opacity, persist_on_stopped) {
11+
constructor(extension, icon, size, opacity, persist_on_stopped) {
12+
this.extension = extension;
1113
this.size = size;
1214
this.opacity = opacity;
1315
this.icon = icon;
1416
this.persist_on_stopped = persist_on_stopped;
1517
this.icon_actor = null;
1618
this.listener = null;
19+
this.signals = new SignalManager.SignalManager(null);
1720
}
1821

19-
start() {
22+
get is_fullscreen_block() {
23+
return this.extension.deactivate_in_fullscreen &&
24+
global.display.focus_window &&
25+
global.display.focus_window.is_fullscreen();
26+
}
27+
28+
on_fullscreen_changed() {
2029
const [x, y, _] = global.get_pointer();
30+
this.move_to(x, y);
31+
}
32+
33+
start() {
2134
this.icon_actor = new St.Icon({
2235
reactive: false,
2336
can_focus: false,
@@ -27,31 +40,34 @@ var MouseMovementTracker = class MouseMovementTracker {
2740
gicon: this.icon,
2841
});
2942
this.icon_actor.set_style("pointer-events: none;");
30-
this.move_to(x, y);
43+
3144
Main.uiGroup.add_child(this.icon_actor);
45+
3246
this.listener = PointerWatcher.addWatch(POINTER_WATCH_MS, this.move_to.bind(this));
47+
this.signals.connect(global.screen, 'in-fullscreen-changed', this.on_fullscreen_changed, this);
48+
49+
const [x, y, _] = global.get_pointer();
50+
this.move_to(x, y);
51+
3352
logInfo("mouse movement tracker started");
3453
}
3554

3655
update(params) {
37-
if (params.size) {
56+
if (params.size)
3857
this.size = params.size;
39-
}
40-
if (params.opacity) {
58+
if (params.opacity)
4159
this.opacity = params.opacity;
42-
}
43-
if (params.icon) {
60+
if (params.icon)
4461
this.icon = params.icon;
45-
}
46-
if (params.persist_on_stopped === true || params.persist_on_stopped === false) {
62+
if (params.persist_on_stopped === true || params.persist_on_stopped === false)
4763
this.persist_on_stopped = params.persist_on_stopped;
48-
}
4964

5065
this.finalize();
5166
this.start();
5267
}
5368

5469
finalize() {
70+
this.signals.disconnectAllSignals();
5571
Main.uiGroup.remove_child(this.icon_actor);
5672
this.listener.remove();
5773
this.icon_actor.destroy();
@@ -60,12 +76,17 @@ var MouseMovementTracker = class MouseMovementTracker {
6076

6177
move_to(x, y) {
6278
if (this.icon_actor) {
63-
this.icon_actor.show();
64-
this.icon_actor.set_position(
65-
x - (this.size * global.ui_scale / 2),
66-
y - (this.size * global.ui_scale / 2));
67-
if (!this.persist_on_stopped)
68-
this.handle_parade();
79+
if (this.is_fullscreen_block) {
80+
this.icon_actor.hide();
81+
logInfo("movement tracker hidden due to deactivation in fullscreen");
82+
} else {
83+
this.icon_actor.set_position(
84+
x - (this.size * global.ui_scale / 2),
85+
y - (this.size * global.ui_scale / 2));
86+
this.icon_actor.show();
87+
if (!this.persist_on_stopped)
88+
this.handle_parade();
89+
}
6990
}
7091
}
7192

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"uuid": "mouse-click-effects@anaximeno",
33
"name": "Mouse Click Effects",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"description": "Display mouse click effects on Cinnamon.",
66
"url": "https://github.com/anaximeno/mouse-click-effects",
77
"website": "https://github.com/anaximeno/mouse-click-effects",

0 commit comments

Comments
 (0)