Cocoa - prevent window from getting overlapped
I'm writing an app that should remain visible on the desktop at all times. As such, I have to prevent other apps' windows moving on top of my app's window.
The Dock.app from Mac OS X partially does this: if you resize windows, they won't resize into the Dock.app's screen space, and if you hit the windows' '+' button, the window will not cover the dock.
Is开发者_开发技巧 it possible to replicate this functionality, and if so, how can I do it?
I'm not sure how well it will work and it definitely requires "Enable access for assistive devices" to be enabled in the "Universal Access" system preference panel, but you could try using the Accessibility Hierarchy to monitor window frame changes of all on-screen windows and further manipulate them as desired.
精彩评论