MCPcopy Index your code
hub / github.com/material-shell/material-shell / tooltipCallback

Method tooltipCallback

src/manager/tooltipManager.ts:18–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16 let actorDestroyed = false;
17 actor.set_reactive(true);
18 const tooltipCallback = () => {
19 let tooltip: MatTooltip | null | undefined;
20 let left = false;
21 let timeoutId: number;
22 const leaveCallback = () => {
23 left = true;
24 if (tooltip) {
25 tooltip.remove();
26 tooltip = null;
27 }
28 // Cancel countdown, if any
29 if (timeoutId) {
30 Async.clearTimeoutId(timeoutId);
31 timeoutId = 0;
32 }
33 if (!actorDestroyed) {
34 actor.disconnect(leaveId);
35 actor.disconnect(destroyId);
36 }
37 global.stage.disconnect(deactivateId);
38 };
39 const leaveId = actor.connect('leave-event', leaveCallback);
40 const destroyId = actor.connect('destroy', () => {
41 actorDestroyed = true;
42 leaveCallback();
43 });
44 const deactivateId = global.stage.connect(
45 'deactivate',
46 leaveCallback
47 );
48
49 timeoutId = Async.addTimeout(GLib.PRIORITY_DEFAULT, 200, () => {
50 timeoutId = 0;
51 if (!left) {
52 tooltip = this.createTooltip(actor, params);
53 }
54 return GLib.SOURCE_REMOVE;
55 });
56 };
57 this.observe(actor, 'enter-event', tooltipCallback);
58 }
59

Callers

nothing calls this directly

Calls 3

createTooltipMethod · 0.95
addTimeoutMethod · 0.80
connectMethod · 0.65

Tested by

no test coverage detected