I’m (re-)writing a small app to control a USB device. I would like the window of that app to be always entirely visible. So when you move around the window, it stops moving when the bottom hits the bottom of the screen or one of the sides hits the side of the screen.
Is this at all possible?
Yes, it’s possible.
Normal NSWindows with a title bar constrain their own frames to not allow the top of the window to leave the top of the screen. This is done in
-[NSWindow constrainFrameRect:toScreen:]You can override this method to constrain the frame however you’d like.