MacOS High Sierra - Creating a window at the same level as the virtual accessibility keyboard & notifications - macos-high-sierra

I'm trying to create a window that is on the same level as the accessibility keyboard and notifications on High Sierra. My desired result is to get a window that will appear above all other windows, including the screensaver and lock screen.
In el cap/sierra I was able to use window.level = NSWindow.Level(Int(CGWindowLevelForKey(.maximumWindow))) but now in High Sierra my code does not work and I cannot see my window over the screensaver or lock screen.
After some experimenting I noticed that notifications and the accessibility keyboard DO show up over the lock screen/screensaver and was wondering if it is possible to create a window on the same level.
I've included two pictures, one of the lock screen showing both the keyboard/notification. The second image shows what happens when I transition from one window to another - my demo window stays on the desktop but the keyboard/notification is shown above the desktops and transitions over the dividing bar from one to another.
Anyone know of a way I can create this type of behavior in my window?

Related

Why does my packaged game not launch in fullscreen unreal engine 5?

Whenever I launch my game in standalone mode or packaged, the game doesn't go fullscreen even if I press F11 (shortcut to fullscreen / windowed mode).
Here's a demo of the problem : youtube link
If I put in the console r.SetRes 1920x1080, then the game goes fullscreen (for a 1080p screen). But end-users can't access console.
What do I do to make it go fullscreen?
The problem lies within window's screen settings (tested on windows 10 & 11).
One option in window is called "resolution scaling". When this is not 100%, then the game will not cover the screen (if scale > 100) or zoom too much in the game (if scale < 100).
In UE, there's an option to automatically ajust the game to window's scale setting.
It's the "Allow High DPI in Game Mode" in the project settings (under Engine - User Interface). Check that to true and problem solved.

Resize and reposition window to span all monitors

Hi all I am working on a small cross-platform hobby/educational project which takes screenshot of all monitors and overlays all monitors with one wide window. Now on Windows and GTK systems this is no problem. But I am having issues on OSX:
First major issue is that the window is not covering the non-work areas of the dock and the menubar at top.
It won't resize to span multiple monitors.
Is there any programattic way to accomplish this? Users really like when a screenshot is taken that it overlays all monitors with the capture and then they crop and click upload to image service etc. I just want to bring them the same experience on OSX.
Thanks
With OS X 10.9, Apple introduced a feature called "Displays have separate Spaces". See the Mission Control pane of System Preferences. It's on by default.
When that is on, no window can span multiple monitors. Even if it's programmatically set with an frame that does, it will only appear on the screen that contains the most area of the window. The window will be clipped to the frame of that screen.
So, you have to create a separate window for each screen.
From the 10.9 AppKit release notes:
Spaces and Multiple Screens
In 10.9, we have added a feature where
each screen gets its own set of spaces, and it is possible to switch
between spaces on one screen without perturbing the spaces on the
other screens. In this mode, a fullscreen window uses one screen, and
leaves the contents of any other screens unchanged. …
When this feature is enabled, windows may not visibly span displays.
A window will get assigned to the display containing the majority of
its geometry if programmatically positioned in a spanning position. A
window will get assigned to the display containing the mouse if the
window is moved by the user. A window clips to the edge of the
display, whether or not there is another adjacent display.
Also, since the menu bar appears on all screens, Apple changed the way windows are constrained to screens. Also, from the 10.9 AppKit release notes:
constrainFrameRect:toScreen: now invoked for borderless windows
Prior
to 10.9, the NSWindow method -[NSWindow constraintFrameRect:toScreen:]
was invoked only for windows with NSTitledWindowMask set in their
styleMask. In 10.9, this method is invoked for all windows. The
default implementation does a more limited constraining for non-titled
windows, as described in “NSWindows constrained to not intersect the
menu bar” below.
NSWindows constrained to not intersect the menu bar
In 10.9, in
support of the new multi-monitor architecture, windows are now
constrained to not intersect the menu bar on their containing space.
This restriction was already in place for titled windows, but it has
been extended to borderless windows whose level is at least
NSNormalWindowLevel but less than NSMainMenuWindowLevel. This behavior
is implemented in -[NSWindow constraintFrameRect:toScreen:]. You may
override that method in an NSWindow subclass to adjust or prevent this
constraining.
So, you either have to use a custom subclass of NSWindow which overrides -constrainFrameRect:toScreen: to return the unconstrained frame, or you have to set your window's level to NSMainMenuWindowLevel or higher.

How come using setLevel: won't make the window higher than a full screen game?

Most games (if not all) do not use Lion's full screen feature. They make themselves full screen using an unofficial method. The problem is - no matter how high I set the level of a window (I'm currently using level 25 - making the window higher than the status bar and its icons) it won't appear over the game. I want to achieve an effect similar to Steam's full screen overlay in game. Is this possible?
Full-screen games typically aren't windows at all. Most such applications are using CoreGraphics to capture the display (see CGDisplayCapture), bypassing window compositing entirely. (So you can't display content on top of them.) Note that this is perfectly "official" -- it's just a different approach from full-screening a window.
Steam works by having the Steam launcher inject code into the application to display the status popup. It isn't a technique that can -- or should -- be used in more general cases.

Force showing keyboard in metro?

I'd like to be able to force the keyboard to show on screen in my Metro app. My goal is to test out different layouts/controls and get a feel for the interaction. My problem is that I'm running Win8 on a MacBook Pro (Parallels) and I don't know how to override the physical keyboard and show it on screen instead.
Similarly, I'd like to be able to force rotation if possible.
You could run your app the Simulator. You can put the Simulator in "Touch Mode" and that will interpret mouse clicks as touch events in the on screen controls like Text Boxes and you can choose to rotate the Simulator into profile as well.

Cover screen with window in cocoa

I am writing a Mac application, in Cocoa, that needs the ability to 'lock down' the computer. Basically, I am writing a small agent that will sit in the background and when prompted, throw up a window that covers the entire screen, including the status bar, and shows a message (something like "give me back my computer, thief!").
The window has two requirements: it can't be moved and it can't be closed, minimized or otherwise disabled - just a big blob sitting on the screen, making sure the thief can't use the computer. I have all the agent stuff lined up, but I need help coding this window. Does anyone have any ideas?
Thanks,
Chris
P.S - In my dream world, this window would show up even at the login screen. The agent will be running by then, but I am not sure if OS X will allow it...
What you're asking for is basically to turn the user's computer into a not-very-functional kiosk. See also this technote on the same subject.
For display, alternatives to the full-screen view mode described in the Kiosk Mode document include:
Capture all the displays and draw directly to them using Quartz Display Services.
Set your window's frame to the frame of its screen and set its window level really high. You'll need to create one such window per screen.