|
From: | dr_clow |
Subject: | Re: NSWindow frame with GSScaleFactor |
Date: | Sun, 13 Aug 2023 21:57:28 -0500 |
Confirmed: I went ahead and checked out a copy of lib-gui, made some changes and loaded the library, changed the following in GSWindowDecorationView.m do divide by 2 (which was my scale factor) and the content shifted appropriately. I included the fix below but also did a pull request. TEST (NOT FIX) [self offsets: &l : &r : &t : &b forStyleMask: aStyle]; aRect.size.width -= (l + r)/2; aRect.size.height -= (t + b)/2; aRect.origin.x += (l/2); aRect.origin.y += (b/2); It worked (see images below) I refactored the code the follow and did a pull request. FIX: if (0 == (aStyle & NSUnscaledWindowMask)) { // FIXME: This method should probably take a screen parameter // rather than assuming the mainScreen CGFloat factor = [[NSScreen mainScreen] userSpaceScaleFactor]; aRect.size.width -= (l + r)/factor; aRect.size.height -= (t + b)/factor; aRect.origin.x += (l/factor); aRect.origin.y += (b/factor); aRect = RectWithSizeScaledByFactor(aRect, 1/factor); } else { aRect.size.width -= l + (r); aRect.size.height -= t + (b); aRect.origin.x += (l); aRect.origin.y += (b); }
|
[Prev in Thread] | Current Thread | [Next in Thread] |