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

Method setWindow

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

Source from the content-addressed store, hash-verified

934 }
935
936 async setWindow(metaWindow: MetaWindowWithMsProperties): Promise<void> {
937 assert(
938 this.lifecycleState.type === 'app-placeholder',
939 'Can only set the window if the MsWindow is in the app-placeholder state.'
940 );
941
942 const state = (this.lifecycleState = {
943 type: 'window',
944 metaWindow: metaWindow,
945 metaWindowSignals: this.registerOnMetaWindowSignals(metaWindow),
946 dialogs: [],
947 matchingInfo: this.lifecycleState.matchingInfo,
948 matchedAtTime: new Date(),
949 matchedWhileWaiting:
950 this.lifecycleState.waitingForAppSince !== undefined,
951 });
952 metaWindow.msWindow = this;
953 this.windowClone.set_source(null);
954
955 await this.onMetaWindowActorExist(metaWindow);
956 // Check if this method needs to be cancelled.
957 // This can happen if another window is assigned to this MsWindow while this
958 // function is still running. It is also possible that the window is unmanaged.
959 // This *needs* to be done after every await.
960 if (
961 this.lifecycleState !== state ||
962 this.lifecycleState.metaWindow !== metaWindow
963 )
964 return;
965
966 await this.onMetaWindowFirstFrameDrawn(metaWindow);
967 if (
968 this.lifecycleState !== state ||
969 this.lifecycleState.metaWindow !== metaWindow
970 )
971 return;
972
973 this.updateWorkspaceAndMonitor(metaWindow);
974 this.windowClone.set_source(
975 metaWindow.get_compositor_private() as Meta.WindowActor
976 );
977 this.onMetaWindowsChanged();
978 }
979
980 public unsetWindow() {
981 assert(

Callers 2

createNewMsWindowMethod · 0.95

Calls 8

onMetaWindowsChangedMethod · 0.95
assertFunction · 0.90
set_sourceMethod · 0.65

Tested by

no test coverage detected