Why does macOS handle screen resolution differently from Windows? - windows

Apple iMac & MacBook lineup uses high-resolution display branded as "Retina Display" which by default, macOS will set the screen resolution below the native screen resolution. For example on the 13-inch Retina MacBook Pro, which comes with native resolution of 2560-by-1600, macOS will set the default resolution to 1280-by-800 with option to scaled to other screen resolution (1024-by-640, 1440-by-900, and 1680-by-1050) on Settings app.
However, on Windows (including the latest version) screen resolution are by default, set to the native screen resolution with "Scaling" function to increases the elements sizing. For example on a 15-inch laptop, which comes with a Full HD display, Windows will set the default resolution to the 1920-by-1080 with scaling set to 100% but recommended to 125%. Setting a higher scaling in turns result in certain elements displayed blurry.
Hence, why is this case?

An operating system can work without screens. You could for example start your computer (either running Windows, or MacOSX, or Linux), and run some application app (or app.exe on Windows) on that command line.
Now, imagine you type app (without the ENTER key) in some command window, unplug your screen, and type the ENTER key. You app has still started (and perhaps detected that no screen is available, only if that app is a GUI application opening a window by using some widget toolkit). If your app is not a GUI application but a command line one (eg cp which copy files) it can successfully execute.
In practice, your screen is today used by some display server. And your application don't show directly pixels on the screen: it interacts with your display server which generally is the only process accessing the screen (more precisely, your graphics card).
So you need to learn how to tune or configure your display server. And that of course is operating system and display server specific. On MacOSX and and Windows and on Linux they are very different (and Linux even has several ones, e.g. Xorg or Wayland). On MacOSX it is Quartz.

Related

Citrix Receiver Resolution 4K on MacOS

I have a Retina screen MacBook Pro with a 15.6" 4K external monitor attached. I've discovered the resolution of the Citrix session is terrible unless I set the (MacOS) display resolution to 3840x2160, in which case the session resolution is perfect.
The trouble is at this setting, the resolution outside of the session, in MacOS is tiny - I usually have it set to scaled slightly larger. Without the external screen attached, the situation is the same with the default native display resolution resulting in very poor quality in the session.
Is there any solution where both the Citrix session and MacOS both look good?
defaults write com.citrix.receiver.nomas EnableHighDPI -bool YES
I have a Retina screen MacBook Pro with a 15.6" 4K external monitor attached.
According to Citrix they don't have a solution yet.
Prerequisites
To try out on individual MacBooks without enabling for the entire organization/store or if you do not want to whitelist LaunchDarkly on your internal network, you can run the following command in macOS Terminal
defaults write com.citrix.receiver.nomas EnableHighDPI -bool YES
Limitations
Supported devices: MacBook, MacBook Pro. Devices not supported: Mac mini, iMacs, Mac Pro.
No Multi monitor support. This feature will not work if you have connected a secondary monitor. Even if you don't use the secondary monitor with the Citrix Workspace app, simply connecting it will cause this feature to not be available. This feature works only when you use a single monitor for your device.
Source: https://support.citrix.com/article/CTX270704/citrix-workspace-app-for-macos-and-retina-displays
I tried it on my M1 Mac. After I disconnected the Thunderbolt dock with all peripherals the running session changed the resolution by itself to higher DPI. As soon as I connected an external monitor I was back to 1080p.

Prevent disconnected display from merging windows into the active one

I've got a personal laptop (running Windows 10) which I use at work where I connect it to an external display using extended display mode. I keep all my personal icons and windows on my laptop display and store all the work-related windows on the external display. Whenever I unplug it, all the windows and icons from that display are merged into my laptop screen. I want to programmatically prevent changing anything on my primary screen when the secondary is disconnected. I'm currently writing a utility app for a variety of small productivity improving features and would like to add such feature in it. I can think of two ways to achieve this:
by tricking the system to think that the external display hasn't been
disconnected;
or take all the opened windows and icons on disconnected screen and put them on separate virtual desktop.
I was looking into Windows GDI Device Context Functions but haven't found anything about display connection/disconnection events. How can I detect display disconnection (and get that display's opened windows and icons)? Anything that can be done using C#, C++ or PowerShell scripts would be much appreciated!

Getting Mac NPAPI plugin to support high resolution windows for retina displays

I am working on a project where we have a Mac desktop application that has an NPAPI based browser plugin that can be used to edit it's documents through a browser. The codebase is a mixture of Carbon and Cocoa UI code that is shared between the app and the plugin.
We've recently enabled retina support in the app by turning on the High Resolution Capable flag in the application plist and are in the process of porting the interface over to Cocoa. In the app things are displaying correctly with retina displays but in the plugin none of the windows are drawing in high dpi mode.
The document displayed in the browser window is drawing correctly as I can get the content scale factor using NPNVcontentsScaleFactor and apply it to the layers. The problem is with the extra windows that we create, dialogs and toolbars, which are not being drawn in high dpi mode.
Is there a way to get windows we create in the NPAPI plugin to draw at the high resolution?
Thanks.

Fullscreen Cocoa app retina support

I'm developing a screenshot application working in fullscreen mode. I have a bug report about issues with MBP Retina, but I have no idea how to test and fix them. It looks like QuartzDebug can change displays to HiDPI mode, but I'm not sure that will do the trick. Can't find any "Retina Emultaion" related topics in Apple docs.
So my question is how can I test app (not just icons, but whole fullscreen application) for being compatible with retina display without buying one.
It's actually all in the Apple docs, though slightly hard to find: Testing High Resolution Content.
I'll sum it up for you: you should always test on a real device (or go to the Apple Store and put your application on to one of their demo retinas). But as an intermediate step, emulating the retina works too.
Quartz Debug's HiDPI mode works for this, and is a method Apple delineates as one to test with. You can also tint high resolution images using the command (in Terminal)
defaults write -g CGContextHighlight2xScaledImages YES

USB Key for Mac & Windows to Autoload Content?

I'm looking to find out a clean method of deploying a USB key to a customer, that once inserted into the computer (both Mac and Windows), will auto load a respective "thing".
The "thing" could be either an application, a PDF, a splash page (html) in a web browser (system default browser), or potentially an AIR application. The problem with AIR is that I'd need the user to install AIR potentially. Since AIR is platform independent, that could work out pretty well I'd think.
I have established what will be my windows autorun.inf, to load up either AIR, or a portable browser with the splash page. And on the Mac, the user will get a folder (with a graphic background) and a link to launch the page (in a browser, or the portable browser all together). I'm looking for best practices for something like this ultimately.
Autorun isn't generally possible anymore because of the negative security implications.
You're better off making sure that your disk image is set to open a finder window on load, and that the background encourages people to (manually) run your content.
A similar option to an AIR app, but with even less overhead, are Flash projectors. They have fewer features, but are portable and lightweight.

Resources