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

Function reparentActor

src/utils/index.ts:111–144  ·  view source on GitHub ↗
(
    actor: Clutter.Actor | null,
    parent: Clutter.Actor | null,
    first = false
)

Source from the content-addressed store, hash-verified

109};
110
111export const reparentActor = (
112 actor: Clutter.Actor | null,
113 parent: Clutter.Actor | null,
114 first = false
115) => {
116 if (!actor || !parent) return;
117
118 const currentParent = actor.get_parent();
119
120 if (currentParent === parent) return;
121
122 Me.instance.reparentInProgress = true;
123 const restoreFocusTo = actor.has_key_focus()
124 ? actor
125 : isParentOfActor(actor, global.stage.key_focus)
126 ? global.stage.key_focus
127 : null;
128
129 if (restoreFocusTo) {
130 Main.layoutManager.uiGroup.grab_key_focus();
131 }
132 if (currentParent) {
133 currentParent.remove_child(actor);
134 }
135 if (first) {
136 parent.insert_child_at_index(actor, 0);
137 } else {
138 parent.add_child(actor);
139 }
140 if (restoreFocusTo) {
141 restoreFocusTo.grab_key_focus();
142 }
143 Me.instance.reparentInProgress = false;
144};
145
146export const InfinityTo0 = (number: number) => {
147 return Math.abs(number) === Infinity ? 0 : number;

Callers 9

setActorAboveMethod · 0.90
setMsWorkspaceActorMethod · 0.90
setMsWorkspaceActorMethod · 0.90
restorePanelActorsMethod · 0.90
addMsWindowUncheckedMethod · 0.90
displayTileableMethod · 0.90
setTranslationMethod · 0.90
makeActorDraggableMethod · 0.90
endDragMethod · 0.90

Calls 7

isParentOfActorFunction · 0.85
has_key_focusMethod · 0.80
insert_child_at_indexMethod · 0.80
get_parentMethod · 0.65
grab_key_focusMethod · 0.65
remove_childMethod · 0.65
add_childMethod · 0.65

Tested by

no test coverage detected