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

Method resizeDialogs

src/layout/msWorkspace/msWindow.ts:821–869  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

819 }
820
821 resizeDialogs() {
822 if (this.lifecycleState.type !== 'window') return;
823 this.lifecycleState.dialogs.forEach((dialog) => {
824 const { metaWindow } = dialog;
825 const frame = metaWindow.get_frame_rect();
826 const workArea = Main.layoutManager.getWorkAreaForMonitor(
827 this.msWorkspace.monitor.index
828 );
829 const monitorInFullScreen =
830 global.display.get_monitor_in_fullscreen(
831 this.msWorkspace.monitor.index
832 );
833 const offsetX = monitorInFullScreen
834 ? this.msWorkspace.monitor.x
835 : workArea.x;
836 const offsetY = monitorInFullScreen
837 ? this.msWorkspace.monitor.y
838 : workArea.y;
839 const needMove =
840 frame.x - offsetX < this.x ||
841 frame.x - offsetX + frame.width > this.x + this.width ||
842 frame.y - offsetY < this.y ||
843 frame.y - offsetY + frame.height > this.y + this.height;
844 const needResize =
845 frame.width > this.width || frame.height > this.height;
846
847 if (needResize && metaWindow.resizeable) {
848 const minWidth = Math.min(frame.width, this.width);
849 const minHeight = Math.min(frame.height, this.height);
850 metaWindow.move_resize_frame(
851 true,
852 needMove
853 ? offsetX + this.x + (this.width - minWidth) / 2
854 : frame.x,
855 needMove
856 ? offsetY + this.y + (this.height - minHeight) / 2
857 : frame.y,
858 minWidth,
859 minHeight
860 );
861 } else if (needMove && metaWindow.allows_move()) {
862 metaWindow.move_frame(
863 true,
864 offsetX + this.x + (this.width - frame.width) / 2,
865 offsetY + this.y + (this.height - frame.height) / 2
866 );
867 }
868 });
869 }
870
871 resizeMetaWindows() {
872 if (

Callers 2

resizeMetaWindowsMethod · 0.95
addDialogMethod · 0.95

Calls 6

get_frame_rectMethod · 0.80
move_resize_frameMethod · 0.80
allows_moveMethod · 0.80
move_frameMethod · 0.80
minMethod · 0.65

Tested by

no test coverage detected