红联Linux门户
Linux帮助

Drop shadows

发布时间:2007-10-13 21:10:48来源:红联作者:bliunxrf
If you are using DapperDrake you should probably look at CompositeManager

What drop shadows are and why you might want them

Drop shadows are shadows drawn behind windows and menus on the desktop, to give the effect of depth. They are the default on Apple's Mac OS X. They require alpha layer transparency so that you can see through them to what ever is underneath. This requires a lot of computer power, unless your graphics card can accelerate the rendering. Apples graphics system is written in openGL so it is easy for them to implement this. Until recently it has been very hard to make drop shadows in Linux without a large performance hit.

Some people feel that drop shadows are unnecessary eyecandy. I think that they are a useful way of subtly making windows distinct from each other. The human eye is good at picking up on depth cues like drop shadows.

A small warning
This may cause an instability on some (non-default install) programs. celestia-gnome and nethack-gnome seem to cause the x server to crash with these adjustments to the xorg.conf.

What you need
You will need to be running Xorg, rather than XFree86. Xorg is available in Hoary.

You will need the xcompmgr package (will also install libcomposite)

You will also need to have a good graphics card and a fast computer. I have a 64mb ATI Radeon Mobility 9000 in my 1Ghz G4 powerbook. A few years old, but good enough for this to work.

You will need to enable graphics acceleration. Have a look at [[BinaryDriverHowto]] if you are running an x86 processor. I have a powerpc processor so I use the open source ati driver, which are already installed.

Now you need to edit your X configuration. You can get your system in a real mess if you damage this file. If have not edited configuration files before and don't know how to make a backup then you probably should not be attempting this.
The X configuration file is at /etc/X11/xorg.conf

These are the changes I made, it may be different on different card, if you try this please post your experience as a comment.

I changed


Section "Device"
Identifier "ATI Technologies, Inc. Radeon Mobility 9000 M9 (R250 Lf)"
Driver "ati"
BusID "PCI:0:16:0"
Option "UseFBDev" "true"
EndSection

To


Section "Device"
Identifier "ATI Technologies, Inc. Radeon Mobility 9000 M9 (R250 Lf)"
Driver "ati"
BusID "PCI:0:16:0"
Option "UseFBDev" "true"

Option "backingstore" "true"
Option "RenderAccel" "true"
EndSection

and added


Section "Extensions"
Option "Composite" "Enable"
Option "RENDER" "true"
Option "DAMAGE" "true"
EndSection

to the end.

These are lines that I have picked up from the wiki and the forums. They enable some of the new features in Xorg.

You will have to restart X for these to come into effect. The easiest way is to logout and press ctrl+alt+backspace at the login screen. (You can also reboot the whole computer, or logging out and running "sudo /etc/init.d/gdm restart" from a text terminal should do it)

How to enable drop shadows
The Gnome desktop does not have drop shadows built in, so you will need to use the xcompmgr utility to turn them on. Have a look at the man page for a full list of its options.

Open up a terminal and run

xcompmgr -c
Use Control + C to stop it.

Have a play with a few of the options in the man page. You can make the shadows bigger with

xcompmgr -c -r 30
or hard with

xcompmgr -s
If you get windows going on top of you gnome panels then run


killall gnome-panel
to put the panels back on the top layer.

Once you have found your perfect settings then you might want to make them run whenever you start Gnome. In the Preferences menu choose Sessions. Go to the Startup Programs tab. Click add and add your chosen xcompmgr command. Set the order to something small; you need it to load before gnome-panel.

Now log out and back in again.

Additional notes
If you find that this affects openGL performance, try adding the following to your /etc/X11/xorg.conf

I put this option in my device section (eg. Nvidia card) not in "Extensions".

If you kill gnome-panel, you lose icons in your notification area. Some applications will crash too. Then the panel will show up with drop shadows which is boring. Killing metacity is a much more effective way to restore your desktop margins.
文章评论

共有 0 条评论