[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shadow and translucency support in NSWindow
From: |
Yen-Ju Chen |
Subject: |
Re: Shadow and translucency support in NSWindow |
Date: |
Tue, 14 Aug 2007 08:07:05 -0700 |
On 8/14/07, Fred Kiefer <fredkiefer@gmx.de> wrote:
> Yen-Ju Chen wrote:
> > Shadow and translucency is not supported in GNUstep,
> > but we have a way to do so in Etoile.
> > Here is a screenshot:
> > https://mail.gna.org/public/etoile-discuss/2007-08/pngcVHU5SBJso.png
> >
> > In order to achieve this visual effect, GNUstep has to implement these
> > missing part:
> >
> > First, for – setHasShadow: and -hasShadow in NSWindow,
> > GNUstep has to push it into backend.
> > Since there is no EWMH standard for shadow,
> > GNUstep can probably add it in _GNUSTEP_WM_ATTR,
> > just like GSDocumentEditedFlag.
> > - invalidateShadow has no effect on X because shadow is always calculated.
> >
>
> I just googled for X11 shadow handling and found that there has been an
> atom in use for this for some time: _KDE_WM_WINDOW_SHADOW. Recently this
> seems to get replaced by _NET_WM_WINDOW_SHADOW, but this still isn't
> very common. Which one should we choose? I would go for the later one
> and hope for window managers to catch up.
We adapt whatever GNUstep does.
The _NET_WM_WINDOW_SHADOW is more "standard"-like.
>
> > Second, for – setAlphaValue, -alphaValue, -setOpaque, -opaque,
> > GNUstep has it, but the number in backend is not right if I remember
> > it correctly.
> > There is a non-offficial EWMH property for that:
> > _NET_WM_WINDOW_OPACITY (opaque is 0xffffffff)
> > As long as GNUstep can push this property, like what it does on window level
> > (XGServerwindow -setwindowlevel:) with XChangeProperty() and XSendEvent(),
> > then we probably can make it work.
> > But I think the first thing is to be sure the correct alpha value is
> > passed to backend.
> >
>
> GNUstep has supported this property for a long time already. I just
> looked through the code of other projects and there seems to be a small
> change in the way it gets used, you now have to send a message instead
> of changing the property directly. I will adopt our code to this.
> And maybe add some more of the new NET_WM stuff as well...
The change is probably due to the window manager.
A general rules are that:
1. If there is no window manager (applications starts before window
manager starts),
use XChangeProperty().
2. If there is a window manager, send a client message (XSendEvent)
to root winodw
so that window manager can handle it. What client message to send depends
on standard. Usually the first data (if any) is the value
(opaque, window type, etc),
and then the client window, then time stamp (CurrentTime), then 0.
So most of time, applications do both, because they do not
know whether a window manager is running.
>
>
> > Because it involes the intergration between gui and back, I cannot
> > provide a patch.
> > If anyone who knows the interface between gui and back can do it
> > and push the correct values into backend, I can help from that.
> > Since both of these properties (alpha and translucency) are not in
> > EWMH standard,
> > it should not have effect on other window manager.
> > In another word, it will not break anything.
> >
> > By the way, -setAlphaValue: seems to change the translucency of the
> > whole window.
> > If I want to have a transparent background but opaque foreground,
> > how do I do it with GNUstep/Cocoa ?
> > For example, some terminal emulator has transparent background, but
> > the text is opaque.
> > I don't see how it can be done with standard GNUstep/Cocoa methods.
>
>