MCPcopy
hub / github.com/paperwm/PaperWM / resizeHandler

Function resizeHandler

tiling.js:3686–3780  ·  view source on GitHub ↗
(metaWindow)

Source from the content-addressed store, hash-verified

3684}
3685
3686export function resizeHandler(metaWindow) {
3687 // if navigator is showing, reset/refresh it after a window has resized
3688 if (Navigator.navigating) {
3689 Navigator.getNavigator().minimaps.forEach(m => typeof m !== 'number' && m.reset());
3690 }
3691
3692 if (inGrab && inGrab.window === metaWindow)
3693 return;
3694
3695 const space = spaces.spaceOfWindow(metaWindow);
3696 if (!space) {
3697 return;
3698 }
3699
3700 const f = metaWindow.get_frame_rect();
3701 metaWindow._targetWidth = null;
3702 metaWindow._targetHeight = null;
3703
3704 if (space.indexOf(metaWindow) === -1) {
3705 nonTiledSizeHandler(metaWindow);
3706 return;
3707 }
3708
3709 const fsf = metaWindow?._fullscreen_frame;
3710 const selected = metaWindow === space.selectedWindow;
3711 let addCallback = false;
3712 let x;
3713
3714 let needLayout = false;
3715 // if target width differs ==> layout
3716 if (metaWindow._targetWidth !== f.width || metaWindow._targetHeight !== f.height) {
3717 needLayout = true;
3718 }
3719
3720 // if saved size differs ==> layout
3721 if (fsf) {
3722 if (fsf.width !== f.width || fsf.height !== f.height) {
3723 needLayout = true;
3724 }
3725 }
3726
3727 const moveTo = (x, animate) => {
3728 move_to(space, metaWindow, {
3729 x,
3730 animate,
3731 });
3732 };
3733
3734 // if window is fullscreened, then don't animate background space.container animation etc.
3735 if (metaWindow.fullscreen) {
3736 metaWindow._fullscreen_lock = true;
3737 space.hideSelection();
3738 space.layout(false, { callback: moveTo(0, false), centerIfOne: false });
3739 return;
3740 }
3741
3742 space.showSelection();
3743 x = metaWindow?._fullscreen_frame?.x ?? f.x;

Callers 3

registerWindowFunction · 0.85
addResizeHandlerFunction · 0.85
insertWindowFunction · 0.85

Calls 14

nonTiledSizeHandlerFunction · 0.85
isMaximizedFunction · 0.85
isMaximizedHorizontalFunction · 0.85
saveFullscreenFrameFunction · 0.85
centerWindowFunction · 0.85
spaceOfWindowMethod · 0.80
indexOfMethod · 0.80
hideSelectionMethod · 0.80
showSelectionMethod · 0.80
queueLayoutMethod · 0.80
moveToFunction · 0.70

Tested by

no test coverage detected