Re: Gray background behind app windows?

Christiaan Hofman <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Sep 19, 2009, at 21:12, Duncan Champney wrote:

>
> On Sep 18, 2009, at 3:00 PM, [email protected] wrote:
>
>> From: Duncan Champney <[email protected]>
>> Date: September 18, 2009 2:18:39 PM EDT
>> To: [email protected]
>> Cc: Steve Sheets <[email protected]>
>> Subject: Gray background behind app windows?
>>
>>
>> Folks,
>>
>> Apps like Photoshop (PS) used to have an option to blank out the  
>> desktop behind their windows to a flat gray. That reduced visual  
>> clutter so artists could focus on the app's windows.
>>
>> I have Photoshop CS3, not CS4 (I tend to update every other time to  
>> try to save a little money) so I don't know how it works in CS4,  
>> but in CS3 under Leopard, it looks like PS turns the document  
>> window into a "super window" that fills the whole screen and has  
>> gray borders all the way around.
>>
>> Our company is working on rewriting a legacy OS 7/8/9/ app for OS X  
>> (>= 10.5), and the legacy app has the option to blank out  
>> everything behind the app's windows to dull gray.
>>
>> Does anybody know a way to do this in OS X without either going to  
>> full-screen mode (and losing Cocoa's support for document windows,  
>> tool palettes, etc.) or turning the front  document into a monster  
>> that takes up the whole screen, with the content placed in a  
>> resizeable view in the middle? That's doable, but less elegant than  
>> the gray background old OS 9 apps used to use, and doesn't allow  
>> the user to see more than one document window at a time.
>>
>>
>>
>> Thanks in advance,
>>
>> Duncan C
>> WareTo LLC
>>
>>
>>
>>
>>
>>
>>
>> From: Kyle Sluder <[email protected]>
>> Date: September 18, 2009 2:56:29 PM EDT
>> To: Duncan Champney <[email protected]>
>> Cc: [email protected], Steve Sheets <[email protected]>
>> Subject: Re: Gray background behind app windows?
>>
>>
>> On Fri, Sep 18, 2009 at 11:18 AM, Duncan Champney <[email protected]>  
>> wrote:
>>> Does anybody know a way to do this in OS X without either going to
>>> full-screen mode (and losing Cocoa's support for document windows,  
>>> tool
>>> palettes, etc.) or turning the front  document into a monster that  
>>> takes up
>>> the whole screen, with the content placed in a resizeable view in  
>>> the
>>> middle? That's doable, but less elegant than the gray background  
>>> old OS 9
>>> apps used to use, and doesn't allow the user to see more than one  
>>> document
>>> window at a time.
>>
>> Create a screen-sized NSWindow and set its level using -[NSWindow  
>> setLevel:].
>>
>> --Kyle Sluder
>>
>>
>
>
> Kyle,
>
> What level should I use? I would want the gray window to be behind  
> all of my app's other windows, but in front of other apps and in  
> front of the desktop. I could not find a level value for setLevel  
> that would do what I needed. I tried most of the different available  
> level settings, but no luck.

First of all: just think. Most windows are at NSNormalWindowLevel, and  
utility windows etc are at NSFloatingWindowLevel. So it should be  
obvious that you can't just get what you want by simply setting the  
window level of the gray background window. You should move both this  
window and all your apps window to a higher level, at least higher  
than NSFloatingWindowLevel.

But you have to be careful about that. Certainly it's a bad idea to  
move anything higher than the Force Quit window (which IIRC is usually  
placed at NScreensaverWindowLevel, though this is buggy on 10.5.x).

There is no clear cut answer, it really depends on how important it is  
which other windows should be covered. It is not necessarily true that  
it MUST cover all other app's windows. Remember, you're not a screen  
dictator, users may find it very rude when you completely prevent  
other apps from becoming visible. In most situation in fact the best  
is to simply use NSNormalWindowLevel, but then you probably want to  
make sure all your apps windows are moved to the front when your app  
becomes active.

>
> Right now I am working on creating a screen-sized window with  
> styleMask: NSBorderlessWindowMask, at the default level for my app,  
> then using -orderBack to put it behind my other app windows.
>
> The problem with that is that if I click on the gray window, the  
> system brings it in front of my other app windows. I tried  
> overriding NSWindow's -mouseDown method and having that method do  
> nothing, but the system still brings the gray window to the front.
>
> How would I get the system to ignore mousedowns in the window so it  
> does not get moved to the front?
>
>
> Duncan

You probably want to override canBecomeKeyWindow and  
canBecomeMainWindow to return NO, and you may also want to use  
setIgnoresMouseEvents:.

Christiaan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.