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

Method onKeyFocus

src/manager/msFocusManager.ts:54–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52 }
53
54 onKeyFocus(): void {
55 const keyFocus = global.stage.key_focus;
56 if (!keyFocus) {
57 if (
58 this.focusProtected &&
59 this.lastKeyFocus &&
60 this.lastKeyFocus != this.lastMsWindowFocused &&
61 this.lastKeyFocus.mapped
62 ) {
63 Debug.logFocus(
64 'Focus Protected, restore focus to ',
65 this.lastKeyFocus
66 );
67
68 return this.lastKeyFocus.grab_key_focus();
69 }
70 return;
71 }
72
73 this.lastKeyFocus = keyFocus;
74
75 let actor: Clutter.Actor | null = keyFocus;
76 while (actor !== null) {
77 if (actor instanceof MsWindow) {
78 this.setFocusToMsWindow(actor);
79 return;
80 }
81 actor = actor.get_parent();
82 }
83
84 if (keyFocus != Main.layoutManager.uiGroup) {
85 this.lastMsWindowFocused = null;
86 }
87 }
88
89 onWindowFocus(): void {
90 const windowFocus =

Callers

nothing calls this directly

Calls 4

setFocusToMsWindowMethod · 0.95
logFocusMethod · 0.80
grab_key_focusMethod · 0.65
get_parentMethod · 0.65

Tested by

no test coverage detected