I’m quite sure that Ubuntu 7.0.4 (Feisty Fawn) with GNOME 2.18 locked my screen when I closed the lid of my laptop. Ubuntu 7.10 (Gutsy Gibbon) with GNOME with 2.20 did not until I made this change under the hood. The XML below can be imported with gconftool --load.
<gconfentryfile> <entrylist base="/apps/gnome-power-manager/lock"> <entry> <key>blank_screen</key> <schema_key>/schemas/apps/gnome-power-manager/lock/blank_screen</schema_key> <value> <bool>true</bool> </value> </entry> </entrylist> </gconfentryfile>