Setting preferredContentSize of QLPreviewingController breaks auto resizing - macos

Following the answer here:
Set QuickLook window size when previewing with QLPreviewingController.preparePreviewOfFile I set the preferredContentSize of the QLPreviewingController, which changes the window size as intended, but this seems to break subsequent auto resizing of all subviews. After setting it, the content will no longer track the preview window size when the user resizes it manually or enters fullscreen.
Any attempts to set view sizes, resizing masks or constraints programmatically after setting the preferredContentSize property will cause errors like
<NSViewServiceMarshal: 0x7fe1b740f170 <QLPreviewExtensionViewController: 0x600000e31b00 <NSServiceViewControllerWindow: 0x7fe1b760b350>>> attempted to set frame of <NSServiceViewControllerWindow: 0x7fe1b760b350> from {{17, 382}, {820, 846}} to {{17, 382}, {800, 600}} and got {{17, 136}, {820, 846}}; set breakpoint on -[NSViewServiceMarshal actualFrame:differsFromSpecifiedFrame:oldFrame:ofWindow:] to catch this
and have no visible effect. Setting the breakpoint only tells me that it happens in a system background thread at about the time I try to change the size of the view.
EDIT: Another finding: If I print the frames values of all views and the window to the log, the printed size is the one I requested, not the smaller one actually showing on the screen! I.e. if I set preferredContentSize to (820, 846), my debug NSLogs and the Xcode Debug View Hierarchy shows a window that is 820 x 846, while the actual window showing onscreen is twice as wide as it is high.
EDIT: Made a video to illustrate this problem: https://youtu.be/l7b1jq7pDWY
Original code is here:
https://github.com/angstsmurf/spatterlight/blob/quicklook-ifiction/iFictionQuickLook/iFictionPreviewController.m

This seems to be a Catalina only bug (earlier versions do not support this kind of Quicklook extension.) Upgrading to Big Sur made it go away.

Related

How to make fixed size window in privacy.resistfingerprinting (Firefox)

In Firefox, I use privacy.resistfingerprinting = true. How can I set the window size (1024x768 or 1366x768 or another) that I need? So that I open the browser and the window size matches the resolution I need.
What I did:
Set the values to privacy.window.maxInnerHeight and privacy.window.maxInnerWidth. But the size is 1000x700, 1400x800, etc., i.e. not the one i need.
Used privacy.resistfingerprinting.letterboxing with the specified resolution in .dimensions, it seems to work. BUT, this works with a delay. I open a test page in which resolution is displayed through <body onload="alert (window.innerWidth)"> and at the very beginning the real value is displayed and only then changed using letterboxing. That is, it is possible to intercept the real value.
I tried to resize the window through Window.resizeTo (), but it does not change.
Tell me how to launch a browser with a window of the desired size with privacy.resistfingerprinting enabled?

DropDown GUI (resolution) issue Unity 3D

http://imgur.com/UNR6nNS
Check the link for details.
When I'm running my app (that contains the DropDown feature) on my Android Phone, the dropdowns that apears from DropDown menu is really small, even tiny. I tried to set resizeTextForBestFit and resizeTextMinSize/maxSize + change Rect.height of ViewPort (where the dropdowns placed) but it doesn't work. The Scroll Rect on Dropdown List controlling the size. So how can I fix this issue?
Always choose
"Screen Space - Overlay"
and
"Scale with screen size"
It's just one of those weird things about Unity ... 99.9% of the time you use that setting.
In the current version of Unity, Unity screwed-up and set the default wrong.
Only in extremely obscure situations would you use the other settings: it's a huge source of confusion that Unity have the defaults as the wrong settings.
You could have another problem but be sure to do that.

Is it no longer possible to resize a Firefox window below a certain threshold width?

I'm using the latest Firefox testing a fluid layout.
Somehow after the last update of FireFox, I seem to no longer be able to shrink the page width below a certain threshold level (in my case 348px). Even if I delete all elements on the page, I'm still at 348px.
I have tried to hide all toolbars and Firefox buttons, but still no change.
If check a page in Chrome, the HTML width gets reported correctly = whatever my browser window is resized to.
*Question:
Is this a new "feature"/setting? If so, can I turn this off... It's annoying for sure.
Firefox 14 (if I remember correctly) should have a responsive layout tool - you might want to check that out.

Window disappears when resizing in Carbon Simulator

I'm trying to build a resizable Carbon window as part of a tutorial. I am using Interface Builder 3.2.3 on Snow Leopard 10.6.4.
If I create an empty Carbon project and add a window object from the Library (with Close, Minimize, Resize and Zoom buttons in the Inspector all checked), run the Carbon Simulator and then attempt to resize the window by grabbing the resize control, the window vanishes.
However if I create a Carbon project that already has the window object included (i.e instead of an empty project where I add the window myself after first creating it) I have no problem resizing the window in that case.
I try to visually match the selections in the Inspector to see what is different between the settings of these two cases but I don't readily notice any differences in the two sets of parameters that are displayed. Thus I am curious as whether there are more settings that just aren't displayed on the Inspector.
Are there any common reasons for a Carbon window to vanish upon resizing?
Thanks
I notice that if the option to receive clicks is not checked, then the window goes away when you try to resize it. But I don't know how you could uncheck that accidentally.
JWWalker, thanks for the response. Receive Clicks was checked on both versions.
But I think I was able to (sort of) figure out the discrepancy examining the .nib file.
Both files have two keys defined: maxSize (under com.apple.ibtool.document.localizable-all) and gMaxSize (under com.apple.ibtool.document.objects). In the working file both of these have a string setting of {480, 270}. In the nonworking file they had a string setting of {0, 0}. Apparently the default configuration of the working file was setting the maximum size of the window equal to zero. In Inspector the Window Template Size tab had the "Maximum Size" box checked but a "0" for both Width and Height. I clicked the box once to clear the check. Ran the Carbon Simulator again and the window resized properly without disappearing. When I rechecked the box, Inspector automatically filled in the Width and Height parameters with valid values of 480 and 270. I ran the Carbon Simulator again and it resized properly in accordance with the new maximum size constraint.
I don't fully understand the XML code in the .nib file but apparently the default setting for the maximum size of the window was being set to zero. The incorrect code appeared in the .nib file as follows (with non relevant lines deleted):
com.apple.ibtool.document.localizable-all
<dict>
<key>1</key>
<dict>
<key>maxSize</key>
<string>{0, 0}</string>
com.apple.ibtool.document.objects
<dict>
<key>1</key>
<dict>
<key>gMaxSize</key>
<string>{0, 0}</string>
You must uncheck the minimum size and maximum size in window template size or set the correct value.

Auto-Hide taskbar not appearing when my application is maximized

My application draws all its own window borders and decorations. It works fine with Windows taskbars that are set to auto-hide, except when my application window is maximized. The taskbar won't "roll up". It will behave normally if I have the application not maximized, even when sized all the way to the bottom of the screen. It even works normally if I just resize the window to take up the entire display (as though it was maximized).
I found the problem. My application was handling the WM_GETMINMAXINFO message, and was overriding the values in the parameter MINMAXINFO record. The values that were in the record were inflated by 7 (border width) the screen pixel resolution. That makes sense in that when maximized, it pushes the borders of the window beyond the visible part of the screen. It also set the ptMaxPosition (point that the window origin is set to when maximized) to -7, -7. My application was setting that to 0,0, and the max height and width to exactly the screen resolution size (not inflated). Not sure why this was done; it was written by a predecessor. If I comment out that code and don't modify the MINMAXINFO structure, the Auto-hide works.
As to why, I'm not entirely sure. It's possible that the detection for popping up an "autohidden" taskbar is hooked into the mechanism for handling WM_MOUSEMOVE messages, and not for WM_NCMOUSEMOVE. With my application causing the maximize to park my border right on the bottom of the screen, I would have been generating WM_NCMOUSEMOVE events; with the MINMAXINFO left alone, I would have been generating WM_MOUSEMOVE.
This is dependant on whether 'Keep the taskbar on top of other windows' is checked on the taskbar properties. If it's checked then the taskbar will appear.
But don't be tempted to programmatically alter this setting on an end users machine just to suit your needs, it's considered rude and bad practice. Your app should fit whatever environment it gets deployed to.

Resources