MCPcopy Create free account
hub / github.com/material-shell/material-shell / addDialog

Method addDialog

src/layout/msWorkspace/msWindow.ts:1016–1053  ·  view source on GitHub ↗
(metaWindow: MetaWindowWithMsProperties)

Source from the content-addressed store, hash-verified

1014 }
1015
1016 addDialog(metaWindow: MetaWindowWithMsProperties): void {
1017 if (this.lifecycleState.type === 'app-placeholder') {
1018 this.lifecycleState = {
1019 type: 'window',
1020 metaWindow: null,
1021 metaWindowSignals: [],
1022 dialogs: [],
1023 matchingInfo: this.lifecycleState.matchingInfo,
1024 matchedAtTime: new Date(),
1025 matchedWhileWaiting:
1026 this.lifecycleState.waitingForAppSince !== undefined,
1027 };
1028 }
1029
1030 if (this.lifecycleState.type !== 'window') {
1031 throw new Error(
1032 `Cannot add dialog to an MsWindow in the ${this.lifecycleState.type} state`
1033 );
1034 }
1035
1036 this.updateWorkspaceAndMonitor(metaWindow);
1037 const clone = new Clutter.Clone({
1038 source: metaWindow.get_compositor_private() as Meta.WindowActor,
1039 });
1040
1041 const dialog = {
1042 metaWindow,
1043 clone,
1044 };
1045 metaWindow.msWindow = this;
1046 this.lifecycleState.dialogs.push(dialog);
1047 this.add_child(clone);
1048 this.resizeDialogs();
1049 this.onMetaWindowsChanged();
1050 if (this.msWorkspace.tileableFocused === this) {
1051 this.grab_key_focus();
1052 }
1053 }
1054
1055 removeAllDialogs() {
1056 if (this.lifecycleState.type === 'window') {

Callers 1

assignDialogWindowsMethod · 0.80

Calls 7

resizeDialogsMethod · 0.95
onMetaWindowsChangedMethod · 0.95
grab_key_focusMethod · 0.95
pushMethod · 0.65
add_childMethod · 0.65

Tested by

no test coverage detected