From 8eb2873d7054e705c4e83f22d18c40946a9e2529 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 2 Mar 2009 00:42:50 -0500 Subject: [PATCH] http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.00.tar.gz -rw-r--r-- 1 zblaxell zblaxell 1855130 Jan 17 2002 xscreensaver-4.00.tar.gz f930b6c8b36a26ebc92457ed2772e1a78a2e309b xscreensaver-4.00.tar.gz --- Makefile.in | 1 + README | 47 +- README.debugging | 14 +- config.h-vms | 2 +- config.h.in | 17 +- configure | 1732 ++++++----- configure.in | 425 ++- driver/Makefile.in | 143 +- driver/XScreenSaver.ad.in | 907 +----- driver/XScreenSaver_ad.h | 749 +---- driver/demo-Gtk-conf.c | 1853 ++++++++++++ driver/demo-Gtk-conf.h | 29 + driver/demo-Gtk-stubs.h | 34 +- driver/demo-Gtk-support.c | 162 ++ driver/demo-Gtk-support.h | 38 + driver/demo-Gtk-widgets.c | 1935 +++++++----- driver/demo-Gtk-widgets.h | 1 + driver/demo-Gtk.c | 3072 ++++++++++++++------ driver/demo-Xm-widgets.c | 106 + driver/lock.c | 250 +- driver/prefs.c | 24 + driver/prefs.h | 5 + driver/splash.c | 118 +- driver/subprocs.c | 127 +- driver/test-fade.c | 3 + driver/test-passwd.c | 158 +- driver/timers.c | 123 +- driver/windows.c | 211 +- driver/xscreensaver-command.c | 4 +- driver/xscreensaver-command.man | 2 +- driver/xscreensaver-demo.glade | 2934 +++++++++++-------- driver/xscreensaver-demo.man | 160 +- driver/xscreensaver-getimage-file | 4 +- driver/xscreensaver-getimage-file.man | 2 +- driver/xscreensaver-getimage-video | 6 +- driver/xscreensaver-getimage-video.man | 2 +- driver/xscreensaver-getimage.c | 44 +- driver/xscreensaver-getimage.man | 2 +- driver/xscreensaver.c | 135 +- driver/xscreensaver.h | 8 +- driver/xscreensaver.man | 225 +- hacks/Makefile.in | 858 +----- hacks/blaster.c | 4 +- hacks/bsod.c | 28 +- hacks/compile_axp.com | 4 +- hacks/compile_decc.com | 4 +- hacks/config/README | 172 ++ hacks/config/ant.xml | 50 + hacks/config/atlantis.xml | 45 + hacks/config/attraction.xml | 89 + hacks/config/blaster.xml | 56 + hacks/config/blitspin.xml | 35 + hacks/config/bouboule.xml | 27 + hacks/config/braid.xml | 30 + hacks/config/bsod.xml | 34 + hacks/config/bubble3d.xml | 19 + hacks/config/bubbles.xml | 35 + hacks/config/bumps.xml | 25 + hacks/config/cage.xml | 26 + hacks/config/ccurve.xml | 23 + hacks/config/circuit.xml | 33 + hacks/config/compass.xml | 18 + hacks/config/coral.xml | 29 + hacks/config/cosmos.xml | 10 + hacks/config/critical.xml | 26 + hacks/config/crystal.xml | 38 + hacks/config/cynosure.xml | 27 + hacks/config/dangerball.xml | 31 + hacks/config/decayscreen.xml | 37 + hacks/config/deco.xml | 35 + hacks/config/deluxe.xml | 35 + hacks/config/demon.xml | 30 + hacks/config/discrete.xml | 24 + hacks/config/distort.xml | 45 + hacks/config/drift.xml | 31 + hacks/config/electricsheep.xml | 19 + hacks/config/engine.xml | 24 + hacks/config/epicycle.xml | 45 + hacks/config/extrusion.xml | 46 + hacks/config/fadeplot.xml | 27 + hacks/config/flag.xml | 34 + hacks/config/flame.xml | 31 + hacks/config/flipscreen3d.xml | 19 + hacks/config/flow.xml | 38 + hacks/config/forest.xml | 20 + hacks/config/galaxy.xml | 31 + hacks/config/gears.xml | 36 + hacks/config/gflux.xml | 48 + hacks/config/glplanet.xml | 38 + hacks/config/gltext.xml | 38 + hacks/config/goban.xml | 14 + hacks/config/goop.xml | 49 + hacks/config/grav.xml | 27 + hacks/config/greynetic.xml | 16 + hacks/config/halo.xml | 35 + hacks/config/helix.xml | 15 + hacks/config/hopalong.xml | 49 + hacks/config/hyperball.xml | 46 + hacks/config/hypercube.xml | 60 + hacks/config/ifs.xml | 20 + hacks/config/imsmap.xml | 40 + hacks/config/interference.xml | 45 + hacks/config/jigsaw.xml | 26 + hacks/config/julia.xml | 34 + hacks/config/kaleidescope.xml | 34 + hacks/config/kumppa.xml | 25 + hacks/config/lament.xml | 25 + hacks/config/laser.xml | 27 + hacks/config/lightning.xml | 21 + hacks/config/lisa.xml | 33 + hacks/config/lissie.xml | 30 + hacks/config/lmorph.xml | 34 + hacks/config/loop.xml | 27 + hacks/config/maze.xml | 53 + hacks/config/menger.xml | 47 + hacks/config/moebius.xml | 33 + hacks/config/moire.xml | 32 + hacks/config/moire2.xml | 26 + hacks/config/molecule.xml | 54 + hacks/config/morph3d.xml | 22 + hacks/config/mountain.xml | 23 + hacks/config/munch.xml | 37 + hacks/config/nerverot.xml | 51 + hacks/config/noseguy.xml | 27 + hacks/config/pedal.xml | 25 + hacks/config/penetrate.xml | 25 + hacks/config/penrose.xml | 43 + hacks/config/petri.xml | 81 + hacks/config/phosphor.xml | 29 + hacks/config/pipes.xml | 48 + hacks/config/pulsar.xml | 53 + hacks/config/pyro.xml | 29 + hacks/config/qix.xml | 69 + hacks/config/rd-bomb.xml | 54 + hacks/config/ripples.xml | 44 + hacks/config/rocks.xml | 38 + hacks/config/rorschach.xml | 29 + hacks/config/rotor.xml | 32 + hacks/config/rotzoomer.xml | 28 + hacks/config/rubik.xml | 30 + hacks/config/shadebobs.xml | 30 + hacks/config/sierpinski.xml | 27 + hacks/config/sierpinski3d.xml | 31 + hacks/config/slidescreen.xml | 32 + hacks/config/slip.xml | 32 + hacks/config/sonar.xml | 40 + hacks/config/speedmine.xml | 58 + hacks/config/sphere.xml | 21 + hacks/config/sphereEversion.xml | 17 + hacks/config/spiral.xml | 27 + hacks/config/spotlight.xml | 19 + hacks/config/sproingies.xml | 28 + hacks/config/squiral.xml | 38 + hacks/config/ssystem.xml | 19 + hacks/config/stairs.xml | 23 + hacks/config/starfish.xml | 38 + hacks/config/starwars.xml | 55 + hacks/config/stonerview.xml | 17 + hacks/config/strange.xml | 25 + hacks/config/superquadrics.xml | 36 + hacks/config/swirl.xml | 26 + hacks/config/t3d.xml | 43 + hacks/config/triangle.xml | 20 + hacks/config/truchet.xml | 33 + hacks/config/vermiculate.xml | 13 + hacks/config/vidwhacker.xml | 22 + hacks/config/vines.xml | 22 + hacks/config/wander.xml | 39 + hacks/config/webcollage.xml | 33 + hacks/config/whirlwindwarp.xml | 21 + hacks/config/whirlygig.xml | 42 + hacks/config/worm.xml | 30 + hacks/config/xaos.xml | 20 + hacks/config/xdaliclock.xml | 29 + hacks/config/xearth.xml | 90 + hacks/config/xfishtank.xml | 33 + hacks/config/xflame.xml | 30 + hacks/config/xjack.xml | 20 + hacks/config/xlyap.xml | 36 + hacks/config/xmatrix.xml | 42 + hacks/config/xmountains.xml | 61 + hacks/config/xrayswarm.xml | 16 + hacks/config/xsnow.xml | 35 + hacks/config/xspirograph.xml | 18 + hacks/config/xteevee.xml | 17 + hacks/config/zoom.xml | 40 + hacks/crystal.c | 9 + hacks/deluxe.c | 15 +- hacks/distort.c | 6 +- hacks/glx/Makefile.in | 357 +-- hacks/glx/cage.c | 3 +- hacks/glx/circuit.c | 742 +++-- hacks/glx/engine.c | 799 +++++ hacks/glx/flipscreen3d.c | 449 +++ hacks/glx/font-ximage.c | 242 ++ hacks/glx/font-ximage.h | 30 + hacks/glx/fps.c | 1 - hacks/glx/gflux.c | 160 +- hacks/glx/gflux.man | 20 +- hacks/glx/glplanet.c | 6 +- hacks/glx/gltext.c | 2 +- hacks/glx/grab-ximage.c | 156 + hacks/glx/grab-ximage.h | 23 + hacks/glx/menger.c | 713 +++++ hacks/glx/moebius.c | 3 +- hacks/glx/molecule.c | 2 +- hacks/glx/sierpinski3d.c | 256 +- hacks/glx/stairs.c | 3 +- hacks/glx/starwars.c | 5 +- hacks/glx/stonerview-view.c | 21 +- hacks/glx/xpm-ximage.c | 57 +- hacks/images/matrix.xbm | 516 ---- hacks/images/matrix.xpm | 905 ------ hacks/images/matrix0.xbm | 1261 ++++++++ hacks/images/matrix0.xpm | 390 +++ hacks/images/matrix0b.xbm | 308 ++ hacks/images/matrix0b.xpm | 192 ++ hacks/images/matrix1.xbm | 1261 ++++++++ hacks/images/matrix1.xpm | 395 +++ hacks/images/matrix1b.xbm | 308 ++ hacks/images/matrix1b.xpm | 200 ++ hacks/images/matrix2.xbm | 1437 +++++++-- hacks/images/matrix2.xpm | 894 +++--- hacks/images/matrix2b.xbm | 308 ++ hacks/images/matrix2b.xpm | 201 ++ hacks/jigsaw.c | 10 +- hacks/kumppa.c | 2 +- hacks/moire.c | 3 +- hacks/mountain.c | 1 - hacks/nerverot.c | 178 +- hacks/noseguy.c | 2 +- hacks/phosphor.c | 2 +- hacks/pyro.c | 7 + hacks/ripples.c | 10 +- hacks/rorschach.c | 5 +- hacks/rotzoomer.c | 4 +- hacks/screenhack.c | 70 +- hacks/slidescreen.c | 10 +- hacks/sonar.c | 170 +- hacks/spotlight.c | 6 +- hacks/t3d.c | 3 +- hacks/vermiculate.c | 35 +- hacks/wander.c | 3 +- hacks/webcollage | 118 +- hacks/whirlwindwarp.c | 2 +- hacks/xlockmore.h | 3 +- hacks/xmatrix.c | 478 ++- hacks/zoom.c | 2 +- setup.com | 2 +- utils/Makefile.in | 10 +- utils/compile_axp.com | 2 +- utils/compile_decc.com | 2 +- utils/fade.c | 2 + utils/grabclient.c | 21 + utils/grabscreen.c | 108 +- utils/grabscreen.h | 10 +- utils/{ => images}/logo-180.gif | Bin utils/{ => images}/logo-180.xpm | 0 utils/{ => images}/logo-50.gif | Bin utils/{ => images}/logo-50.xpm | 0 utils/{ => images}/logo-big.gif | Bin utils/{ => images}/logo.eps | 0 utils/images/screensaver-cmndln.xpm | 357 +++ utils/images/screensaver-colorselector.xpm | 250 ++ utils/images/screensaver-diagnostic.xpm | 296 ++ utils/images/screensaver-locking.xpm | 206 ++ utils/images/screensaver-power.xpm | 230 ++ utils/images/screensaver-snap.xpm | 227 ++ utils/logo.c | 4 +- utils/resources.c | 35 +- utils/version.h | 2 +- xscreensaver.lsm | 16 +- xscreensaver.spec | 91 +- 273 files changed, 27204 insertions(+), 10006 deletions(-) create mode 100644 driver/demo-Gtk-conf.c create mode 100644 driver/demo-Gtk-conf.h create mode 100644 driver/demo-Gtk-support.c create mode 100644 driver/demo-Gtk-support.h create mode 100644 hacks/config/README create mode 100644 hacks/config/ant.xml create mode 100644 hacks/config/atlantis.xml create mode 100644 hacks/config/attraction.xml create mode 100644 hacks/config/blaster.xml create mode 100644 hacks/config/blitspin.xml create mode 100644 hacks/config/bouboule.xml create mode 100644 hacks/config/braid.xml create mode 100644 hacks/config/bsod.xml create mode 100644 hacks/config/bubble3d.xml create mode 100644 hacks/config/bubbles.xml create mode 100644 hacks/config/bumps.xml create mode 100644 hacks/config/cage.xml create mode 100644 hacks/config/ccurve.xml create mode 100644 hacks/config/circuit.xml create mode 100644 hacks/config/compass.xml create mode 100644 hacks/config/coral.xml create mode 100644 hacks/config/cosmos.xml create mode 100644 hacks/config/critical.xml create mode 100644 hacks/config/crystal.xml create mode 100644 hacks/config/cynosure.xml create mode 100644 hacks/config/dangerball.xml create mode 100644 hacks/config/decayscreen.xml create mode 100644 hacks/config/deco.xml create mode 100644 hacks/config/deluxe.xml create mode 100644 hacks/config/demon.xml create mode 100644 hacks/config/discrete.xml create mode 100644 hacks/config/distort.xml create mode 100644 hacks/config/drift.xml create mode 100644 hacks/config/electricsheep.xml create mode 100644 hacks/config/engine.xml create mode 100644 hacks/config/epicycle.xml create mode 100644 hacks/config/extrusion.xml create mode 100644 hacks/config/fadeplot.xml create mode 100644 hacks/config/flag.xml create mode 100644 hacks/config/flame.xml create mode 100644 hacks/config/flipscreen3d.xml create mode 100644 hacks/config/flow.xml create mode 100644 hacks/config/forest.xml create mode 100644 hacks/config/galaxy.xml create mode 100644 hacks/config/gears.xml create mode 100644 hacks/config/gflux.xml create mode 100644 hacks/config/glplanet.xml create mode 100644 hacks/config/gltext.xml create mode 100644 hacks/config/goban.xml create mode 100644 hacks/config/goop.xml create mode 100644 hacks/config/grav.xml create mode 100644 hacks/config/greynetic.xml create mode 100644 hacks/config/halo.xml create mode 100644 hacks/config/helix.xml create mode 100644 hacks/config/hopalong.xml create mode 100644 hacks/config/hyperball.xml create mode 100644 hacks/config/hypercube.xml create mode 100644 hacks/config/ifs.xml create mode 100644 hacks/config/imsmap.xml create mode 100644 hacks/config/interference.xml create mode 100644 hacks/config/jigsaw.xml create mode 100644 hacks/config/julia.xml create mode 100644 hacks/config/kaleidescope.xml create mode 100644 hacks/config/kumppa.xml create mode 100644 hacks/config/lament.xml create mode 100644 hacks/config/laser.xml create mode 100644 hacks/config/lightning.xml create mode 100644 hacks/config/lisa.xml create mode 100644 hacks/config/lissie.xml create mode 100644 hacks/config/lmorph.xml create mode 100644 hacks/config/loop.xml create mode 100644 hacks/config/maze.xml create mode 100644 hacks/config/menger.xml create mode 100644 hacks/config/moebius.xml create mode 100644 hacks/config/moire.xml create mode 100644 hacks/config/moire2.xml create mode 100644 hacks/config/molecule.xml create mode 100644 hacks/config/morph3d.xml create mode 100644 hacks/config/mountain.xml create mode 100644 hacks/config/munch.xml create mode 100644 hacks/config/nerverot.xml create mode 100644 hacks/config/noseguy.xml create mode 100644 hacks/config/pedal.xml create mode 100644 hacks/config/penetrate.xml create mode 100644 hacks/config/penrose.xml create mode 100644 hacks/config/petri.xml create mode 100644 hacks/config/phosphor.xml create mode 100644 hacks/config/pipes.xml create mode 100644 hacks/config/pulsar.xml create mode 100644 hacks/config/pyro.xml create mode 100644 hacks/config/qix.xml create mode 100644 hacks/config/rd-bomb.xml create mode 100644 hacks/config/ripples.xml create mode 100644 hacks/config/rocks.xml create mode 100644 hacks/config/rorschach.xml create mode 100644 hacks/config/rotor.xml create mode 100644 hacks/config/rotzoomer.xml create mode 100644 hacks/config/rubik.xml create mode 100644 hacks/config/shadebobs.xml create mode 100644 hacks/config/sierpinski.xml create mode 100644 hacks/config/sierpinski3d.xml create mode 100644 hacks/config/slidescreen.xml create mode 100644 hacks/config/slip.xml create mode 100644 hacks/config/sonar.xml create mode 100644 hacks/config/speedmine.xml create mode 100644 hacks/config/sphere.xml create mode 100644 hacks/config/sphereEversion.xml create mode 100644 hacks/config/spiral.xml create mode 100644 hacks/config/spotlight.xml create mode 100644 hacks/config/sproingies.xml create mode 100644 hacks/config/squiral.xml create mode 100644 hacks/config/ssystem.xml create mode 100644 hacks/config/stairs.xml create mode 100644 hacks/config/starfish.xml create mode 100644 hacks/config/starwars.xml create mode 100644 hacks/config/stonerview.xml create mode 100644 hacks/config/strange.xml create mode 100644 hacks/config/superquadrics.xml create mode 100644 hacks/config/swirl.xml create mode 100644 hacks/config/t3d.xml create mode 100644 hacks/config/triangle.xml create mode 100644 hacks/config/truchet.xml create mode 100644 hacks/config/vermiculate.xml create mode 100644 hacks/config/vidwhacker.xml create mode 100644 hacks/config/vines.xml create mode 100644 hacks/config/wander.xml create mode 100644 hacks/config/webcollage.xml create mode 100644 hacks/config/whirlwindwarp.xml create mode 100644 hacks/config/whirlygig.xml create mode 100644 hacks/config/worm.xml create mode 100644 hacks/config/xaos.xml create mode 100644 hacks/config/xdaliclock.xml create mode 100644 hacks/config/xearth.xml create mode 100644 hacks/config/xfishtank.xml create mode 100644 hacks/config/xflame.xml create mode 100644 hacks/config/xjack.xml create mode 100644 hacks/config/xlyap.xml create mode 100644 hacks/config/xmatrix.xml create mode 100644 hacks/config/xmountains.xml create mode 100644 hacks/config/xrayswarm.xml create mode 100644 hacks/config/xsnow.xml create mode 100644 hacks/config/xspirograph.xml create mode 100644 hacks/config/xteevee.xml create mode 100644 hacks/config/zoom.xml create mode 100644 hacks/glx/engine.c create mode 100644 hacks/glx/flipscreen3d.c create mode 100644 hacks/glx/font-ximage.c create mode 100644 hacks/glx/font-ximage.h create mode 100644 hacks/glx/grab-ximage.c create mode 100644 hacks/glx/grab-ximage.h create mode 100644 hacks/glx/menger.c delete mode 100644 hacks/images/matrix.xbm delete mode 100644 hacks/images/matrix.xpm create mode 100644 hacks/images/matrix0.xbm create mode 100644 hacks/images/matrix0.xpm create mode 100644 hacks/images/matrix0b.xbm create mode 100644 hacks/images/matrix0b.xpm create mode 100644 hacks/images/matrix1.xbm create mode 100644 hacks/images/matrix1.xpm create mode 100644 hacks/images/matrix1b.xbm create mode 100644 hacks/images/matrix1b.xpm create mode 100644 hacks/images/matrix2b.xbm create mode 100644 hacks/images/matrix2b.xpm rename utils/{ => images}/logo-180.gif (100%) rename utils/{ => images}/logo-180.xpm (100%) rename utils/{ => images}/logo-50.gif (100%) rename utils/{ => images}/logo-50.xpm (100%) rename utils/{ => images}/logo-big.gif (100%) rename utils/{ => images}/logo.eps (100%) create mode 100644 utils/images/screensaver-cmndln.xpm create mode 100644 utils/images/screensaver-colorselector.xpm create mode 100644 utils/images/screensaver-diagnostic.xpm create mode 100644 utils/images/screensaver-locking.xpm create mode 100644 utils/images/screensaver-power.xpm create mode 100644 utils/images/screensaver-snap.xpm diff --git a/Makefile.in b/Makefile.in index c310f27a..c68875c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -174,6 +174,7 @@ rpm:: DIR=`pwd`/rpm_build ; \ ARCH=`rpm --showrc | sed -n 's/^build arch *: //p'` ; \ ADIR=archive/ ; \ + rm -rf /var/tmp/xscreensaver-$$VERS-root ; \ rm -rf $$DIR ; \ mkdir $$DIR ; \ ( cd $$DIR; mkdir BUILD RPMS RPMS/$$ARCH SOURCES SPECS SRPMS ) ; \ diff --git a/README b/README index 6d3229c7..d9d3abf4 100644 --- a/README +++ b/README @@ -24,9 +24,6 @@ The most important hint is probably this: To build on VMS, see README.VMS. -If you are upgrading from version 2.* to version 3.*, be sure to delete -your ~/.xscreensaver file first, if you have one. - If you think you've found a bug, please let me know! No bug report is too small. But first, please read the enclosed `README.debugging' file to find out what kind of information would be most helpful to include in your bug @@ -39,9 +36,9 @@ You can try out xscreensaver like so: xscreensaver & xscreensaver-demo -Note: unlike `xlock', xscreensaver has a client-server model: the -`xscreensaver' process is a daemon that runs in the background; it is -controlled by the foreground `xscreensaver-demo' program. +The XScreenSaver suite of applications uses a client-server model: +The `xscreensaver' program is a daemon that runs in the background; +it is controlled by the foreground `xscreensaver-demo' program. xscreensaver has an extensive manual -- please read it! @@ -71,6 +68,33 @@ http://www.jwz.org/xscreensaver/. ============ +Changes since 3.34: * Redesigned `xscreensaver-demo' GUI. + * Added three new modes of operation: `One Screen Saver', + `Blank Screen', and `Don't Blank' (in addition to the + historical `Random Screen Saver'). + * Configure now defaults to installing the hacks in + /lib/xscreensaver/ instead of /bin/. + (Most distros already did it this way.) + * New GL hacks, `menger', `engine', `flipscreen3d'. + * Made `sierpinski3d' be more colorful. + * New versions of `xmatrix' and `nerverot'. + * Fixed a bug in `starwars' that made the font be drawn + with thin lines in -root mode. + * Fixed a bad colormap bug in `crystal' that could make + *subsequent* hacks malfunction! + * Made `gflux' able to grab screen images (`-mode grab'). + * Updated `webcollage' for recent search engine changes. + * Removed most command-line options to `xscreensaver': + just edit the ~/.xscreensaver file instead. + * Improved behavior on multi-screen and Xinerama systems: + the mouse now stays on the screen where the user left + it, and the password and splash dialogs always appear + on the screen that has the mouse. + * Made the splash dialog use more Gtk-like colors; + made it have only two buttons, "Settings" and "Help". + * Made `sonar' understand `.ssh/known_hosts2' format + files, and be better about stripping out illegal + addresses. Changes since 3.33: * Turned `memoryLimit' off by default, sigh. Apparently some versions of the GL libraries (appear to) allocate hundreds of megs for every GL program, so `memoryLimit' @@ -80,7 +104,7 @@ Changes since 3.33: * Turned `memoryLimit' off by default, sigh. Apparently * New GL hack, `circuit'. * Added `fuzz' mode to `decayscreen'. * New version of `whirlygig'. - * Added links to `glplanet' and `sphereEversion'. + * Added links to `xplanet' and `sphereEversion'. * Fixed rare race condition that could make `sonar' hang. * Fixed potential crash in `speedmine'. * Made `xscreensaver-demo' not crash when imageDirectory @@ -890,3 +914,12 @@ Changes since 1.13: * Added `orbit' option to `attraction' hack. Changes since 1.8: * Added demo mode, and locking. * Added `maze' hack. * Added `norotate' option to `rocks' hack. +Changes since 1.4: * Works when run from XDM before anyone logs in. + * Sped up `imsmap'. + * Can use `xv' as a slideshow without using up colormap + entries while the screen is not blanked. + * Fixed a BadDrawable error in non-XIdle mode. + * Added `blitspin' and `imsmap'. +Changes since 1.0: * Current list of included hacks is now: qix, helix, + rorschach, attraction, greynetic, rocks, pyro, + hopalong, and noseguy. diff --git a/README.debugging b/README.debugging index 49755066..9c847673 100644 --- a/README.debugging +++ b/README.debugging @@ -54,11 +54,11 @@ COMPILATION PROBLEMS: Before doing this, you'll need to nuke `config.cache'. - If you get errors about not being able to find Motif or Gtk (the - Xm/ or gtk/ header files), and you can't find them on your system, + If you get errors about not being able to find Gtk or Motif (the + gtk/ or Xm/ header files), and you can't find them on your system, then your system is horked and your vendor is lame. Perhaps the problem is that you don't have some kind of ``development option'' - installed. Xt/is free and available on all systems; Xm/ (Motif) + installed. Xt/ is free and available on all systems; Xm/ (Motif) is available on all commercial systems except SunOS 4.x and some early releases of Solaris. Linux and other free Unixes systems usually come with Gtk, but a Motif clone is also available from @@ -152,17 +152,11 @@ RUN-TIME PROBLEMS: diagnostics; the `-no-capture' option prevents the data from being displayed on the screensaver window as well.) - You also might want to use the `-timestamp' option, which will - cause the xscreensaver messages to include the time at which - they were printed. - * If the problem is intermittent, you might want to capture the log information to a file and examine it later. For example, you could start it from your login script like this (csh syntax): - ( cd ~/src/xscreensaver/ ; \ - xscreensaver -sync -verbose -timestamp -no-capture \ - >>&LOG & ) + xscreensaver -sync -verbose -no-capture >>& saverlog & * Hackers only: If you're feeling adventurous enough to run gdb on the xscreensaver driver process itself, make sure you've diff --git a/config.h-vms b/config.h-vms index fa45b356..3087f25e 100644 --- a/config.h-vms +++ b/config.h-vms @@ -150,7 +150,7 @@ likely prospects.) Note that this is just the default; X resources can be used to override it. */ -#define ZIPPY_PROGRAM "fortune" +#define FORTUNE_PROGRAM "fortune" diff --git a/config.h.in b/config.h.in index 09207ad0..9692f5da 100644 --- a/config.h.in +++ b/config.h.in @@ -114,6 +114,12 @@ */ #undef HAVE_XF86VMODE_GAMMA_RAMP +/* Define this if you have the Xinerama extension. This is standard on + * sufficiently-recent XFree86 systems, and possibly elsewhere. (It's + * available if the file /usr/include/X11/extensions/Xinerama.h exists.) + */ +#undef HAVE_XINERAMA + /* Define this if you have a Linux-like /proc/interrupts file which can be * examined to determine when keyboard activity has occurred. */ @@ -142,6 +148,10 @@ */ #undef HAVE_CRAPPLET +/* Define this if you have the XML library. + */ +#undef HAVE_XML + /* Define this if you have the XPM library installed. Some of the demos can * make use of this if it is available. */ @@ -185,11 +195,10 @@ #undef HAVE_DOUBLE_BUFFER_EXTENSION /* Some screenhacks like to run an external program to generate random pieces - of text; set this to the one you like ("yow" and "fortune" are the most - likely prospects.) Note that this is just the default; X resources can - be used to override it. + of text; set this to the one you like. Note that this is just the + default; X resources can be used to override it. */ -#define ZIPPY_PROGRAM "fortune" +#define FORTUNE_PROGRAM "fortune" diff --git a/configure b/configure index 7893b4f6..297ce8af 100755 --- a/configure +++ b/configure @@ -15,15 +15,17 @@ ac_help="$ac_help" ac_help="$ac_help Installation options: - --enable-subdir=DIR Put the demo programs in a subdirectory of \`bindir', - instead of putting them in bindir itself. You can - specify the name of the subdirectory. For example, - \`--exec-prefix=/usr/local --enable-subdir=demos' - would put xscreensaver in /usr/local/bin/, and would - put the demos in /usr/local/bin/demos/. (If DIR - begins with /, then bindir will not be prepended.) - - --disable-subdir Just put the demos in \`bindir' (this is the default.) + --with-hackdir=DIR Where to install the hundreds of demo executables. + Default: \`PREFIX/lib/xscreensaver/' +" +ac_help="$ac_help +" +ac_help="$ac_help + --with-configdir=DIR Where to install the data files that describe each + of the display modes to the GUI. + Default: \`GNOMEPREFIX/control-center/screensavers/' + or \`PREFIX/lib/xscreensaver/config/', depending on + whether GNOME is available. " ac_help="$ac_help Except where noted, all of the --with options below can also take a @@ -48,6 +50,8 @@ ac_help="$ac_help --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL extension." ac_help="$ac_help --with-dpms-ext Include support for the DPMS extension." +ac_help="$ac_help + --with-xinerama-ext Include support for the XINERAMA extension." ac_help="$ac_help --with-xf86vmode-ext Include support for XFree86 virtual screens." ac_help="$ac_help @@ -78,6 +82,9 @@ ac_help="$ac_help ac_help="$ac_help --with-gnome Include support for the Gnome Control Center." ac_help="$ac_help + --with-xml The XML toolkit is needed for some parts of + the Gtk interface." +ac_help="$ac_help Graphics options: @@ -95,12 +102,10 @@ ac_help="$ac_help --with-readdisplay Include support for the XReadDisplay extension." ac_help="$ac_help - --with-zippy=PROGRAM Some demos are able to run an external program and + --with-fortune=PROGRAM Some demos are able to run an external program and display its text; this names the program to use by default (though it can be overridden with X - resources.) If you don't specify this, the default - is to use \"yow\" from the Emacs distribution (if you - have it) or else to use \"fortune\"." + resources.) Default is \"/usr/games/fortune\"." ac_help="$ac_help --with-setuid-hacks Allow some demos to be installed \`setuid root' (which is needed in order to ping other hosts.) @@ -816,7 +821,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:831: checking host system type" >&5 +echo "configure:836: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -839,7 +844,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:854: checking for $ac_word" >&5 +echo "configure:859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -869,7 +874,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:884: checking for $ac_word" >&5 +echo "configure:889: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -920,7 +925,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:935: checking for $ac_word" >&5 +echo "configure:940: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -952,7 +957,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:967: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:972: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -963,12 +968,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 978 "configure" +#line 983 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -994,12 +999,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1009: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1014: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1014: checking whether we are using GNU C" >&5 +echo "configure:1019: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1008,7 +1013,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1027,7 +1032,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1042: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1047: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1061,7 +1066,7 @@ fi if test -z "$GCC"; then echo $ac_n "checking how to request ANSI compilation""... $ac_c" 1>&6 -echo "configure:1076: checking how to request ANSI compilation" >&5 +echo "configure:1081: checking how to request ANSI compilation" >&5 case "$host" in *-hpux* ) echo "$ac_t""HPUX: adding -Ae" 1>&6 @@ -1084,16 +1089,16 @@ echo "configure:1076: checking how to request ANSI compilation" >&5 fi echo $ac_n "checking whether the compiler works on ANSI C""... $ac_c" 1>&6 -echo "configure:1099: checking whether the compiler works on ANSI C" >&5 +echo "configure:1104: checking whether the compiler works on ANSI C" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else @@ -1128,7 +1133,7 @@ fi if test -n "$GCC"; then if test -n "$GCC"; then echo $ac_n "checking whether gcc accepts -std""... $ac_c" 1>&6 -echo "configure:1143: checking whether gcc accepts -std" >&5 +echo "configure:1148: checking whether gcc accepts -std" >&5 if eval "test \"`echo '$''{'ac_cv_gcc_accepts_std'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1172,7 +1177,7 @@ echo "$ac_t""$ac_cv_gcc_accepts_std" 1>&6 fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1187: checking how to run the C preprocessor" >&5 +echo "configure:1192: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1187,13 +1192,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1204,13 +1209,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1221,13 +1226,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1252,12 +1257,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1267: checking for working const" >&5 +echo "configure:1272: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1327,21 +1332,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1342: checking for inline" >&5 +echo "configure:1347: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1368,7 +1373,7 @@ esac ac_bc_result=`echo 6+9 | bc 2>/dev/null` echo $ac_n "checking for bc""... $ac_c" 1>&6 -echo "configure:1383: checking for bc" >&5 +echo "configure:1388: checking for bc" >&5 if test "$ac_bc_result" = "15" ; then echo "$ac_t""yes" 1>&6 else @@ -1393,7 +1398,7 @@ echo "configure:1383: checking for bc" >&5 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1408: checking for a BSD compatible install" >&5 +echo "configure:1413: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1446,7 +1451,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether \"\${INSTALL} -d\" creates intermediate directories""... $ac_c" 1>&6 -echo "configure:1461: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5 +echo "configure:1466: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5 if eval "test \"`echo '$''{'ac_cv_install_d_creates_dirs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1468,7 +1473,7 @@ echo "$ac_t""$ac_cv_install_d_creates_dirs" 1>&6 if test "$ac_cv_install_d_creates_dirs" = no ; then echo $ac_n "checking whether \"mkdir -p\" creates intermediate directories""... $ac_c" 1>&6 -echo "configure:1483: checking whether \"mkdir -p\" creates intermediate directories" >&5 +echo "configure:1488: checking whether \"mkdir -p\" creates intermediate directories" >&5 if eval "test \"`echo '$''{'ac_cv_mkdir_p_creates_dirs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1499,7 +1504,7 @@ echo "$ac_t""$ac_cv_mkdir_p_creates_dirs" 1>&6 fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1514: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1519: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1535,12 +1540,12 @@ INSTALL_SCRIPT='${INSTALL}' # random libc stuff echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1550: checking for ANSI C header files" >&5 +echo "configure:1555: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1548,7 +1553,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1565,7 +1570,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1583,7 +1588,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1604,7 +1609,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1615,7 +1620,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1642,17 +1647,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1657: checking for $ac_hdr" >&5 +echo "configure:1662: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1679,12 +1684,12 @@ fi done echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:1694: checking for mode_t" >&5 +echo "configure:1699: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1712,12 +1717,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1727: checking for pid_t" >&5 +echo "configure:1732: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1745,12 +1750,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1760: checking for size_t" >&5 +echo "configure:1765: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1778,12 +1783,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1793: checking return type of signal handlers" >&5 +echo "configure:1798: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1800,7 +1805,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1820: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1819,12 +1824,12 @@ EOF echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1834: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1839: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1833,7 +1838,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1854,12 +1859,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1869: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1874: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1875,7 +1880,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1900,12 +1905,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1915: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1920: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1913,7 +1918,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1938,7 +1943,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1953: checking for opendir in -ldir" >&5 +echo "configure:1958: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1946,7 +1951,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1979,7 +1984,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1994: checking for opendir in -lx" >&5 +echo "configure:1999: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1987,7 +1992,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2021,12 +2026,12 @@ fi fi echo $ac_n "checking how to call gettimeofday""... $ac_c" 1>&6 -echo "configure:2036: checking how to call gettimeofday" >&5 +echo "configure:2041: checking how to call gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_gettimeofday_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2035,7 +2040,7 @@ struct timeval tv; struct timezone tzp; gettimeofday(&tv, &tzp); ; return 0; } EOF -if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_gettimeofday_args=2 else @@ -2043,7 +2048,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < #include @@ -2051,7 +2056,7 @@ int main() { struct timeval tv; gettimeofday(&tv); ; return 0; } EOF -if { (eval echo configure:2066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2071: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_gettimeofday_args=1 else @@ -2090,12 +2095,12 @@ EOF for ac_func in select fcntl uname nice setpriority getcwd getwd putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2105: checking for $ac_func" >&5 +echo "configure:2110: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2146,12 +2151,12 @@ done for ac_func in sigaction syslog realpath setrlimit do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2161: checking for $ac_func" >&5 +echo "configure:2166: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2199,12 +2204,12 @@ fi done echo $ac_n "checking for struct icmp""... $ac_c" 1>&6 -echo "configure:2214: checking for struct icmp" >&5 +echo "configure:2219: checking for struct icmp" >&5 if eval "test \"`echo '$''{'ac_cv_have_icmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2244,7 +2249,7 @@ struct icmp i; ; return 0; } EOF -if { (eval echo configure:2259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2264: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_icmp=yes else @@ -2264,12 +2269,12 @@ EOF fi echo $ac_n "checking for struct icmphdr""... $ac_c" 1>&6 -echo "configure:2279: checking for struct icmphdr" >&5 +echo "configure:2284: checking for struct icmphdr" >&5 if eval "test \"`echo '$''{'ac_cv_have_icmphdr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2304,7 +2309,7 @@ struct icmphdr i; ip.ip_hl = 0; ; return 0; } EOF -if { (eval echo configure:2319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_icmphdr=yes else @@ -2327,17 +2332,17 @@ for ac_hdr in crypt.h sys/select.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2342: checking for $ac_hdr" >&5 +echo "configure:2347: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2357: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2368,7 +2373,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2383: checking for $ac_word" >&5 +echo "configure:2388: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2407,7 +2412,7 @@ done PERL_VERSION=0 else echo $ac_n "checking perl version""... $ac_c" 1>&6 -echo "configure:2422: checking perl version" >&5 +echo "configure:2427: checking perl version" >&5 if eval "test \"`echo '$''{'ac_cv_perl_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2429,7 +2434,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:2444: checking for X" >&5 +echo "configure:2449: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -2491,12 +2496,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2516: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2565,14 +2570,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2678,17 +2683,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2693: checking whether -R must be followed by a space" >&5 +echo "configure:2698: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -2704,14 +2709,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -2743,7 +2748,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2758: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2763: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2751,7 +2756,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2784,7 +2789,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2799: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2804: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2792,7 +2797,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2832,12 +2837,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2847: checking for gethostbyname" >&5 +echo "configure:2852: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2881,7 +2886,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2896: checking for gethostbyname in -lnsl" >&5 +echo "configure:2901: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2889,7 +2894,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2930,12 +2935,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2945: checking for connect" >&5 +echo "configure:2950: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2979,7 +2984,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2994: checking for connect in -lsocket" >&5 +echo "configure:2999: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2987,7 +2992,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3022,12 +3027,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:3037: checking for remove" >&5 +echo "configure:3042: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -3071,7 +3076,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:3086: checking for remove in -lposix" >&5 +echo "configure:3091: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3079,7 +3084,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3114,12 +3119,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:3129: checking for shmat" >&5 +echo "configure:3134: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -3163,7 +3168,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:3178: checking for shmat in -lipc" >&5 +echo "configure:3183: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3171,7 +3176,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3215,7 +3220,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:3230: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:3235: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3223,7 +3228,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3265,7 +3270,7 @@ fi echo $ac_n "checking for X app-defaults directory""... $ac_c" 1>&6 -echo "configure:3280: checking for X app-defaults directory" >&5 +echo "configure:3285: checking for X app-defaults directory" >&5 if eval "test \"`echo '$''{'ac_cv_x_app_defaults'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3472,7 +3477,7 @@ case "$host" in # Some versions of Slowlaris Motif require -lgen. But not all. Why? echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6 -echo "configure:3487: checking for regcmp in -lgen" >&5 +echo "configure:3492: checking for regcmp in -lgen" >&5 ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3480,7 +3485,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3515,7 +3520,7 @@ fi ;; esac echo $ac_n "checking for XPointer""... $ac_c" 1>&6 -echo "configure:3530: checking for XPointer" >&5 +echo "configure:3535: checking for XPointer" >&5 if eval "test \"`echo '$''{'ac_cv_xpointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3526,14 +3531,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { XPointer foo = (XPointer) 0; ; return 0; } EOF -if { (eval echo configure:3548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_xpointer=yes else @@ -3571,17 +3576,17 @@ have_xmu=no CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/Xmu/Error.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xmu/Error.h""... $ac_c" 1>&6 -echo "configure:3586: checking for X11/Xmu/Error.h" >&5 +echo "configure:3591: checking for X11/Xmu/Error.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3596: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3630,7 +3635,7 @@ if test "$have_xmu" = yes ; then case "$host" in *-sunos4*) echo $ac_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug""... $ac_c" 1>&6 -echo "configure:3645: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 +echo "configure:3650: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 if eval "test \"`echo '$''{'ac_cv_sunos_xmu_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3643,14 +3648,14 @@ else # with X libraries because we know it's SunOS. LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_sunos_xmu_bug=no else @@ -3666,21 +3671,21 @@ fi echo "$ac_t""$ac_cv_sunos_xmu_bug" 1>&6 if test "$ac_cv_sunos_xmu_bug" = yes ; then echo $ac_n "checking whether the compiler understands -static""... $ac_c" 1>&6 -echo "configure:3681: checking whether the compiler understands -static" >&5 +echo "configure:3686: checking whether the compiler understands -static" >&5 if eval "test \"`echo '$''{'ac_cv_ld_static'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -static" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_ld_static=yes else @@ -3707,36 +3712,95 @@ fi ############################################################################### # -# Handle the --enable-subdir option +# Handle the --with-hackdir option # ############################################################################### +have_hackdir=yes +with_hackdir_req=unspecified +# Check whether --with-hackdir or --without-hackdir was given. +if test "${with_hackdir+set}" = set; then + withval="$with_hackdir" + with_hackdir="$withval"; with_hackdir_req="$withval" +else + with_hackdir=yes +fi + + +if test x"$with_hackdir" = xyes; then + HACKDIR='${exec_prefix}/lib/xscreensaver' +elif test x"$with_hackdir" = xno; then + HACKDIR='${bindir}' +else + # there must be a better way than this... + if test -z "`echo $with_hackdir | sed 's@^/.*@@'`" ; then + # absolute path + HACKDIR=$with_hackdir + else + # relative path + HACKDIR="\${exec_prefix}$with_hackdir" + fi +fi + +# canonicalize slashes. +HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` + +# This option used to be called --enable-subdir; make sure that is no longer +# used, since configure brain-damagedly ignores unknown --enable options. + +obsolete_enable= # Check whether --enable-subdir or --disable-subdir was given. if test "${enable_subdir+set}" = set; then enableval="$enable_subdir" - enable_subdir="$enableval" + obsolete_enable=yes +fi + +if test -n "$obsolete_enable"; then + echo "error: the --enable-subdir option has been replaced with" + echo " the new --with-hackdir option; see \`configure --help'" + echo " for more information." + exit 1 +fi + + +############################################################################### +# +# Handle the --with-configdir option +# +############################################################################### + +have_configdir=yes +with_configdir_req=unspecified +# Check whether --with-configdir or --without-configdir was given. +if test "${with_configdir+set}" = set; then + withval="$with_configdir" + with_configdir="$withval"; with_configdir_req="$withval" else - enable_subdir=no + with_configdir=yes fi -if test x"$enable_subdir" = xno; then - HACKDIR='${bindir}' -elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then - echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir" + +if test x"$with_configdir" = xyes; then + # filled in later... + HACK_CONF_DIR='' +elif test x"$with_configdir" = xno; then + echo "error: must be yes, or a pathname: --with-configdir=$with_configdir" exit 1 else # there must be a better way than this... - if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then + if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then # absolute path - HACKDIR=$enable_subdir + CONFIGDIR=$with_configdir else # relative path - HACKDIR='${bindir}/'$enable_subdir + CONFIGDIR="\${exec_prefix}$with_configdir" fi fi # canonicalize slashes. -HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +CONFIGDIR=`echo "${CONFIGDIR}" | sed 's@/$@@;s@//*@/@g'` + + ############################################################################### @@ -3763,7 +3827,7 @@ fi /*) echo $ac_n "checking for SGI SCREEN_SAVER headers""... $ac_c" 1>&6 -echo "configure:3778: checking for SGI SCREEN_SAVER headers" >&5 +echo "configure:3842: checking for SGI SCREEN_SAVER headers" >&5 d=$with_sgi/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -3773,7 +3837,7 @@ echo "configure:3778: checking for SGI SCREEN_SAVER headers" >&5 fi echo $ac_n "checking for SGI SCREEN_SAVER libs""... $ac_c" 1>&6 -echo "configure:3788: checking for SGI SCREEN_SAVER libs" >&5 +echo "configure:3852: checking for SGI SCREEN_SAVER libs" >&5 d=$with_sgi/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -3806,17 +3870,17 @@ if test "$with_sgi" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XScreenSaver.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XScreenSaver.h""... $ac_c" 1>&6 -echo "configure:3821: checking for X11/extensions/XScreenSaver.h" >&5 +echo "configure:3885: checking for X11/extensions/XScreenSaver.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3873,7 +3937,7 @@ fi /*) echo $ac_n "checking for MIT-SCREEN-SAVER headers""... $ac_c" 1>&6 -echo "configure:3888: checking for MIT-SCREEN-SAVER headers" >&5 +echo "configure:3952: checking for MIT-SCREEN-SAVER headers" >&5 d=$with_mit/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -3883,7 +3947,7 @@ echo "configure:3888: checking for MIT-SCREEN-SAVER headers" >&5 fi echo $ac_n "checking for MIT-SCREEN-SAVER libs""... $ac_c" 1>&6 -echo "configure:3898: checking for MIT-SCREEN-SAVER libs" >&5 +echo "configure:3962: checking for MIT-SCREEN-SAVER libs" >&5 d=$with_mit/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -3916,17 +3980,17 @@ if test "$with_mit" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/scrnsaver.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/scrnsaver.h""... $ac_c" 1>&6 -echo "configure:3931: checking for X11/extensions/scrnsaver.h" >&5 +echo "configure:3995: checking for X11/extensions/scrnsaver.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3971,7 +4035,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XScreenSaverRegister in -lXext""... $ac_c" 1>&6 -echo "configure:3986: checking for XScreenSaverRegister in -lXext" >&5 +echo "configure:4050: checking for XScreenSaverRegister in -lXext" >&5 ac_lib_var=`echo Xext'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3979,7 +4043,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4037,7 +4101,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XScreenSaverRegister in -lXExExt""... $ac_c" 1>&6 -echo "configure:4052: checking for XScreenSaverRegister in -lXExExt" >&5 +echo "configure:4116: checking for XScreenSaverRegister in -lXExExt" >&5 ac_lib_var=`echo XExExt'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4045,7 +4109,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXExExt -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4106,7 +4170,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XScreenSaverRegister in -lXss""... $ac_c" 1>&6 -echo "configure:4121: checking for XScreenSaverRegister in -lXss" >&5 +echo "configure:4185: checking for XScreenSaverRegister in -lXss" >&5 ac_lib_var=`echo Xss'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4114,7 +4178,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXss -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4191,7 +4255,7 @@ fi /*) echo $ac_n "checking for XIDLE headers""... $ac_c" 1>&6 -echo "configure:4206: checking for XIDLE headers" >&5 +echo "configure:4270: checking for XIDLE headers" >&5 d=$with_xidle/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4201,7 +4265,7 @@ echo "configure:4206: checking for XIDLE headers" >&5 fi echo $ac_n "checking for XIDLE libs""... $ac_c" 1>&6 -echo "configure:4216: checking for XIDLE libs" >&5 +echo "configure:4280: checking for XIDLE libs" >&5 d=$with_xidle/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4234,17 +4298,17 @@ if test "$with_xidle" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/xidle.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/xidle.h""... $ac_c" 1>&6 -echo "configure:4249: checking for X11/extensions/xidle.h" >&5 +echo "configure:4313: checking for X11/extensions/xidle.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4300,7 +4364,7 @@ fi /*) echo $ac_n "checking for SGI-VIDEO-CONTROL headers""... $ac_c" 1>&6 -echo "configure:4315: checking for SGI-VIDEO-CONTROL headers" >&5 +echo "configure:4379: checking for SGI-VIDEO-CONTROL headers" >&5 d=$with_sgivc/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4310,7 +4374,7 @@ echo "configure:4315: checking for SGI-VIDEO-CONTROL headers" >&5 fi echo $ac_n "checking for SGI-VIDEO-CONTROL libs""... $ac_c" 1>&6 -echo "configure:4325: checking for SGI-VIDEO-CONTROL libs" >&5 +echo "configure:4389: checking for SGI-VIDEO-CONTROL libs" >&5 d=$with_sgivc/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4345,17 +4409,17 @@ if test "$with_sgivc" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XSGIvc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XSGIvc.h""... $ac_c" 1>&6 -echo "configure:4360: checking for X11/extensions/XSGIvc.h" >&5 +echo "configure:4424: checking for X11/extensions/XSGIvc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4399,7 +4463,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XSGIvcQueryGammaMap in -lXsgivc""... $ac_c" 1>&6 -echo "configure:4414: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 +echo "configure:4478: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 ac_lib_var=`echo Xsgivc'_'XSGIvcQueryGammaMap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4407,7 +4471,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXsgivc -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4483,7 +4547,7 @@ fi /*) echo $ac_n "checking for DPMS headers""... $ac_c" 1>&6 -echo "configure:4498: checking for DPMS headers" >&5 +echo "configure:4562: checking for DPMS headers" >&5 d=$with_dpms/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4493,7 +4557,7 @@ echo "configure:4498: checking for DPMS headers" >&5 fi echo $ac_n "checking for DPMS libs""... $ac_c" 1>&6 -echo "configure:4508: checking for DPMS libs" >&5 +echo "configure:4572: checking for DPMS libs" >&5 d=$with_dpms/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4528,17 +4592,17 @@ if test "$with_dpms" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/dpms.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/dpms.h""... $ac_c" 1>&6 -echo "configure:4543: checking for X11/extensions/dpms.h" >&5 +echo "configure:4607: checking for X11/extensions/dpms.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4584,7 +4648,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for DPMSInfo in -lXext""... $ac_c" 1>&6 -echo "configure:4599: checking for DPMSInfo in -lXext" >&5 +echo "configure:4663: checking for DPMSInfo in -lXext" >&5 ac_lib_var=`echo Xext'_'DPMSInfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4592,7 +4656,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4649,7 +4713,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for DPMSInfo in -lXdpms""... $ac_c" 1>&6 -echo "configure:4664: checking for DPMSInfo in -lXdpms" >&5 +echo "configure:4728: checking for DPMSInfo in -lXdpms" >&5 ac_lib_var=`echo Xdpms'_'DPMSInfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4657,7 +4721,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXdpms -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4711,6 +4775,257 @@ elif test "$with_dpms" != no; then fi +############################################################################### +# +# Check for the XINERAMA server extension. +# +############################################################################### + +have_xinerama=no +with_xinerama_req=unspecified +# Check whether --with-xinerama-ext or --without-xinerama-ext was given. +if test "${with_xinerama_ext+set}" = set; then + withval="$with_xinerama_ext" + with_xinerama="$withval"; with_xinerama_req="$withval" +else + with_xinerama=yes +fi + + + + case "$with_xinerama" in + yes) ;; + no) ;; + + /*) + echo $ac_n "checking for XINERAMA headers""... $ac_c" 1>&6 +echo "configure:4814: checking for XINERAMA headers" >&5 + d=$with_xinerama/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + echo "$ac_t""$d" 1>&6 + else + echo "$ac_t""not found ($d: no such directory)" 1>&6 + fi + + echo $ac_n "checking for XINERAMA libs""... $ac_c" 1>&6 +echo "configure:4824: checking for XINERAMA libs" >&5 + d=$with_xinerama/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + echo "$ac_t""$d" 1>&6 + else + echo "$ac_t""not found ($d: no such directory)" 1>&6 + fi + + # replace the directory string with "yes". + with_xinerama_req="yes" + with_xinerama=$with_xinerama_req + ;; + + *) + echo "" + echo "error: argument to --with-xinerama-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + + +if test "$with_xinerama" = yes; then + + # first check for Xinerama.h + + ac_save_CPPFLAGS="$CPPFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + ac_safe=`echo "X11/extensions/Xinerama.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for X11/extensions/Xinerama.h""... $ac_c" 1>&6 +echo "configure:4859: checking for X11/extensions/Xinerama.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_xinerama=yes +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + + # if that succeeded, then check for the XINERAMA code in the libraries + if test "$have_xinerama" = yes; then + + # first look in -lXext + have_xinerama=no + + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" + + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" + + echo $ac_n "checking for XineramaQueryExtension in -lXext""... $ac_c" 1>&6 +echo "configure:4915: checking for XineramaQueryExtension in -lXext" >&5 +ac_lib_var=`echo Xext'_'XineramaQueryExtension | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXext -lXext -lX11 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_xinerama=yes +else + echo "$ac_t""no" 1>&6 +true +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + + # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.) + if test "$have_xinerama" = no; then + + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" + + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" + + echo $ac_n "checking for XineramaQueryExtension in -lXinerama""... $ac_c" 1>&6 +echo "configure:4980: checking for XineramaQueryExtension in -lXinerama" >&5 +ac_lib_var=`echo Xinerama'_'XineramaQueryExtension | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXinerama -lXext -lX11 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_xinerama=yes; SAVER_LIBS="$SAVER_LIBS -lXinerama" +else + echo "$ac_t""no" 1>&6 +true +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + fi + fi + + # if that succeeded, then we've really got it. + if test "$have_xinerama" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_XINERAMA 1 +EOF + + fi + +elif test "$with_xinerama" != no; then + echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama" + exit 1 +fi + + ############################################################################### # # Check for the XF86VMODE server extension (for virtual screens.) @@ -4735,7 +5050,7 @@ fi /*) echo $ac_n "checking for xf86vmode headers""... $ac_c" 1>&6 -echo "configure:4750: checking for xf86vmode headers" >&5 +echo "configure:5065: checking for xf86vmode headers" >&5 d=$with_xf86vmode/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4745,7 +5060,7 @@ echo "configure:4750: checking for xf86vmode headers" >&5 fi echo $ac_n "checking for xf86vmode libs""... $ac_c" 1>&6 -echo "configure:4760: checking for xf86vmode libs" >&5 +echo "configure:5075: checking for xf86vmode libs" >&5 d=$with_xf86vmode/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4780,17 +5095,17 @@ if test "$with_xf86vmode" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/xf86vmode.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/xf86vmode.h""... $ac_c" 1>&6 -echo "configure:4795: checking for X11/extensions/xf86vmode.h" >&5 +echo "configure:5110: checking for X11/extensions/xf86vmode.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5120: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4834,7 +5149,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XF86VidModeGetViewPort in -lXxf86vm""... $ac_c" 1>&6 -echo "configure:4849: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5 +echo "configure:5164: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5 ac_lib_var=`echo Xxf86vm'_'XF86VidModeGetViewPort | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4842,7 +5157,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXxf86vm -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4919,7 +5234,7 @@ fi /*) echo $ac_n "checking for xf86gamma headers""... $ac_c" 1>&6 -echo "configure:4934: checking for xf86gamma headers" >&5 +echo "configure:5249: checking for xf86gamma headers" >&5 d=$with_xf86gamma/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4929,7 +5244,7 @@ echo "configure:4934: checking for xf86gamma headers" >&5 fi echo $ac_n "checking for xf86gamma libs""... $ac_c" 1>&6 -echo "configure:4944: checking for xf86gamma libs" >&5 +echo "configure:5259: checking for xf86gamma libs" >&5 d=$with_xf86gamma/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4967,17 +5282,17 @@ if test "$with_xf86gamma" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/xf86vmode.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/xf86vmode.h""... $ac_c" 1>&6 -echo "configure:4982: checking for X11/extensions/xf86vmode.h" >&5 +echo "configure:5297: checking for X11/extensions/xf86vmode.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5022,7 +5337,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XF86VidModeSetGamma in -lXxf86vm""... $ac_c" 1>&6 -echo "configure:5037: checking for XF86VidModeSetGamma in -lXxf86vm" >&5 +echo "configure:5352: checking for XF86VidModeSetGamma in -lXxf86vm" >&5 ac_lib_var=`echo Xxf86vm'_'XF86VidModeSetGamma | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5030,7 +5345,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXxf86vm -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5089,7 +5404,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XF86VidModeSetGammaRamp in -lXxf86vm""... $ac_c" 1>&6 -echo "configure:5104: checking for XF86VidModeSetGammaRamp in -lXxf86vm" >&5 +echo "configure:5419: checking for XF86VidModeSetGammaRamp in -lXxf86vm" >&5 ac_lib_var=`echo Xxf86vm'_'XF86VidModeSetGammaRamp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5097,7 +5412,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXxf86vm -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5174,7 +5489,7 @@ fi fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -5212,7 +5527,7 @@ fi if test "$with_proc_interrupts" = yes; then echo $ac_n "checking whether /proc/interrupts contains keyboard data""... $ac_c" 1>&6 -echo "configure:5227: checking whether /proc/interrupts contains keyboard data" >&5 +echo "configure:5542: checking whether /proc/interrupts contains keyboard data" >&5 if eval "test \"`echo '$''{'ac_cv_have_proc_interrupts'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5345,7 +5660,7 @@ fi /*) echo $ac_n "checking for PAM headers""... $ac_c" 1>&6 -echo "configure:5360: checking for PAM headers" >&5 +echo "configure:5675: checking for PAM headers" >&5 d=$with_pam/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5355,7 +5670,7 @@ echo "configure:5360: checking for PAM headers" >&5 fi echo $ac_n "checking for PAM libs""... $ac_c" 1>&6 -echo "configure:5370: checking for PAM libs" >&5 +echo "configure:5685: checking for PAM libs" >&5 d=$with_pam/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5381,7 +5696,7 @@ echo "configure:5370: checking for PAM libs" >&5 if test "$enable_locking" = yes -a "$with_pam" = yes; then echo $ac_n "checking for PAM""... $ac_c" 1>&6 -echo "configure:5396: checking for PAM" >&5 +echo "configure:5711: checking for PAM" >&5 if eval "test \"`echo '$''{'ac_cv_pam'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5392,14 +5707,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { ; return 0; } EOF -if { (eval echo configure:5414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_pam=yes else @@ -5424,7 +5739,7 @@ EOF # libpam typically requires dlopen and dlsym. On FreeBSD, # those are in libc. On Linux and Solaris, they're in libdl. echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:5439: checking for dlopen in -ldl" >&5 +echo "configure:5754: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5432,7 +5747,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5465,12 +5780,12 @@ fi echo $ac_n "checking how to call pam_strerror""... $ac_c" 1>&6 -echo "configure:5480: checking how to call pam_strerror" >&5 +echo "configure:5795: checking how to call pam_strerror" >&5 if eval "test \"`echo '$''{'ac_cv_pam_strerror_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5480,7 +5795,7 @@ pam_handle_t *pamh = 0; char *s = pam_strerror(pamh, PAM_SUCCESS); ; return 0; } EOF -if { (eval echo configure:5495: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_pam_strerror_args=2 else @@ -5488,7 +5803,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < #include @@ -5498,7 +5813,7 @@ char *s = pam_strerror(PAM_SUCCESS); ; return 0; } EOF -if { (eval echo configure:5513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_pam_strerror_args=1 else @@ -5555,7 +5870,7 @@ fi /*) echo $ac_n "checking for Kerberos headers""... $ac_c" 1>&6 -echo "configure:5570: checking for Kerberos headers" >&5 +echo "configure:5885: checking for Kerberos headers" >&5 d=$with_kerberos/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5565,7 +5880,7 @@ echo "configure:5570: checking for Kerberos headers" >&5 fi echo $ac_n "checking for Kerberos libs""... $ac_c" 1>&6 -echo "configure:5580: checking for Kerberos libs" >&5 +echo "configure:5895: checking for Kerberos libs" >&5 d=$with_kerberos/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5591,7 +5906,7 @@ echo "configure:5580: checking for Kerberos libs" >&5 if test "$enable_locking" = yes -a "$with_kerberos" = yes; then echo $ac_n "checking for Kerberos 4""... $ac_c" 1>&6 -echo "configure:5606: checking for Kerberos 4" >&5 +echo "configure:5921: checking for Kerberos 4" >&5 if eval "test \"`echo '$''{'ac_cv_kerberos'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5602,14 +5917,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { ; return 0; } EOF -if { (eval echo configure:5624: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_kerberos=yes else @@ -5624,7 +5939,7 @@ fi echo "$ac_t""$ac_cv_kerberos" 1>&6 echo $ac_n "checking for Kerberos 5""... $ac_c" 1>&6 -echo "configure:5639: checking for Kerberos 5" >&5 +echo "configure:5954: checking for Kerberos 5" >&5 if eval "test \"`echo '$''{'ac_cv_kerberos5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5635,14 +5950,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { ; return 0; } EOF -if { (eval echo configure:5657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_kerberos5=yes else @@ -5689,12 +6004,12 @@ EOF if test "$have_kerberos" = yes ; then echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:5704: checking for res_search" >&5 +echo "configure:6019: checking for res_search" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_res_search=yes" else @@ -5735,7 +6050,7 @@ if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 -echo "configure:5750: checking for res_search in -lresolv" >&5 +echo "configure:6065: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5743,7 +6058,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5809,7 +6124,7 @@ fi /*) echo $ac_n "checking for shadow password headers""... $ac_c" 1>&6 -echo "configure:5824: checking for shadow password headers" >&5 +echo "configure:6139: checking for shadow password headers" >&5 d=$with_shadow/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5819,7 +6134,7 @@ echo "configure:5824: checking for shadow password headers" >&5 fi echo $ac_n "checking for shadow password libs""... $ac_c" 1>&6 -echo "configure:5834: checking for shadow password libs" >&5 +echo "configure:6149: checking for shadow password libs" >&5 d=$with_shadow/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5857,7 +6172,7 @@ fi if test "$with_shadow" = yes ; then echo $ac_n "checking for Sun-style shadow passwords""... $ac_c" 1>&6 -echo "configure:5872: checking for Sun-style shadow passwords" >&5 +echo "configure:6187: checking for Sun-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_sun_adjunct'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5868,7 +6183,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -5881,7 +6196,7 @@ struct passwd_adjunct *p = getpwanam("nobody"); const char *pw = p->pwa_passwd; ; return 0; } EOF -if { (eval echo configure:5896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sun_adjunct=yes else @@ -5911,7 +6226,7 @@ fi if test "$with_shadow" = yes ; then echo $ac_n "checking for DEC-style shadow passwords""... $ac_c" 1>&6 -echo "configure:5926: checking for DEC-style shadow passwords" >&5 +echo "configure:6241: checking for DEC-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_enhanced_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5922,7 +6237,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -5939,7 +6254,7 @@ struct pr_passwd *p; pw = p->ufld.fd_encrypt; ; return 0; } EOF -if { (eval echo configure:5954: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_enhanced_passwd=yes else @@ -5963,7 +6278,7 @@ echo "$ac_t""$ac_cv_enhanced_passwd" 1>&6 # But on DEC, it's in -lsecurity. # echo $ac_n "checking for getprpwnam in -lprot""... $ac_c" 1>&6 -echo "configure:5978: checking for getprpwnam in -lprot" >&5 +echo "configure:6293: checking for getprpwnam in -lprot" >&5 ac_lib_var=`echo prot'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5971,7 +6286,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lprot -lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6001,7 +6316,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6 -echo "configure:6016: checking for getprpwnam in -lsecurity" >&5 +echo "configure:6331: checking for getprpwnam in -lsecurity" >&5 ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6009,7 +6324,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6053,7 +6368,7 @@ fi if test "$with_shadow" = yes ; then echo $ac_n "checking for HP-style shadow passwords""... $ac_c" 1>&6 -echo "configure:6068: checking for HP-style shadow passwords" >&5 +echo "configure:6383: checking for HP-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6064,7 +6379,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -6077,7 +6392,7 @@ struct s_passwd *p = getspwnam("nobody"); const char *pw = p->pw_passwd; ; return 0; } EOF -if { (eval echo configure:6092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_hpux_passwd=yes else @@ -6098,7 +6413,7 @@ echo "$ac_t""$ac_cv_hpux_passwd" 1>&6 # on HPUX, bigcrypt is in -lsec echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6 -echo "configure:6113: checking for bigcrypt in -lsec" >&5 +echo "configure:6428: checking for bigcrypt in -lsec" >&5 ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6106,7 +6421,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6155,7 +6470,7 @@ fi if test "$with_shadow" = yes ; then echo $ac_n "checking for FreeBSD-style shadow passwords""... $ac_c" 1>&6 -echo "configure:6170: checking for FreeBSD-style shadow passwords" >&5 +echo "configure:6485: checking for FreeBSD-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_master_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6181,7 +6496,7 @@ fi if test "$with_shadow" = yes ; then echo $ac_n "checking for generic shadow passwords""... $ac_c" 1>&6 -echo "configure:6196: checking for generic shadow passwords" >&5 +echo "configure:6511: checking for generic shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_shadow'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6192,7 +6507,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -6204,7 +6519,7 @@ struct spwd *p = getspnam("nobody"); const char *pw = p->sp_pwdp; ; return 0; } EOF -if { (eval echo configure:6219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_shadow=yes else @@ -6225,7 +6540,7 @@ echo "$ac_t""$ac_cv_shadow" 1>&6 # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. have_getspnam=no echo $ac_n "checking for getspnam in -lc""... $ac_c" 1>&6 -echo "configure:6240: checking for getspnam in -lc" >&5 +echo "configure:6555: checking for getspnam in -lc" >&5 ac_lib_var=`echo c'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6233,7 +6548,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6266,7 +6581,7 @@ fi if test "$have_getspnam" = no ; then echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6 -echo "configure:6281: checking for getspnam in -lgen" >&5 +echo "configure:6596: checking for getspnam in -lgen" >&5 ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6274,7 +6589,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6321,7 +6636,7 @@ if test "$enable_locking" = yes ; then # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. have_crypt=no echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6 -echo "configure:6336: checking for crypt in -lc" >&5 +echo "configure:6651: checking for crypt in -lc" >&5 ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6329,7 +6644,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6362,7 +6677,7 @@ fi if test "$have_crypt" = no ; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:6377: checking for crypt in -lcrypt" >&5 +echo "configure:6692: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6370,7 +6685,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6465,7 +6780,7 @@ fi /*) echo $ac_n "checking for Motif headers""... $ac_c" 1>&6 -echo "configure:6480: checking for Motif headers" >&5 +echo "configure:6795: checking for Motif headers" >&5 d=$with_motif/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -6475,7 +6790,7 @@ echo "configure:6480: checking for Motif headers" >&5 fi echo $ac_n "checking for Motif libs""... $ac_c" 1>&6 -echo "configure:6490: checking for Motif libs" >&5 +echo "configure:6805: checking for Motif libs" >&5 d=$with_motif/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -6514,17 +6829,17 @@ if test "$with_motif" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6 -echo "configure:6529: checking for Xm/Xm.h" >&5 +echo "configure:6844: checking for Xm/Xm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6563,17 +6878,17 @@ if test "$have_motif" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "Xm/ComboBox.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/ComboBox.h""... $ac_c" 1>&6 -echo "configure:6578: checking for Xm/ComboBox.h" >&5 +echo "configure:6893: checking for Xm/ComboBox.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6636,7 +6951,7 @@ esac /*) echo $ac_n "checking for Gtk headers""... $ac_c" 1>&6 -echo "configure:6651: checking for Gtk headers" >&5 +echo "configure:6966: checking for Gtk headers" >&5 d=$with_gtk/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -6646,7 +6961,7 @@ echo "configure:6651: checking for Gtk headers" >&5 fi echo $ac_n "checking for Gtk libs""... $ac_c" 1>&6 -echo "configure:6661: checking for Gtk libs" >&5 +echo "configure:6976: checking for Gtk libs" >&5 d=$with_gtk/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -6704,7 +7019,7 @@ esac /*) echo $ac_n "checking for Gnome headers""... $ac_c" 1>&6 -echo "configure:6719: checking for Gnome headers" >&5 +echo "configure:7034: checking for Gnome headers" >&5 d=$with_gnome/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -6714,7 +7029,7 @@ echo "configure:6719: checking for Gnome headers" >&5 fi echo $ac_n "checking for Gnome libs""... $ac_c" 1>&6 -echo "configure:6729: checking for Gnome libs" >&5 +echo "configure:7044: checking for Gnome libs" >&5 d=$with_gnome/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -6770,7 +7085,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6785: checking for $ac_word" >&5 +echo "configure:7100: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_glib_config'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6810,7 +7125,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6825: checking for $ac_word" >&5 +echo "configure:7140: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_gtk_config'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6852,7 +7167,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6867: checking for $ac_word" >&5 +echo "configure:7182: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_gnome_config'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6898,7 +7213,7 @@ done if test "$have_gtk" = yes; then echo $ac_n "checking Gtk version number""... $ac_c" 1>&6 -echo "configure:6913: checking Gtk version number" >&5 +echo "configure:7228: checking Gtk version number" >&5 if eval "test \"`echo '$''{'ac_cv_gtk_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6927,7 +7242,7 @@ echo "$ac_t""$ac_cv_gtk_version_string" 1>&6 if test "$have_gtk" = yes; then echo $ac_n "checking for Gtk includes""... $ac_c" 1>&6 -echo "configure:6942: checking for Gtk includes" >&5 +echo "configure:7257: checking for Gtk includes" >&5 if eval "test \"`echo '$''{'ac_cv_gtk_config_cflags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6936,7 +7251,7 @@ fi echo "$ac_t""$ac_cv_gtk_config_cflags" 1>&6 echo $ac_n "checking for Gtk libs""... $ac_c" 1>&6 -echo "configure:6951: checking for Gtk libs" >&5 +echo "configure:7266: checking for Gtk libs" >&5 if eval "test \"`echo '$''{'ac_cv_gtk_config_libs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6951,9 +7266,9 @@ echo "$ac_t""$ac_cv_gtk_config_libs" 1>&6 # Check for Gnome Capplet support. # if test "$have_gnome" = yes -a "$have_gtk" = yes; then - gnome_config_libs="gtk capplet gnomeui" + gnome_config_libs="gtk capplet gnomeui xml" echo $ac_n "checking for Gnome capplet includes""... $ac_c" 1>&6 -echo "configure:6968: checking for Gnome capplet includes" >&5 +echo "configure:7283: checking for Gnome capplet includes" >&5 if eval "test \"`echo '$''{'ac_cv_gnome_config_cflags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6976,7 +7291,7 @@ fi if test "$have_gnome" = yes -a "$have_gtk" = yes; then echo $ac_n "checking for Gnome capplet libs""... $ac_c" 1>&6 -echo "configure:6991: checking for Gnome capplet libs" >&5 +echo "configure:7306: checking for Gnome capplet libs" >&5 if eval "test \"`echo '$''{'ac_cv_gnome_config_libs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7034,7 +7349,7 @@ if test "$have_gnome" = yes; then # Extract the first word of "gnome-help-browser", so it can be a program name with args. set dummy gnome-help-browser; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7049: checking for $ac_word" >&5 +echo "configure:7364: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_have_gnome_help'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7066,6 +7381,201 @@ else fi +############################################################################### +# +# Check for -lxml (if we have Gtk) +# +############################################################################### + +have_xml=no +with_xml_req=unspecified +# Check whether --with-xml or --without-xml was given. +if test "${with_xml+set}" = set; then + withval="$with_xml" + with_xml="$withval"; with_xml_req="$withval" +else + with_xml=yes +fi + + + + case "$with_xml" in + yes) ;; + no) ;; + + /*) + echo $ac_n "checking for XML headers""... $ac_c" 1>&6 +echo "configure:7420: checking for XML headers" >&5 + d=$with_xml/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + echo "$ac_t""$d" 1>&6 + else + echo "$ac_t""not found ($d: no such directory)" 1>&6 + fi + + echo $ac_n "checking for XML libs""... $ac_c" 1>&6 +echo "configure:7430: checking for XML libs" >&5 + d=$with_xml/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + echo "$ac_t""$d" 1>&6 + else + echo "$ac_t""not found ($d: no such directory)" 1>&6 + fi + + # replace the directory string with "yes". + with_xml_req="yes" + with_xml=$with_xml_req + ;; + + *) + echo "" + echo "error: argument to --with-xml must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + + +if test "$with_xml" != yes -a "$with_xml" != no ; then + echo "error: must be yes or no: --with-xml=$with_xml" + exit 1 +fi + +if test "$have_gtk" != yes; then + # don't bother if no GTK + with_xml=no +fi + +if test "$with_xml" = yes; then + have_xml=no + + # the XML stuff is likely to be in GTK paths. + ac_save_X_CFLAGS="$X_CFLAGS" + ac_save_X_LIBS="$X_LIBS" + X_CFLAGS="$X_CFLAGS $ac_gtk_config_cflags" + X_LIBS="$X_LIBS $ac_gtk_config_libs" + + + ac_save_CPPFLAGS="$CPPFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + ac_safe=`echo "xmlIO.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for xmlIO.h""... $ac_c" 1>&6 +echo "configure:7481: checking for xmlIO.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:7491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_xml=yes +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + + if test "$have_xml" = yes; then + # we have the header, now check for the library + have_xml=no + + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" + + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" + + echo $ac_n "checking for xmlParseChunk in -lxml""... $ac_c" 1>&6 +echo "configure:7535: checking for xmlParseChunk in -lxml" >&5 +ac_lib_var=`echo xml'_'xmlParseChunk | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lxml $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_xml=yes + XML_LIBS="-lxml" + cat >> confdefs.h <<\EOF +#define HAVE_XML 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + fi + + X_CFLAGS="$ac_save_X_CFLAGS" + X_LIBS="$ac_save_X_LIBS" + +fi + + ############################################################################### # # Checking whether Motif is really Lesstif. @@ -7075,7 +7585,7 @@ fi have_lesstif=no if test "$have_motif" = yes ; then echo $ac_n "checking whether Motif is really LessTif""... $ac_c" 1>&6 -echo "configure:7090: checking whether Motif is really LessTif" >&5 +echo "configure:7600: checking whether Motif is really LessTif" >&5 if eval "test \"`echo '$''{'ac_cv_have_lesstif'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7086,14 +7596,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { long vers = LesstifVersion; ; return 0; } EOF -if { (eval echo configure:7108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7618: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_lesstif=yes else @@ -7118,7 +7628,7 @@ if test "$have_lesstif" = yes ; then ltv=unknown echo unknown > conftest-lt echo $ac_n "checking LessTif version number""... $ac_c" 1>&6 -echo "configure:7133: checking LessTif version number" >&5 +echo "configure:7643: checking LessTif version number" >&5 if eval "test \"`echo '$''{'ac_cv_lesstif_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7133,7 +7643,7 @@ else ac_cv_lesstif_version_string=unknown else cat > conftest.$ac_ext < #include @@ -7146,7 +7656,7 @@ else exit(0); } EOF -if { (eval echo configure:7161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ltv=`cat conftest-lt` ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'` @@ -7176,7 +7686,7 @@ if test "$have_motif" = yes ; then mtv=unknown echo unknown > conftest-mt echo $ac_n "checking Motif version number""... $ac_c" 1>&6 -echo "configure:7191: checking Motif version number" >&5 +echo "configure:7701: checking Motif version number" >&5 if eval "test \"`echo '$''{'ac_cv_motif_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7191,7 +7701,7 @@ else ac_cv_motif_version_string=unknown else cat > conftest.$ac_ext < #include @@ -7204,7 +7714,7 @@ else exit(0); } EOF -if { (eval echo configure:7219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then mtv=`cat conftest-mt` ac_cv_motif_version=`echo $mtv | sed 's/ .*//'` @@ -7248,7 +7758,7 @@ fi motif_requires_xpm=no if test "$have_motif" = yes ; then echo $ac_n "checking whether Motif requires XPM""... $ac_c" 1>&6 -echo "configure:7263: checking whether Motif requires XPM" >&5 +echo "configure:7773: checking whether Motif requires XPM" >&5 if test "$motif_version" = "unknown" || test "$motif_version" -ge 2000 then motif_requires_xpm=yes @@ -7290,7 +7800,7 @@ if test "$have_motif" = yes ; then LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XpQueryExtension in -lXp""... $ac_c" 1>&6 -echo "configure:7305: checking for XpQueryExtension in -lXp" >&5 +echo "configure:7815: checking for XpQueryExtension in -lXp" >&5 ac_lib_var=`echo Xp'_'XpQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7298,7 +7808,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXp -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7363,7 +7873,7 @@ if test "$have_motif" = yes ; then LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for _Xsetlocale in -lXintl""... $ac_c" 1>&6 -echo "configure:7378: checking for _Xsetlocale in -lXintl" >&5 +echo "configure:7888: checking for _Xsetlocale in -lXintl" >&5 ac_lib_var=`echo Xintl'_'_Xsetlocale | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7371,7 +7881,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXintl -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7439,7 +7949,7 @@ fi /*) echo $ac_n "checking for GL headers""... $ac_c" 1>&6 -echo "configure:7454: checking for GL headers" >&5 +echo "configure:7964: checking for GL headers" >&5 d=$with_gl/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -7449,7 +7959,7 @@ echo "configure:7454: checking for GL headers" >&5 fi echo $ac_n "checking for GL libs""... $ac_c" 1>&6 -echo "configure:7464: checking for GL libs" >&5 +echo "configure:7974: checking for GL libs" >&5 d=$with_gl/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -7485,17 +7995,17 @@ if test "$with_gl" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6 -echo "configure:7500: checking for GL/gl.h" >&5 +echo "configure:8010: checking for GL/gl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7510: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7526,17 +8036,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/glx.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/glx.h""... $ac_c" 1>&6 -echo "configure:7541: checking for GL/glx.h" >&5 +echo "configure:8051: checking for GL/glx.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7568,7 +8078,7 @@ fi # to link against. # echo $ac_n "checking whether GL is really MesaGL""... $ac_c" 1>&6 -echo "configure:7583: checking whether GL is really MesaGL" >&5 +echo "configure:8093: checking whether GL is really MesaGL" >&5 if eval "test \"`echo '$''{'ac_cv_have_mesa_gl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7580,7 +8090,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -7609,7 +8119,7 @@ echo "$ac_t""$ac_cv_have_mesa_gl" 1>&6 # if test "$ac_have_mesa_gl" = yes; then echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:7624: checking for pthread_create in -lpthread" >&5 +echo "configure:8134: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7617,7 +8127,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7675,7 +8185,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for glXCreateContext in -lMesaGL""... $ac_c" 1>&6 -echo "configure:7690: checking for glXCreateContext in -lMesaGL" >&5 +echo "configure:8200: checking for glXCreateContext in -lMesaGL" >&5 ac_lib_var=`echo MesaGL'_'glXCreateContext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7683,7 +8193,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lMesaGL -lMesaGLU $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7740,7 +8250,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for glXCreateContext in -lGL""... $ac_c" 1>&6 -echo "configure:7755: checking for glXCreateContext in -lGL" >&5 +echo "configure:8265: checking for glXCreateContext in -lGL" >&5 ac_lib_var=`echo GL'_'glXCreateContext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7748,7 +8258,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lGL -lGLU $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7817,12 +8327,12 @@ EOF if test "$ac_have_mesa_gl" = yes; then echo $ac_n "checking MesaGL version number""... $ac_c" 1>&6 -echo "configure:7832: checking MesaGL version number" >&5 +echo "configure:8342: checking MesaGL version number" >&5 if eval "test \"`echo '$''{'ac_cv_mesagl_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef MESA_MAJOR_VERSION @@ -7893,7 +8403,7 @@ echo "$ac_t""$ac_cv_mesagl_version_string" 1>&6 LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for glBindTexture in -l$gl_lib_1""... $ac_c" 1>&6 -echo "configure:7908: checking for glBindTexture in -l$gl_lib_1" >&5 +echo "configure:8418: checking for glBindTexture in -l$gl_lib_1" >&5 ac_lib_var=`echo $gl_lib_1'_'glBindTexture | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7901,7 +8411,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7973,7 +8483,7 @@ fi /*) echo $ac_n "checking for GLE headers""... $ac_c" 1>&6 -echo "configure:7988: checking for GLE headers" >&5 +echo "configure:8498: checking for GLE headers" >&5 d=$with_gle/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -7983,7 +8493,7 @@ echo "configure:7988: checking for GLE headers" >&5 fi echo $ac_n "checking for GLE libs""... $ac_c" 1>&6 -echo "configure:7998: checking for GLE libs" >&5 +echo "configure:8508: checking for GLE libs" >&5 d=$with_gle/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8019,17 +8529,17 @@ if test "$with_gle" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/gle.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gle.h""... $ac_c" 1>&6 -echo "configure:8034: checking for GL/gle.h" >&5 +echo "configure:8544: checking for GL/gle.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8044: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8062,17 +8572,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/gutil.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gutil.h""... $ac_c" 1>&6 -echo "configure:8077: checking for GL/gutil.h" >&5 +echo "configure:8587: checking for GL/gutil.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8087: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8597: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8103,17 +8613,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/tube.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/tube.h""... $ac_c" 1>&6 -echo "configure:8118: checking for GL/tube.h" >&5 +echo "configure:8628: checking for GL/tube.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8159,7 +8669,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for gleCreateGC in -lgle""... $ac_c" 1>&6 -echo "configure:8174: checking for gleCreateGC in -lgle" >&5 +echo "configure:8684: checking for gleCreateGC in -lgle" >&5 ac_lib_var=`echo gle'_'gleCreateGC | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8167,7 +8677,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8238,7 +8748,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for uview_direction in -lgle""... $ac_c" 1>&6 -echo "configure:8253: checking for uview_direction in -lgle" >&5 +echo "configure:8763: checking for uview_direction in -lgle" >&5 ac_lib_var=`echo gle'_'uview_direction | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8246,7 +8756,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8302,7 +8812,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for uview_direction_d in -lmatrix""... $ac_c" 1>&6 -echo "configure:8317: checking for uview_direction_d in -lmatrix" >&5 +echo "configure:8827: checking for uview_direction_d in -lmatrix" >&5 ac_lib_var=`echo matrix'_'uview_direction_d | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8310,7 +8820,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8394,7 +8904,7 @@ fi /*) echo $ac_n "checking for XPM headers""... $ac_c" 1>&6 -echo "configure:8409: checking for XPM headers" >&5 +echo "configure:8919: checking for XPM headers" >&5 d=$with_xpm/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8404,7 +8914,7 @@ echo "configure:8409: checking for XPM headers" >&5 fi echo $ac_n "checking for XPM libs""... $ac_c" 1>&6 -echo "configure:8419: checking for XPM libs" >&5 +echo "configure:8929: checking for XPM libs" >&5 d=$with_xpm/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8437,17 +8947,17 @@ if test "$with_xpm" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6 -echo "configure:8452: checking for X11/xpm.h" >&5 +echo "configure:8962: checking for X11/xpm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8972: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8513,7 +9023,7 @@ fi /*) echo $ac_n "checking for XSHM headers""... $ac_c" 1>&6 -echo "configure:8528: checking for XSHM headers" >&5 +echo "configure:9038: checking for XSHM headers" >&5 d=$with_xshm/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8523,7 +9033,7 @@ echo "configure:8528: checking for XSHM headers" >&5 fi echo $ac_n "checking for XSHM libs""... $ac_c" 1>&6 -echo "configure:8538: checking for XSHM libs" >&5 +echo "configure:9048: checking for XSHM libs" >&5 d=$with_xshm/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8558,17 +9068,17 @@ if test "$with_xshm" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6 -echo "configure:8573: checking for X11/extensions/XShm.h" >&5 +echo "configure:9083: checking for X11/extensions/XShm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9093: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8602,17 +9112,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6 -echo "configure:8617: checking for sys/ipc.h" >&5 +echo "configure:9127: checking for sys/ipc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8647,17 +9157,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6 -echo "configure:8662: checking for sys/shm.h" >&5 +echo "configure:9172: checking for sys/shm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8709,7 +9219,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6 -echo "configure:8724: checking for XShmQueryExtension in -lXextSam" >&5 +echo "configure:9234: checking for XShmQueryExtension in -lXextSam" >&5 ac_lib_var=`echo XextSam'_'XShmQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8717,7 +9227,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXextSam -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8795,7 +9305,7 @@ fi /*) echo $ac_n "checking for DOUBLE-BUFFER headers""... $ac_c" 1>&6 -echo "configure:8810: checking for DOUBLE-BUFFER headers" >&5 +echo "configure:9320: checking for DOUBLE-BUFFER headers" >&5 d=$with_xdbe/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8805,7 +9315,7 @@ echo "configure:8810: checking for DOUBLE-BUFFER headers" >&5 fi echo $ac_n "checking for DOUBLE-BUFFER libs""... $ac_c" 1>&6 -echo "configure:8820: checking for DOUBLE-BUFFER libs" >&5 +echo "configure:9330: checking for DOUBLE-BUFFER libs" >&5 d=$with_xdbe/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8839,17 +9349,17 @@ if test "$with_xdbe" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/Xdbe.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/Xdbe.h""... $ac_c" 1>&6 -echo "configure:8854: checking for X11/extensions/Xdbe.h" >&5 +echo "configure:9364: checking for X11/extensions/Xdbe.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8912,7 +9422,7 @@ fi /*) echo $ac_n "checking for XReadDisplay headers""... $ac_c" 1>&6 -echo "configure:8927: checking for XReadDisplay headers" >&5 +echo "configure:9437: checking for XReadDisplay headers" >&5 d=$with_readdisplay/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8922,7 +9432,7 @@ echo "configure:8927: checking for XReadDisplay headers" >&5 fi echo $ac_n "checking for XReadDisplay libs""... $ac_c" 1>&6 -echo "configure:8937: checking for XReadDisplay libs" >&5 +echo "configure:9447: checking for XReadDisplay libs" >&5 d=$with_readdisplay/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8955,17 +9465,17 @@ if test "$with_readdisplay" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/readdisplay.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/readdisplay.h""... $ac_c" 1>&6 -echo "configure:8970: checking for X11/extensions/readdisplay.h" >&5 +echo "configure:9480: checking for X11/extensions/readdisplay.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9490: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9001,61 +9511,60 @@ fi # Check for a program to generate random text. # # Zippy is funnier than the idiocy generally spat out by `fortune', -# so try to find that, by invoking Emacs and asking it where its -# libexec directory is ("yow" lives in there.) +# so first see if "fortune zippy" works. Else, use plain "fortune". # -# If that doesn't work, see if fortune, zippy, or yow are on $PATH, -# and if so, use them. -# -# If that doesn't work, look in /usr/games, and if it's there, use -# the full pathname. +# We used to dig around in Emacs to look for the "yow" program, but +# most people who have Emacs also have "fortune zippy", so nevermind. # ############################################################################### -with_zippy_req="" -# Check whether --with-zippy or --without-zippy was given. -if test "${with_zippy+set}" = set; then - withval="$with_zippy" - with_zippy_req="$withval"; with_zippy="$withval" +with_fortune_req="" +# Check whether --with-fortune or --without-fortune was given. +if test "${with_fortune+set}" = set; then + withval="$with_fortune" + with_fortune_req="$withval"; with_fortune="$withval" else - with_zippy=yes + with_fortune=yes fi -if test "$with_zippy" = no || test "$with_zippy" = yes ; then - with_zippy="" - with_zippy_req="" +if test "$with_fortune" = no || test "$with_fortune" = yes ; then + with_fortune="" + with_fortune_req="" fi -if test -n "$with_zippy_req" ; then - ac_cv_zippy_program="" - case "$with_zippy_req" in +if test -n "$with_fortune_req" ; then + ac_cv_fortune_program="" + case "$with_fortune_req" in /*) - echo $ac_n "checking for $with_zippy_req""... $ac_c" 1>&6 -echo "configure:9047: checking for $with_zippy_req" >&5 - if test -x "$with_zippy_req" ; then + + set dummy $with_fortune_req ; fortune_tmp=$2 + echo $ac_n "checking for $fortune_tmp""... $ac_c" 1>&6 +echo "configure:9555: checking for $fortune_tmp" >&5 + if test -x "$fortune_tmp" ; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 - with_zippy="" + with_fortune="" fi ;; *) + set dummy $with_fortune_req ; fortune_tmp=$2 # don't cache - unset ac_cv_path_zip2 - # Extract the first word of "$with_zippy_req", so it can be a program name with args. -set dummy $with_zippy_req; ac_word=$2 + unset ac_cv_path_fortune_tmp + # Extract the first word of "$fortune_tmp", so it can be a program name with args. +set dummy $fortune_tmp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9061: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_zip2'+set}'`\" = set"; then +echo "configure:9570: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_fortune_tmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$zip2" in + case "$fortune_tmp" in /*) - ac_cv_path_zip2="$zip2" # Let the user override the test with a path. + ac_cv_path_fortune_tmp="$fortune_tmp" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_zip2="$zip2" # Let the user override the test with a dos path. + ac_cv_path_fortune_tmp="$fortune_tmp" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -9063,7 +9572,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_zip2="$ac_dir/$ac_word" + ac_cv_path_fortune_tmp="$ac_dir/$ac_word" break fi done @@ -9071,263 +9580,135 @@ else ;; esac fi -zip2="$ac_cv_path_zip2" -if test -n "$zip2"; then - echo "$ac_t""$zip2" 1>&6 +fortune_tmp="$ac_cv_path_fortune_tmp" +if test -n "$fortune_tmp"; then + echo "$ac_t""$fortune_tmp" 1>&6 else echo "$ac_t""no" 1>&6 fi - if test "$zip2" = ""; then - with_zippy="" + if test -z "$fortune_tmp" ; then + with_fortune="" fi ;; esac - ac_cv_zippy_program="$with_zippy" + ac_cv_fortune_program="$with_fortune" -elif test -n "$ac_cv_zippy_program"; then - echo "$ac_t""checking for zippy... (cached) $ac_cv_zippy_program" 1>&6 +elif test -n "$ac_cv_fortune_program"; then + echo "$ac_t""checking for fortune... (cached) $ac_cv_fortune_program" 1>&6 fi -if test ! -n "$ac_cv_zippy_program"; then +unset ac_cv_path_fortune_tmp +unset fortune_tmp - for ac_prog in emacs +if test -z "$ac_cv_fortune_program" ; then + + # first look for fortune in /usr/games/ (and use absolute path) + for ac_prog in fortune do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9111: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_emacs_exe'+set}'`\" = set"; then +echo "configure:9624: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_fortune_tmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$emacs_exe"; then - ac_cv_prog_emacs_exe="$emacs_exe" # Let the user override the test. -else + case "$fortune_tmp" in + /*) + ac_cv_path_fortune_tmp="$fortune_tmp" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_fortune_tmp="$fortune_tmp" # Let the user override the test with a dos path. + ;; + *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + ac_dummy=""/usr/games"" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_emacs_exe="$ac_prog" + ac_cv_path_fortune_tmp="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" + ;; +esac fi -fi -emacs_exe="$ac_cv_prog_emacs_exe" -if test -n "$emacs_exe"; then - echo "$ac_t""$emacs_exe" 1>&6 +fortune_tmp="$ac_cv_path_fortune_tmp" +if test -n "$fortune_tmp"; then + echo "$ac_t""$fortune_tmp" 1>&6 else echo "$ac_t""no" 1>&6 fi -test -n "$emacs_exe" && break +test -n "$fortune_tmp" && break done - for ac_prog in xemacs + + # if it's not there, look on $PATH (and don't use absolute path) + if test -z "$fortune_tmp" ; then + for ac_prog in fortune do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9145: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_xemacs_exe'+set}'`\" = set"; then +echo "configure:9667: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_fortune_tmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$xemacs_exe"; then - ac_cv_prog_xemacs_exe="$xemacs_exe" # Let the user override the test. + if test -n "$fortune_tmp"; then + ac_cv_prog_fortune_tmp="$fortune_tmp" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_xemacs_exe="$ac_prog" + ac_cv_prog_fortune_tmp="$ac_prog" break fi done IFS="$ac_save_ifs" fi fi -xemacs_exe="$ac_cv_prog_xemacs_exe" -if test -n "$xemacs_exe"; then - echo "$ac_t""$xemacs_exe" 1>&6 +fortune_tmp="$ac_cv_prog_fortune_tmp" +if test -n "$fortune_tmp"; then + echo "$ac_t""$fortune_tmp" 1>&6 else echo "$ac_t""no" 1>&6 fi -test -n "$xemacs_exe" && break +test -n "$fortune_tmp" && break done - - ac_cv_zippy_program="" - eargs='-batch -q -nw --eval' - - if test -n "$emacs_exe" ; then - echo $ac_n "checking for emacs yow""... $ac_c" 1>&6 -echo "configure:9180: checking for emacs yow" >&5 - # - # get emacs to tell us where the libexec directory is. - # - dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \ - 2>/dev/null | tail -1` - dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'` - # - # try running libexec/yow and see if it exits without error. - # - if test x"$dir" != x -a -x "$dir/yow" ; then - if $dir/yow >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow" - echo "$ac_t""$ac_cv_zippy_program" 1>&6 - else - echo "$ac_t""no" 1>&6 - fi - fi fi - if test -z "$ac_cv_zippy_program" ; then - echo $ac_n "checking for xemacs yow""... $ac_c" 1>&6 -echo "configure:9202: checking for xemacs yow" >&5 - if test -n "$xemacs_exe" ; then - # - # get xemacs to tell us where the libexec directory is. - # - dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \ - 2>/dev/null | tail -1` - dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'` - # - # try running libexec/yow and see if it exits without error. - # - if test x"$dir" != x -a -x "$dir/yow" ; then - if $dir/yow >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow" - echo "$ac_t""$ac_cv_zippy_program" 1>&6 - else - # - # in some xemacs installations, the pathname of the yow.lines file - # isn't hardcoded into the yow executable, and must be passed on - # the command line. See if it's in libexec/../etc/. - - # M4 sucks!! - - dir_up=`echo "$dir" | sed 's@/[^/]*$@@'` - - - yowlines="$dir_up/etc/yow.lines" - if $dir/yow -f $yowlines >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow -f $yowlines" - echo "$ac_t""$ac_cv_zippy_program" 1>&6 - else - # - # In newer XEmacs releases, yow.lines is in a different place, - # and the easiest way to get it is by calling the new function - # `locate-data-file'. - # - yowlines=`$xemacs_exe $eargs \ - '(princ (concat (locate-data-file "yow.lines") "\n"))' \ - 2>/dev/null | tail -1` - if $dir/yow -f $yowlines >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow -f $yowlines" - echo "$ac_t""$ac_cv_zippy_program" 1>&6 - else - echo "$ac_t""no" 1>&6 - fi - fi - fi - fi - fi + # if we didn't find anything, then just assume /usr/games/ + if test -z "$fortune_tmp" ; then + fortune_tmp="/usr/games/fortune" fi - # if that didn't work, try for some other programs... - if test -z "$ac_cv_zippy_program" ; then - fortune='' - for ac_prog in fortune zippy yow -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9261: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_fortune'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$fortune"; then - ac_cv_prog_fortune="$fortune" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_fortune="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -fortune="$ac_cv_prog_fortune" -if test -n "$fortune"; then - echo "$ac_t""$fortune" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi + ac_cv_fortune_program="$fortune_tmp" -test -n "$fortune" && break -done - - # if that didn't work, try for those programs in /usr/games... - if test -z "$fortune" ; then - for ac_prog in fortune zippy yow -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9297: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_fortune'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$fortune" in - /*) - ac_cv_path_fortune="$fortune" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_fortune="$fortune" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/games:/usr/local/games:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_fortune="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - ;; -esac -fi -fortune="$ac_cv_path_fortune" -if test -n "$fortune"; then - echo "$ac_t""$fortune" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$fortune" && break -done -test -n "$fortune" || fortune="fortune" - - fi + # now check to see whether "fortune zippy" works. + # + fortune_tmp="$fortune_tmp zippy" + echo $ac_n "checking for zippy quotes""... $ac_c" 1>&6 +echo "configure:9709: checking for zippy quotes" >&5 + if ( $fortune_tmp >/dev/null 2>&1 ); then + ac_cv_fortune_program="$fortune_tmp" + echo "$ac_t""$fortune_tmp" 1>&6 + else + echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_zippy_program" ; then - ac_cv_zippy_program=fortune fi +unset ac_cv_path_fortune_tmp +unset fortune_tmp + cat >> confdefs.h <&6 -echo "configure:9372: checking for setuid hacks headers" >&5 +echo "configure:9753: checking for setuid hacks headers" >&5 d=$setuid_hacks/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -9367,7 +9748,7 @@ echo "configure:9372: checking for setuid hacks headers" >&5 fi echo $ac_n "checking for setuid hacks libs""... $ac_c" 1>&6 -echo "configure:9382: checking for setuid hacks libs" >&5 +echo "configure:9763: checking for setuid hacks libs" >&5 d=$setuid_hacks/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -9497,6 +9878,17 @@ else fi +# Now that we know whether we have Gnome, we can decide where the XML +# config files get installed. +if test -z "$HACK_CONF_DIR" ; then + if test -n "$GNOME_DATADIR" ; then + HACK_CONF_DIR='${GNOME_DATADIR}/control-center/screensavers' + else + HACK_CONF_DIR='${prefix}/lib/xscreensaver/config' + fi +fi + + ############################################################################### # # Perform substitutions and write Makefiles. @@ -9541,6 +9933,8 @@ fi + + @@ -9710,16 +10104,14 @@ s%@glib_config@%$glib_config%g s%@gtk_config@%$gtk_config%g s%@gnome_config@%$gnome_config%g s%@have_gnome_help@%$have_gnome_help%g -s%@zip2@%$zip2%g -s%@emacs_exe@%$emacs_exe%g -s%@xemacs_exe@%$xemacs_exe%g -s%@fortune@%$fortune%g +s%@fortune_tmp@%$fortune_tmp%g s%@INCLUDES@%$INCLUDES%g s%@PREFERRED_DEMO_PROGRAM@%$PREFERRED_DEMO_PROGRAM%g s%@ALL_DEMO_PROGRAMS@%$ALL_DEMO_PROGRAMS%g s%@SAVER_LIBS@%$SAVER_LIBS%g s%@MOTIF_LIBS@%$MOTIF_LIBS%g s%@GTK_LIBS@%$GTK_LIBS%g +s%@XML_LIBS@%$XML_LIBS%g s%@HACK_LIBS@%$HACK_LIBS%g s%@XPM_LIBS@%$XPM_LIBS%g s%@GL_LIBS@%$GL_LIBS%g @@ -9752,6 +10144,7 @@ s%@GNOMEHELP_Y@%$GNOMEHELP_Y%g s%@GNOMEHELP_N@%$GNOMEHELP_N%g s%@HACKDIR@%$HACKDIR%g s%@GNOME_DATADIR@%$GNOME_DATADIR%g +s%@HACK_CONF_DIR@%$HACK_CONF_DIR%g s%@APPDEFAULTS@%$APPDEFAULTS%g s%@DEPEND@%$DEPEND%g s%@DEPEND_FLAGS@%$DEPEND_FLAGS%g @@ -10065,6 +10458,10 @@ if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then warn 'The DPMS extension was requested, but was not found.' fi +if test "$with_xinerama_req" = yes -a "$have_xinerama" = no ; then + warn 'The Xinerama extension was requested, but was not found.' +fi + if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then warn 'The XF86VMODE extension was requested, but was not found.' fi @@ -10109,6 +10506,13 @@ if test "$with_gnome_req" = yes -a "$have_gnome" = no ; then warn2 'headers and/or libraries were not found.' fi +if test "$with_xml_req" = yes -a "$have_xml" = no ; then + warn 'Use of the XML library was requested, but the necessary' + warn2 'headers and/or libraries were not found.' +elif test "$have_gtk" = yes -a "$have_xml" = no ; then + warn 'GTK is being used, but the XML library was not found.' + warn2 'Some functionality will be disabled.' +fi if test "$have_motif" = yes -a "$have_lesstif" = yes ; then @@ -10233,9 +10637,9 @@ if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then warn 'Use of XReadDisplay was requested, but it was not found.' fi -if test -n "$with_zippy_req"; then - if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then - warnL "$with_zippy_req was requested as the Zippy program," +if test -n "$with_fortune_req"; then + if test "$with_fortune_req" != "$ac_cv_fortune_program" ; then + warnL "$with_fortune_req was requested as the Fortune program," warn2 "but was not found. The default will be used instead." fi fi @@ -10268,17 +10672,24 @@ eval HACKDIR=${HACKDIR} eval HACKDIR=${HACKDIR} eval HACKDIR=${HACKDIR} eval HACKDIR=${HACKDIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} # canonicalize slashes. -bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` -HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` +HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` -# Sanity check the subdir +# Sanity check the hackdir for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then echo "" - { echo "configure: error: \"--enable-subdir=${bindir}/${bad_choice}\" won't work. + { echo "configure: error: \"--with-hackdir=${bindir}/${bad_choice}\" won't work. There will be an executable installed with that name, so that can't be the name of a directory as well. Please re-configure with a different directory name." 1>&2; exit 1; } @@ -10322,19 +10733,6 @@ if test \! -z "$rpmv" ; then fi -# Warn about egregious GNOME bogosity. -# -#if (rpm -qv control-center) >&- 2>&- ; then -# warning=no -# warnL "The Gnome Control Center seems to be installed." -# echo "" -# warn2 "Note that simply installing this version of xscreensaver" -# warn2 "will not cause GNOME to know about the newly-added display" -# warn2 "modes -- GNOME is just lame that way. Instead of using the" -# warn2 "Control Center, try using the \`xscreensaver-demo' command." -#fi - - if test "${bindir}" = "${HACKDIR}" ; then do_dir_warning=yes fi @@ -10352,7 +10750,7 @@ if test "$do_dir_warning" = yes; then echo "" echo " If you would prefer the demos to be installed elsewhere" echo " (for example, in a dedicated directory) you should re-run" - echo " configure with the --enable-subdir=DIR option. For more" + echo " configure with the --with-hackdir=DIR option. For more" echo " information, run $0 --help." warning=yes fi @@ -10360,3 +10758,13 @@ fi if test "$warning" != no; then echo '' ; echo "$warnsep" ; echo '' fi + +if test "$do_dir_warning" = no; then + if test "$warning" = no; then + echo '' + fi + echo "User programs will be installed in ${bindir}/" + echo "Screen savers will be installed in ${HACKDIR}/" + echo "Configuration will be installed in ${HACK_CONF_DIR}/" + echo '' +fi diff --git a/configure.in b/configure.in index 361fac21..68a89a58 100644 --- a/configure.in +++ b/configure.in @@ -861,43 +861,91 @@ fi ############################################################################### # -# Handle the --enable-subdir option +# Handle the --with-hackdir option # ############################################################################### -AC_ARG_ENABLE(subdir,[ +have_hackdir=yes +with_hackdir_req=unspecified +AC_ARG_WITH(hackdir,[ Installation options: - --enable-subdir=DIR Put the demo programs in a subdirectory of \`bindir', - instead of putting them in bindir itself. You can - specify the name of the subdirectory. For example, - \`--exec-prefix=/usr/local --enable-subdir=demos' - would put xscreensaver in /usr/local/bin/, and would - put the demos in /usr/local/bin/demos/. (If DIR - begins with /, then bindir will not be prepended.) - - --disable-subdir Just put the demos in \`bindir' (this is the default.) + --with-hackdir=DIR Where to install the hundreds of demo executables. + Default: \`PREFIX/lib/xscreensaver/' ], - [enable_subdir="$enableval"],[enable_subdir=no]) -if test x"$enable_subdir" = xno; then + [with_hackdir="$withval"; with_hackdir_req="$withval"],[with_hackdir=yes]) + +if test x"$with_hackdir" = xyes; then + HACKDIR='${exec_prefix}/lib/xscreensaver' +elif test x"$with_hackdir" = xno; then HACKDIR='${bindir}' -elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then - echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir" - exit 1 else # there must be a better way than this... - if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then + if test -z "`echo $with_hackdir | sed 's@^/.*@@'`" ; then # absolute path - HACKDIR=$enable_subdir + HACKDIR=$with_hackdir else # relative path - HACKDIR='${bindir}/'$enable_subdir + HACKDIR="\${exec_prefix}$with_hackdir" fi fi # canonicalize slashes. HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +# This option used to be called --enable-subdir; make sure that is no longer +# used, since configure brain-damagedly ignores unknown --enable options. + +obsolete_enable= +AC_ARG_ENABLE(subdir,,[obsolete_enable=yes]) +if test -n "$obsolete_enable"; then + echo "error: the --enable-subdir option has been replaced with" + echo " the new --with-hackdir option; see \`configure --help'" + echo " for more information." + exit 1 +fi + + +############################################################################### +# +# Handle the --with-configdir option +# +############################################################################### + +have_configdir=yes +with_configdir_req=unspecified +AC_ARG_WITH(configdir, +[ --with-configdir=DIR Where to install the data files that describe each + of the display modes to the GUI. + Default: \`GNOMEPREFIX/control-center/screensavers/' + or \`PREFIX/lib/xscreensaver/config/', depending on + whether GNOME is available. +], + [with_configdir="$withval"; with_configdir_req="$withval"], + [with_configdir=yes]) + +if test x"$with_configdir" = xyes; then + # filled in later... + HACK_CONF_DIR='' +elif test x"$with_configdir" = xno; then + echo "error: must be yes, or a pathname: --with-configdir=$with_configdir" + exit 1 +else + # there must be a better way than this... + if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then + # absolute path + CONFIGDIR=$with_configdir + else + # relative path + CONFIGDIR="\${exec_prefix}$with_configdir" + fi +fi + +# canonicalize slashes. +CONFIGDIR=`echo "${CONFIGDIR}" | sed 's@/$@@;s@//*@/@g'` + + + ############################################################################### # @@ -1098,6 +1146,52 @@ elif test "$with_dpms" != no; then fi +############################################################################### +# +# Check for the XINERAMA server extension. +# +############################################################################### + +have_xinerama=no +with_xinerama_req=unspecified +AC_ARG_WITH(xinerama-ext, +[ --with-xinerama-ext Include support for the XINERAMA extension.], + [with_xinerama="$withval"; with_xinerama_req="$withval"],[with_xinerama=yes]) + +HANDLE_X_PATH_ARG(with_xinerama, --with-xinerama-ext, XINERAMA) + +if test "$with_xinerama" = yes; then + + # first check for Xinerama.h + AC_CHECK_X_HEADER(X11/extensions/Xinerama.h, [have_xinerama=yes]) + + # if that succeeded, then check for the XINERAMA code in the libraries + if test "$have_xinerama" = yes; then + + # first look in -lXext + have_xinerama=no + AC_CHECK_X_LIB(Xext, XineramaQueryExtension, [have_xinerama=yes], [true], + -lXext -lX11) + + # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.) + if test "$have_xinerama" = no; then + AC_CHECK_X_LIB(Xinerama, XineramaQueryExtension, + [have_xinerama=yes; SAVER_LIBS="$SAVER_LIBS -lXinerama"], + [true], -lXext -lX11) + fi + fi + + # if that succeeded, then we've really got it. + if test "$have_xinerama" = yes; then + AC_DEFINE(HAVE_XINERAMA) + fi + +elif test "$with_xinerama" != no; then + echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama" + exit 1 +fi + + ############################################################################### # # Check for the XF86VMODE server extension (for virtual screens.) @@ -1810,7 +1904,7 @@ if test "$with_gtk" = yes; then # Check for Gnome Capplet support. # if test "$have_gnome" = yes -a "$have_gtk" = yes; then - gnome_config_libs="gtk capplet gnomeui" + gnome_config_libs="gtk capplet gnomeui xml" AC_MSG_CHECKING(for Gnome capplet includes) AC_CACHE_VAL(ac_cv_gnome_config_cflags, [if ( $gnome_config --cflags $gnome_config_libs 2>&1 >/dev/null | \ @@ -1880,6 +1974,57 @@ else fi +############################################################################### +# +# Check for -lxml (if we have Gtk) +# +############################################################################### + +have_xml=no +with_xml_req=unspecified +AC_ARG_WITH(xml, +[ --with-xml The XML toolkit is needed for some parts of + the Gtk interface.], +[with_xml="$withval"; with_xml_req="$withval"],[with_xml=yes]) + +HANDLE_X_PATH_ARG(with_xml, --with-xml, XML) + +if test "$with_xml" != yes -a "$with_xml" != no ; then + echo "error: must be yes or no: --with-xml=$with_xml" + exit 1 +fi + +if test "$have_gtk" != yes; then + # don't bother if no GTK + with_xml=no +fi + +if test "$with_xml" = yes; then + have_xml=no + + # the XML stuff is likely to be in GTK paths. + ac_save_X_CFLAGS="$X_CFLAGS" + ac_save_X_LIBS="$X_LIBS" + X_CFLAGS="$X_CFLAGS $ac_gtk_config_cflags" + X_LIBS="$X_LIBS $ac_gtk_config_libs" + + AC_CHECK_X_HEADER(xmlIO.h, [have_xml=yes]) + + if test "$have_xml" = yes; then + # we have the header, now check for the library + have_xml=no + AC_CHECK_X_LIB(xml, xmlParseChunk, + [have_xml=yes + XML_LIBS="-lxml" + AC_DEFINE(HAVE_XML)]) + fi + + X_CFLAGS="$ac_save_X_CFLAGS" + X_LIBS="$ac_save_X_LIBS" + +fi + + ############################################################################### # # Checking whether Motif is really Lesstif. @@ -2416,157 +2561,93 @@ fi # Check for a program to generate random text. # # Zippy is funnier than the idiocy generally spat out by `fortune', -# so try to find that, by invoking Emacs and asking it where its -# libexec directory is ("yow" lives in there.) +# so first see if "fortune zippy" works. Else, use plain "fortune". # -# If that doesn't work, see if fortune, zippy, or yow are on $PATH, -# and if so, use them. -# -# If that doesn't work, look in /usr/games, and if it's there, use -# the full pathname. +# We used to dig around in Emacs to look for the "yow" program, but +# most people who have Emacs also have "fortune zippy", so nevermind. # ############################################################################### -with_zippy_req="" -AC_ARG_WITH(zippy,[ - --with-zippy=PROGRAM Some demos are able to run an external program and +with_fortune_req="" +AC_ARG_WITH(fortune,[ + --with-fortune=PROGRAM Some demos are able to run an external program and display its text; this names the program to use by default (though it can be overridden with X - resources.) If you don't specify this, the default - is to use \"yow\" from the Emacs distribution (if you - have it) or else to use \"fortune\".], - [with_zippy_req="$withval"; with_zippy="$withval"],[with_zippy=yes]) + resources.) Default is \"/usr/games/fortune\".], + [with_fortune_req="$withval"; with_fortune="$withval"],[with_fortune=yes]) -if test "$with_zippy" = no || test "$with_zippy" = yes ; then - with_zippy="" - with_zippy_req="" +if test "$with_fortune" = no || test "$with_fortune" = yes ; then + with_fortune="" + with_fortune_req="" fi -if test -n "$with_zippy_req" ; then - ac_cv_zippy_program="" - case "$with_zippy_req" in +if test -n "$with_fortune_req" ; then + ac_cv_fortune_program="" + case "$with_fortune_req" in /*) - AC_MSG_CHECKING([for $with_zippy_req]) - if test -x "$with_zippy_req" ; then + + set dummy $with_fortune_req ; fortune_tmp=$2 + AC_MSG_CHECKING([for $fortune_tmp]) + if test -x "$fortune_tmp" ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) - with_zippy="" + with_fortune="" fi ;; *) + set dummy $with_fortune_req ; fortune_tmp=$2 # don't cache - unset ac_cv_path_zip2 - AC_PATH_PROG(zip2, $with_zippy_req, []) - if test "$zip2" = ""; then - with_zippy="" + unset ac_cv_path_fortune_tmp + AC_PATH_PROG(fortune_tmp, $fortune_tmp, []) + if test -z "$fortune_tmp" ; then + with_fortune="" fi ;; esac - ac_cv_zippy_program="$with_zippy" + ac_cv_fortune_program="$with_fortune" -elif test -n "$ac_cv_zippy_program"; then - AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program]) +elif test -n "$ac_cv_fortune_program"; then + AC_MSG_RESULT([checking for fortune... (cached) $ac_cv_fortune_program]) fi -if test ! -n "$ac_cv_zippy_program"; then +unset ac_cv_path_fortune_tmp +unset fortune_tmp - AC_CHECK_PROGS(emacs_exe, emacs) - AC_CHECK_PROGS(xemacs_exe, xemacs) +if test -z "$ac_cv_fortune_program" ; then - ac_cv_zippy_program="" - eargs='-batch -q -nw --eval' + # first look for fortune in /usr/games/ (and use absolute path) + AC_PATH_PROGS(fortune_tmp, fortune,, "/usr/games") - if test -n "$emacs_exe" ; then - AC_MSG_CHECKING([for emacs yow]) - # - # get emacs to tell us where the libexec directory is. - # - dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \ - 2>/dev/null | tail -1` - dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'` - # - # try running libexec/yow and see if it exits without error. - # - if test x"$dir" != x -a -x "$dir/yow" ; then - if $dir/yow >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow" - AC_MSG_RESULT($ac_cv_zippy_program) - else - AC_MSG_RESULT(no) - fi - fi + # if it's not there, look on $PATH (and don't use absolute path) + if test -z "$fortune_tmp" ; then + AC_CHECK_PROGS(fortune_tmp, fortune) fi - if test -z "$ac_cv_zippy_program" ; then - AC_MSG_CHECKING([for xemacs yow]) - if test -n "$xemacs_exe" ; then - # - # get xemacs to tell us where the libexec directory is. - # - dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \ - 2>/dev/null | tail -1` - dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'` - # - # try running libexec/yow and see if it exits without error. - # - if test x"$dir" != x -a -x "$dir/yow" ; then - if $dir/yow >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow" - AC_MSG_RESULT($ac_cv_zippy_program) - else - # - # in some xemacs installations, the pathname of the yow.lines file - # isn't hardcoded into the yow executable, and must be passed on - # the command line. See if it's in libexec/../etc/. - - # M4 sucks!! - changequote(X,Y) - dir_up=`echo "$dir" | sed 's@/[^/]*$@@'` - changequote([,]) - - yowlines="$dir_up/etc/yow.lines" - if $dir/yow -f $yowlines >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow -f $yowlines" - AC_MSG_RESULT($ac_cv_zippy_program) - else - # - # In newer XEmacs releases, yow.lines is in a different place, - # and the easiest way to get it is by calling the new function - # `locate-data-file'. - # - yowlines=`$xemacs_exe $eargs \ - '(princ (concat (locate-data-file "yow.lines") "\n"))' \ - 2>/dev/null | tail -1` - if $dir/yow -f $yowlines >&- 2>&- ; then - ac_cv_zippy_program="$dir/yow -f $yowlines" - AC_MSG_RESULT($ac_cv_zippy_program) - else - AC_MSG_RESULT(no) - fi - fi - fi - fi - fi + # if we didn't find anything, then just assume /usr/games/ + if test -z "$fortune_tmp" ; then + fortune_tmp="/usr/games/fortune" fi - # if that didn't work, try for some other programs... - if test -z "$ac_cv_zippy_program" ; then - fortune='' - AC_CHECK_PROGS(fortune, [fortune zippy yow]) - # if that didn't work, try for those programs in /usr/games... - if test -z "$fortune" ; then - AC_PATH_PROGS(fortune, [fortune zippy yow], fortune, - /usr/games:/usr/local/games:$PATH) - fi + ac_cv_fortune_program="$fortune_tmp" + + # now check to see whether "fortune zippy" works. + # + fortune_tmp="$fortune_tmp zippy" + AC_MSG_CHECKING([for zippy quotes]) + if ( $fortune_tmp >/dev/null 2>&1 ); then + ac_cv_fortune_program="$fortune_tmp" + AC_MSG_RESULT($fortune_tmp) + else + AC_MSG_RESULT(no) fi -fi -if test -z "$ac_cv_zippy_program" ; then - ac_cv_zippy_program=fortune fi -AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program") +unset ac_cv_path_fortune_tmp +unset fortune_tmp + +AC_DEFINE_UNQUOTED(FORTUNE_PROGRAM, "$ac_cv_fortune_program") ############################################################################### @@ -2692,6 +2773,17 @@ else fi +# Now that we know whether we have Gnome, we can decide where the XML +# config files get installed. +if test -z "$HACK_CONF_DIR" ; then + if test -n "$GNOME_DATADIR" ; then + HACK_CONF_DIR='${GNOME_DATADIR}/control-center/screensavers' + else + HACK_CONF_DIR='${prefix}/lib/xscreensaver/config' + fi +fi + + ############################################################################### # # Perform substitutions and write Makefiles. @@ -2705,6 +2797,7 @@ AC_SUBST(ALL_DEMO_PROGRAMS) AC_SUBST(SAVER_LIBS) AC_SUBST(MOTIF_LIBS) AC_SUBST(GTK_LIBS) +AC_SUBST(XML_LIBS) AC_SUBST(HACK_LIBS) AC_SUBST(XPM_LIBS) AC_SUBST(GL_LIBS) @@ -2738,6 +2831,7 @@ AC_SUBST(GNOMEHELP_Y) AC_SUBST(GNOMEHELP_N) AC_SUBST(HACKDIR) AC_SUBST(GNOME_DATADIR) +AC_SUBST(HACK_CONF_DIR) APPDEFAULTS=$ac_x_app_defaults AC_SUBST(APPDEFAULTS) @@ -2838,6 +2932,10 @@ if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then warn 'The DPMS extension was requested, but was not found.' fi +if test "$with_xinerama_req" = yes -a "$have_xinerama" = no ; then + warn 'The Xinerama extension was requested, but was not found.' +fi + if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then warn 'The XF86VMODE extension was requested, but was not found.' fi @@ -2882,6 +2980,13 @@ if test "$with_gnome_req" = yes -a "$have_gnome" = no ; then warn2 'headers and/or libraries were not found.' fi +if test "$with_xml_req" = yes -a "$have_xml" = no ; then + warn 'Use of the XML library was requested, but the necessary' + warn2 'headers and/or libraries were not found.' +elif test "$have_gtk" = yes -a "$have_xml" = no ; then + warn 'GTK is being used, but the XML library was not found.' + warn2 'Some functionality will be disabled.' +fi if test "$have_motif" = yes -a "$have_lesstif" = yes ; then @@ -3006,9 +3111,9 @@ if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then warn 'Use of XReadDisplay was requested, but it was not found.' fi -if test -n "$with_zippy_req"; then - if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then - warnL "$with_zippy_req was requested as the Zippy program," +if test -n "$with_fortune_req"; then + if test "$with_fortune_req" != "$ac_cv_fortune_program" ; then + warnL "$with_fortune_req was requested as the Fortune program," warn2 "but was not found. The default will be used instead." fi fi @@ -3041,17 +3146,24 @@ eval HACKDIR=${HACKDIR} eval HACKDIR=${HACKDIR} eval HACKDIR=${HACKDIR} eval HACKDIR=${HACKDIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} +eval HACK_CONF_DIR=${HACK_CONF_DIR} # canonicalize slashes. -bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` -HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` +HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` -# Sanity check the subdir +# Sanity check the hackdir for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then echo "" - AC_MSG_ERROR([\"--enable-subdir=${bindir}/${bad_choice}\" won't work. + AC_MSG_ERROR([\"--with-hackdir=${bindir}/${bad_choice}\" won't work. There will be an executable installed with that name, so that can't be the name of a directory as well. Please re-configure with a different directory name.]) @@ -3095,19 +3207,6 @@ if test \! -z "$rpmv" ; then fi -# Warn about egregious GNOME bogosity. -# -#if (rpm -qv control-center) >&- 2>&- ; then -# warning=no -# warnL "The Gnome Control Center seems to be installed." -# echo "" -# warn2 "Note that simply installing this version of xscreensaver" -# warn2 "will not cause GNOME to know about the newly-added display" -# warn2 "modes -- GNOME is just lame that way. Instead of using the" -# warn2 "Control Center, try using the \`xscreensaver-demo' command." -#fi - - if test "${bindir}" = "${HACKDIR}" ; then do_dir_warning=yes fi @@ -3125,7 +3224,7 @@ if test "$do_dir_warning" = yes; then echo "" echo " If you would prefer the demos to be installed elsewhere" echo " (for example, in a dedicated directory) you should re-run" - echo " configure with the --enable-subdir=DIR option. For more" + echo " configure with the --with-hackdir=DIR option. For more" echo " information, run $0 --help." warning=yes fi @@ -3133,3 +3232,13 @@ fi if test "$warning" != no; then echo '' ; echo "$warnsep" ; echo '' fi + +if test "$do_dir_warning" = no; then + if test "$warning" = no; then + echo '' + fi + echo "User programs will be installed in ${bindir}/" + echo "Screen savers will be installed in ${HACKDIR}/" + echo "Configuration will be installed in ${HACK_CONF_DIR}/" + echo '' +fi diff --git a/driver/Makefile.in b/driver/Makefile.in index 47958866..6df5137c 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -21,12 +21,16 @@ GNOME_CCDIR = $(GNOME_DATADIR)/control-center/Desktop GNOME_PANELDIR = $(GNOME_DATADIR)/gnome/apps/Settings/Desktop GNOME_ICONDIR = $(GNOME_DATADIR)/pixmaps GNOME_BINDIR = $(bindir) +HACK_CONF_DIR = @HACK_CONF_DIR@ CC = @CC@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ DEFS = @DEFS@ -DEFS2 = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' +SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' +GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GNOME_ICONDIR)"' +CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' + LIBS = @LIBS@ PERL = @PERL@ @@ -76,8 +80,10 @@ INCLUDES = -I. -I$(srcdir) -I$(UTILS_SRC) -I.. @INCLUDES@ MOTIF_SRCS = demo-Xm.c demo-Xm-widgets.c MOTIF_OBJS = demo-Xm.o demo-Xm-widgets.o -GTK_SRCS = demo-Gtk.c demo-Gtk-widgets.c -GTK_OBJS = demo-Gtk.o demo-Gtk-widgets.o +GTK_SRCS = demo-Gtk.c demo-Gtk-conf.c \ + demo-Gtk-widgets.c demo-Gtk-support.c +GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o \ + demo-Gtk-widgets.o demo-Gtk-support.o PWENT_SRCS = passwd-pwent.c PWENT_OBJS = passwd-pwent.o @@ -100,6 +106,7 @@ TEST_EXES = test-passwd test-uid test-xdpms test-grab \ MOTIF_LIBS = @MOTIF_LIBS@ @XPM_LIBS@ $(XMU_LIBS) GTK_LIBS = @GTK_LIBS@ $(XMU_LIBS) +XML_LIBS = @XML_LIBS@ XDPMS_LIBS = @XDPMS_LIBS@ @@ -117,7 +124,10 @@ GL_SRCS = @SAVER_GL_SRCS@ GL_OBJS = @SAVER_GL_OBJS@ GL_LIBS = @SAVER_GL_LIBS@ -LOGO = $(UTILS_SRC)/logo-50.xpm +ICON_SRC = $(UTILS_SRC)/images +LOGO = $(ICON_SRC)/logo-50.xpm +GNOME_ICONS = $(ICON_SRC)/screensaver-*.xpm + DEMO_UTIL_SRCS = $(UTILS_SRC)/resources.c $(UTILS_SRC)/usleep.c \ $(UTILS_SRC)/visual.c DEMO_UTIL_OBJS = $(UTILS_BIN)/resources.o $(UTILS_BIN)/usleep.o \ @@ -183,7 +193,8 @@ EXES2 = @ALL_DEMO_PROGRAMS@ SCRIPTS = xscreensaver-getimage-file xscreensaver-getimage-video HDRS = XScreenSaver_ad.h xscreensaver.h prefs.h remote.h \ - demo-Gtk-widgets.h demo-Gtk-stubs.h + demo-Gtk-widgets.h demo-Gtk-stubs.h demo-Gtk-support.h \ + demo-Gtk-conf.h MEN = xscreensaver.man xscreensaver-demo.man \ xscreensaver-command.man \ xscreensaver-getimage.man \ @@ -307,6 +318,7 @@ install-scripts: $(SCRIPTS) munge-scripts munge-scripts: $(SCRIPTS) @tmp=/tmp/mf.$$$$ ; \ perl="${PERL}" ; \ + rm -f $$tmp ; \ for program in $(SCRIPTS); do \ echo "adjusting location of perl in $$program..." ; \ sed "s@^\(#!\)\(/[^ ]*/perl[^ ]*\)\(.*\)\$$@\1$$perl\3@" \ @@ -316,7 +328,8 @@ munge-scripts: $(SCRIPTS) else \ cat $$tmp > ./$$program ; \ fi ; \ - done + done ; \ + rm -f $$tmp install-man: $(MEN) @men="$(MEN)" ; \ @@ -494,6 +507,7 @@ install-gnome:: screensaver-properties-capplet fi ; \ fi +# xscreensaver.xpm install-gnome:: $(LOGO) @if [ "$(GNOME_DATADIR)" != "" ]; then \ if [ ! -d "$(install_prefix)$(GNOME_ICONDIR)" ]; then \ @@ -507,6 +521,23 @@ install-gnome:: $(LOGO) $(install_prefix)$(GNOME_ICONDIR)/$$target ;\ fi +# ../utils/images/screensaver-*.xpm +install-gnome:: + @if [ "$(GNOME_DATADIR)" != "" ]; then \ + if [ ! -d "$(install_prefix)$(GNOME_ICONDIR)" ]; then \ + echo $(INSTALL_DIRS) "$(install_prefix)$(GNOME_ICONDIR)" ;\ + $(INSTALL_DIRS) "$(install_prefix)$(GNOME_ICONDIR)" ;\ + fi ;\ + for target in $(GNOME_ICONS) ; do \ + dest=`echo $$target | sed 's@^.*/@@'` ;\ + echo $(INSTALL_DATA) $$target \ + $(install_prefix)$(GNOME_ICONDIR)/$$dest ;\ + $(INSTALL_DATA) $$target \ + $(install_prefix)$(GNOME_ICONDIR)/$$dest ;\ + done ;\ + fi + +# screensaver-properties.desktop uninstall-gnome:: @if [ "$(GNOME_DATADIR)" != "" ]; then \ f=screensaver-properties.desktop ;\ @@ -516,6 +547,7 @@ uninstall-gnome:: rm -f $(install_prefix)$(GNOME_PANELDIR)/$$f ;\ fi +# screensaver-properties-capplet uninstall-gnome:: @if [ "$(GNOME_DATADIR)" != "" ]; then \ program=screensaver-properties-capplet ;\ @@ -523,6 +555,7 @@ uninstall-gnome:: rm -f $(install_prefix)$(bindir)/$$program ;\ fi +# xscreensaver.xpm uninstall-gnome:: @if [ "$(GNOME_DATADIR)" != "" ]; then \ target=xscreensaver.xpm ;\ @@ -530,6 +563,16 @@ uninstall-gnome:: rm -f $(install_prefix)$(GNOME_ICONDIR)/$$target ;\ fi +# xscreensaver.xpm +uninstall-gnome:: + @if [ "$(GNOME_DATADIR)" != "" ]; then \ + for target in $(GNOME_ICONS) ; do \ + dest=`echo $$target | sed 's@^.*/@@'` ;\ + echo rm -f $(install_prefix)$(GNOME_ICONDIR)/$$dest ;\ + rm -f $(install_prefix)$(GNOME_ICONDIR)/$$dest ;\ + done ;\ + fi + install-kde: @src="$(srcdir)/xscreensaver.kss" ; \ if [ "$$KDEDIR" != "" ]; then \ @@ -605,22 +648,25 @@ distdepend: update_ad_version update_man_version XScreenSaver_ad.h # Updates the version number in the app-defaults file to be in sync with # the version number in version.h. This is so people can tell when they # have a version skew between the app-defaults file and the executable. +# Also update hacks/config/README in the same way. update_ad_version:: - @S=XScreenSaver.ad.in ; \ + @files="XScreenSaver.ad.in ../hacks/config/README" ; \ U=$(UTILS_SRC)/version.h ; \ V=`sed -n 's/.*\([0-9][0-9]*\.[0-9]*\).*/\1/p' < $$U` ; \ D=`date '+%d-%b-%Y'` ; \ - echo -n "Updating version number in $$S to $$V $$D... " ; \ - T=/tmp/xs.$$$$ ; \ - sed -e "s/\(.*version \)[0-9][0-9]*\.[0-9]*\(.*\)/\1$$V\2/" \ - -e "s/\([0-9][0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9]*\)/$$D/" \ - < $$S > $$T ; \ - if cmp -s $$S $$T ; then \ - echo "unchanged." ; \ - else \ - cat $$T > $$S ; \ - echo "done." ; \ - fi ; \ + for S in $$files ; do \ + echo -n "Updating version number in $$S to $$V $$D... " ; \ + T=/tmp/xs.$$$$ ; \ + sed -e "s/\(.*version \)[0-9][0-9]*\.[0-9]*\(.*\)/\1$$V\2/" \ + -e "s/\([0-9][0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9]*\)/$$D/" \ + < $$S > $$T ; \ + if cmp -s $$S $$T ; then \ + echo "unchanged." ; \ + else \ + cat $$T > $$S ; \ + echo "done." ; \ + fi ; \ + done ; \ rm $$T update_man_version:: @@ -672,11 +718,22 @@ $(SAVER_UTIL_OBJS): .c.o: $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $< -# subprocs is the only one that takes an extra -D option. +# subprocs takes an extra -D option. subprocs.o: subprocs.c - $(CC) -c $(INCLUDES) $(DEFS2) $(CFLAGS) $(X_CFLAGS) \ + $(CC) -c $(INCLUDES) $(SUBP_DEFS) $(CFLAGS) $(X_CFLAGS) \ $(srcdir)/subprocs.c +# demo-Gtk takes an extra -D option, and an extra -I option. +demo-Gtk.o: demo-Gtk.c + $(CC) -c $(INCLUDES) $(SUBP_DEFS) -I$(ICON_SRC) $(GTK_DEFS) \ + $(CFLAGS) $(X_CFLAGS) \ + $(srcdir)/demo-Gtk.c + +# demo-Gtk-conf takes an extra -D option. +demo-Gtk-conf.o: demo-Gtk-conf.c + $(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CFLAGS) $(X_CFLAGS) \ + $(srcdir)/demo-Gtk-conf.c + # How we build the default app-defaults file into the program. # @@ -708,7 +765,7 @@ xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS) xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS) $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(LIBS) $(X_LIBS) \ - $(GTK_LIBS) $(X_PRE_LIBS) -lXt -lX11 $(XDPMS_LIBS) -lXext \ + $(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 $(XDPMS_LIBS) -lXext \ $(X_EXTRA_LIBS) xscreensaver-getimage: $(GETIMG_OBJS) @@ -737,7 +794,7 @@ test-apm: test-apm.o $(CC) $(LDFLAGS) -o $@ test-apm.o $(SAVER_LIBS) -lapm TEST_FADE_OBJS = test-fade.o $(UTILS_SRC)/fade.o $(DEMO_UTIL_OBJS) -test-fade: test-fade.o +test-fade: test-fade.o $(UTILS_BIN)/fade.o $(CC) $(LDFLAGS) -o $@ $(TEST_FADE_OBJS) $(SAVER_LIBS) @@ -759,81 +816,58 @@ xdpyinfo: xdpyinfo.o xscreensaver.o: ../config.h xscreensaver.o: $(srcdir)/xscreensaver.h xscreensaver.o: $(srcdir)/prefs.h -xscreensaver.o: $(UTILS_SRC)/version.h -xscreensaver.o: $(UTILS_SRC)/yarandom.h -xscreensaver.o: $(UTILS_SRC)/resources.h -xscreensaver.o: $(UTILS_SRC)/visual.h -xscreensaver.o: $(UTILS_SRC)/usleep.h xscreensaver.o: XScreenSaver_ad.h windows.o: ../config.h windows.o: $(srcdir)/xscreensaver.h windows.o: $(srcdir)/prefs.h -windows.o: $(UTILS_SRC)/visual.h -windows.o: $(UTILS_SRC)/fade.h timers.o: ../config.h timers.o: $(srcdir)/xscreensaver.h timers.o: $(srcdir)/prefs.h subprocs.o: ../config.h subprocs.o: $(srcdir)/xscreensaver.h subprocs.o: $(srcdir)/prefs.h -subprocs.o: $(UTILS_SRC)/yarandom.h -subprocs.o: $(UTILS_SRC)/visual.h xset.o: ../config.h xset.o: $(srcdir)/xscreensaver.h xset.o: $(srcdir)/prefs.h splash.o: ../config.h splash.o: $(srcdir)/xscreensaver.h splash.o: $(srcdir)/prefs.h -splash.o: $(UTILS_SRC)/resources.h setuid.o: ../config.h setuid.o: $(srcdir)/xscreensaver.h setuid.o: $(srcdir)/prefs.h stderr.o: ../config.h stderr.o: $(srcdir)/xscreensaver.h stderr.o: $(srcdir)/prefs.h -stderr.o: $(UTILS_SRC)/resources.h -stderr.o: $(UTILS_SRC)/visual.h demo-Xm.o: ../config.h -demo-Xm.o: $(UTILS_SRC)/version.h demo-Xm.o: $(srcdir)/prefs.h -demo-Xm.o: $(UTILS_SRC)/resources.h -demo-Xm.o: $(UTILS_SRC)/visual.h demo-Xm.o: $(srcdir)/remote.h -demo-Xm.o: $(UTILS_SRC)/usleep.h demo-Xm.o: XScreenSaver_ad.h demo-Xm-widgets.o: ../config.h demo-Gtk.o: ../config.h -demo-Gtk.o: $(UTILS_SRC)/version.h demo-Gtk.o: $(srcdir)/prefs.h -demo-Gtk.o: $(UTILS_SRC)/resources.h -demo-Gtk.o: $(UTILS_SRC)/visual.h demo-Gtk.o: $(srcdir)/remote.h -demo-Gtk.o: $(UTILS_SRC)/usleep.h -demo-Gtk.o: $(UTILS_SRC)/logo-50.xpm -demo-Gtk.o: $(UTILS_SRC)/logo-180.xpm demo-Gtk.o: $(srcdir)/demo-Gtk-widgets.h +demo-Gtk.o: $(srcdir)/demo-Gtk-support.h +demo-Gtk.o: $(srcdir)/demo-Gtk-conf.h demo-Gtk.o: XScreenSaver_ad.h +demo-Gtk-conf.o: ../config.h +demo-Gtk-conf.o: $(srcdir)/demo-Gtk-conf.h demo-Gtk-widgets.o: ../config.h demo-Gtk-widgets.o: $(srcdir)/demo-Gtk-stubs.h demo-Gtk-widgets.o: $(srcdir)/demo-Gtk-widgets.h -xscreensaver-getimage.o: $(UTILS_SRC)/utils.h +demo-Gtk-widgets.o: $(srcdir)/demo-Gtk-support.h +demo-Gtk-support.o: ../config.h +demo-Gtk-support.o: $(srcdir)/demo-Gtk-support.h xscreensaver-getimage.o: ../config.h -xscreensaver-getimage.o: $(UTILS_SRC)/yarandom.h -xscreensaver-getimage.o: $(UTILS_SRC)/grabscreen.h -xscreensaver-getimage.o: $(UTILS_SRC)/resources.h -xscreensaver-getimage.o: $(UTILS_SRC)/colorbars.h xscreensaver-getimage.o: $(srcdir)/prefs.h -xscreensaver-getimage.o: $(UTILS_SRC)/vroot.h xscreensaver-getimage.o: XScreenSaver_ad.h passwd-pwent.o: ../config.h lock.o: ../config.h lock.o: $(srcdir)/xscreensaver.h lock.o: $(srcdir)/prefs.h -lock.o: $(UTILS_SRC)/resources.h passwd.o: ../config.h prefs.o: ../config.h prefs.o: $(srcdir)/prefs.h -prefs.o: $(UTILS_SRC)/resources.h dpms.o: ../config.h dpms.o: $(srcdir)/xscreensaver.h dpms.o: $(srcdir)/prefs.h @@ -841,13 +875,9 @@ remote.o: ../config.h remote.o: $(srcdir)/remote.h xscreensaver-command.o: ../config.h xscreensaver-command.o: $(srcdir)/remote.h -xscreensaver-command.o: $(UTILS_SRC)/version.h test-passwd.o: ../config.h test-passwd.o: $(srcdir)/xscreensaver.h test-passwd.o: $(srcdir)/prefs.h -test-passwd.o: $(UTILS_SRC)/resources.h -test-passwd.o: $(UTILS_SRC)/version.h -test-passwd.o: $(UTILS_SRC)/visual.h test-passwd.o: XScreenSaver_ad.h test-uid.o: ../config.h test-xdpms.o: ../config.h @@ -856,5 +886,4 @@ test-apm.o: ../config.h test-fade.o: ../config.h test-fade.o: $(srcdir)/xscreensaver.h test-fade.o: $(srcdir)/prefs.h -test-fade.o: $(UTILS_SRC)/fade.h diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in index 5b1d3b65..77bd854d 100644 --- a/driver/XScreenSaver.ad.in +++ b/driver/XScreenSaver.ad.in @@ -4,8 +4,8 @@ ! a screen saver and locker for the X window system ! by Jamie Zawinski ! -! version 3.34 -! 25-Oct-2001 +! version 4.00 +! 02-Jan-2002 ! ! See "man xscreensaver" for more info. The latest version is always ! available at http://www.jwz.org/xscreensaver/ @@ -45,7 +45,7 @@ *lock: False *lockVTs: True *verbose: False -*timestamp: False +*timestamp: True *fade: True *unfade: False *fadeSeconds: 0:00:03 @@ -140,7 +140,7 @@ ! and change other parameters. See the man page for details. ! *programs: \ - "Qix (solid)" qix -root -solid -delay 0 -segments 100 \n\ + "Qix (solid)" qix -root -solid -segments 100 \n\ "Qix (transparent)" qix -root -count 4 -solid -transparent \n\ "Qix (linear)" qix -root -count 5 -solid -transparent \ -linear -segments 250 -size 100 \n\ @@ -242,7 +242,7 @@ xflame -root \n\ wander -root \n\ "Wander (spots)" wander -root -advance 0 -size 10 -circles \ - True -length 10000 -reset 100000 \n\ + -length 10000 -reset 100000 \n\ critical -root \n\ phosphor -root \n\ xmatrix -root \n\ @@ -299,7 +299,9 @@ -texture_quality -light -fog \n\ @GLE_KLUDGE@GL: extrusion -root \n\ @GL_KLUDGE@ GL: sierpinski3d -root \n\ -@GL_KLUDGE@ GL: gflux -root \n\ +@GL_KLUDGE@ GL: menger -root \n\ +@GL_KLUDGE@ GL: "GFlux" gflux -root \n\ +@GL_KLUDGE@ GL: "GFlux (grab)" gflux -root -mode grab \n\ @GL_KLUDGE@ GL: stonerview -root \n\ @GL_KLUDGE@ GL: starwars -root \n\ @GL_KLUDGE@ GL: gltext -root \n\ @@ -308,6 +310,8 @@ @GL_KLUDGE@ GL: "Molecule (lumpy)" molecule -root -no-bonds -no-labels \n\ @GL_KLUDGE@ GL: dangerball -root \n\ @GL_KLUDGE@ GL: circuit -root \n\ +@GL_KLUDGE@ GL: engine -root \n\ +@GL_KLUDGE@ GL: flipscreen3d -root \n\ \ - xdaliclock -root -builtin3 -cycle \n\ - default-n: xearth -nofork -nostars -ncolors 50 \ @@ -394,20 +398,23 @@ XScreenSaver.bourneShell: /bin/sh *Dialog.buttonFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 *Dialog.dateFont: *-courier-medium-r-*-*-*-80-*-*-*-iso8859-1 *Dialog.foreground: #000000 -*Dialog.background: #BFBFBF +*Dialog.background: #D6D6D6 *Dialog.Button.foreground: #000000 -*Dialog.Button.background: #D0D0D0 +*Dialog.Button.background: #EAEAEA +!*Dialog.Button.background: #D6D6D6 +!*Dialog.Button.pointBackground: #EAEAEA +!*Dialog.Button.clickBackground: #C3C3C3 *Dialog.text.foreground: #000000 *Dialog.text.background: #FFFFFF *passwd.thermometer.foreground: #FF0000 *passwd.thermometer.background: #FFFFFF -*Dialog.topShadowColor: #E7E7E7 -*Dialog.bottomShadowColor: #737373 +*Dialog.topShadowColor: #FFFFFF +*Dialog.bottomShadowColor: #666666 *Dialog.logo.width: 210 *Dialog.logo.height: 210 *Dialog.internalBorderWidth: 30 *Dialog.borderWidth: 1 -*Dialog.shadowThickness: 4 +*Dialog.shadowThickness: 2 *passwd.heading.label: XScreenSaver %s *passwd.body.label: This display is locked. @@ -417,10 +424,9 @@ XScreenSaver.bourneShell: /bin/sh *passwd.thermometer.width: 8 *splash.heading.label: XScreenSaver %s -*splash.body.label: Copyright © 1991-2001 by +*splash.body.label: Copyright © 1991-2002 by *splash.body2.label: Jamie Zawinski -*splash.demo.label: Demo -*splash.prefs.label: Prefs +*splash.demo.label: Settings *splash.help.label: Help @@ -552,843 +558,52 @@ XScreenSaver*doc.fontList: *-helvetica-medium-r-*-*-*-100-*-*-*-iso8859-1 *Cancel.bottomOffset: 10 - - -!============================================================================= -! -! Online documentation for xscreensaver-demo. -! -!============================================================================= - -! sanity check -- hands off. -*hacks.documentation.isInstalled: True - -*hacks.qix.documentation: \ -This is the swiss army chainsaw of qix programs. It bounces a series \ -of line segments around the screen, and uses variations on this basic \ -motion pattern to produce all sorts of different presentations: line \ -segments, filled polygons, overlapping translucent areas... Written \ -by Jamie Zawinski. - -*hacks.attraction.documentation: \ -Like qix, this uses a simple simple motion model to generate many \ -different display modes. The control points attract each other up to \ -a certain distance, and then begin to repel each other. The \ -attraction/repulsion is proportional to the distance between any two \ -particles, similar to the strong and weak nuclear forces. \ - \n\n\ -One of the most interesting ways to watch this hack is simply as \ -bouncing balls, because their motions and interactions with each \ -other are so odd. Sometimes two balls will get into a tight orbit \ -around each other, to be interrupted later by a third, or by the edge \ -of the screen. It looks quite chaotic. \ - \n\n\ -Written by Jamie Zawinski, based on Lisp code by John Pezaris. - -*hacks.pyro.documentation: \ -Pyro draws exploding fireworks. Blah blah blah. Written by Jamie \ -Zawinski. - -*hacks.helix.documentation: \ -This repeatedly generates spirally string-art-ish patterns. Written \ -by Jamie Zawinski. - -*hacks.pedal.documentation: \ -This is sort of a combination spirograph/string-art. It generates a \ -large, complex polygon, and lets the X server do the bulk of the work \ -by giving it an even/odd winding rule. Written by Dale Moore, based \ -on some ancient PDP-11 code. - -*hacks.rorschach.documentation: \ -This generates random inkblot patterns. The algorithm is deceptively \ -simple for how well it works; it merely walks a dot around the screen \ -randomly, and then reflects the image horizontally, vertically, or \ -both. Any deep-seated neurotic tendencies which this program reveals \ -are your own problem. Written by Jamie Zawinski. - -*hacks.hopalong.documentation: \ -This draws lacy fractal patterns, based on iteration in the imaginary \ -plane, from a 1986 Scientific American article. Mostly written by \ -Patrick Naughton. - -*hacks.greynetic.documentation: \ -This draws random colored and stippled rectangles. Written by Jamie \ -Zawinski. - -*hacks.imsmap.name: IMSmap -*hacks.imsmap.documentation: \ -This generates random cloud-like patterns. It looks quite different \ -in monochrome and color. The basic idea is to take four points on \ -the edge of the image, and assign each a random ``elevation''. Then \ -find the point between them, and give it a value which is the average \ -of the other four, plus some small random offset. Then coloration is \ -done based on elevation. \ - \n\n\ -The color selection is done by binding the elevation to either hue, \ -saturation, or brightness, and assigning random values to the others. \ -The ``brightness'' mode tends to yield cloudlike patterns, and the \ -others tend to generate images that look like heat-maps or CAT-scans. \ -Written by Juergen Nickelsen and Jamie Zawinski. - -*hacks.slidescreen.name: SlideScreen -*hacks.slidescreen.documentation: \ -This takes an image, divides it into a grid, and then randomly shuffles \ -the squares around as if it was one of those annoying ``16-puzzle'' \ -games, where there is a grid of squares, one of which is missing. \ -I hate trying to solve those puzzles, but watching one permute itself \ -is more amusing. Written by Jamie Zawinski. - -*hacks.decayscreen.name: DecayScreen -*hacks.decayscreen.documentation: \ -This takes an image and makes it melt. You've no doubt seen this \ -effect before, but no screensaver would really be complete without it. \ -It works best if there's something colorful visible. Warning, if the \ -effect continues after the screen saver is off, seek medical attention. \ -Written by David Wald and Vivek Khera. - -*hacks.jigsaw.documentation: \ -This grabs a screen image, carves it up into a jigsaw puzzle, \ -shuffles it, and then solves the puzzle. This works especially well \ -when you feed it an external video signal instead of letting it grab \ -the screen image (actually, I guess this is generally true...) When \ -it is grabbing a video image, it is sometimes pretty hard to guess \ -what the image is going to look like once the puzzle is solved. \ -Written by Jamie Zawinski. - -*hacks.blitspin.name: BlitSpin -*hacks.blitspin.documentation: \ -The ``blitspin'' hack repeatedly rotates a bitmap by 90 degrees by \ -using logical operations: the bitmap is divided into quadrants, and \ -the quadrants are shifted clockwise. Then the same thing is done \ -again with progressively smaller quadrants, except that all \ -sub-quadrants of a given size are rotated in parallel. Written by \ -Jamie Zawinski based on some cool SmallTalk code seen in in Byte \ -Magazine in 1981. \ - \n\n\ -As you watch it, the image appears to dissolve into static and then \ -reconstitute itself, but rotated. You can provide the image to use, \ -as an XBM or XPM file, or tell it to grab a screen image and rotate \ -that. - -*hacks.slip.documentation: \ -This program throws some random bits on the screen, then sucks them \ -through a jet engine and spews them out the other side. To avoid \ -turning the image completely to mush, every now and then it will and \ -then it interjects some splashes of color into the scene, or go into \ -a spin cycle, or stretch the image like taffy, or (this is my \ -addition) grab an image of your current desktop to chew on. \ -Originally written by Scott Draves; whacked on by Jamie Zawinski. - -*hacks.distort.documentation: \ -This hack grabs an image of the screen, and then lets a transparent \ -lens wander around the screen, magnifying whatever is underneath. \ -Written by Jonas Munsin. - -*hacks.spotlight.documentation: \ -Draws a spotlight scanning across a black screen, illumnating the \ -underlying desktop when it passes. Written by Rick Schultz. - -*hacks.hypercube.documentation: \ -This displays 2D projections of the sequence of 3D objects which are \ -the projections of the 4D analog to the cube: as a square is composed \ -of four lines, each touching two others; and a cube is composed of \ -six squares, each touching four others; a hypercube is composed of \ -eight cubes, each touching six others. To make it easier to \ -visualize the rotation, it uses a different color for the edges of \ -each face. Don't think about it too long, or your brain will melt. \ -Written by Joe Keane, Fritz Mueller, and Jamie Zawinski. - -*hacks.hyperball.documentation: \ -Hyperball is to hypercube as dodecahedron is to cube: this displays \ -a 2D projection of the sequence of 3D objects which are the projections \ -of the 4D analog to the dodecahedron. Written by Joe Keane. - -*hacks.halo.documentation: \ -This draws trippy psychedelic circular patterns that hurt to look at. \ -It can also animate the control-points, but that takes a lot of CPU \ -and bandwidth. Written by Jamie Zawinski. - -*hacks.maze.documentation: \ -This is the ancient X maze demo, modified to work with xscreensaver. \ -It generates a random maze, then solves it with visual feedback. \ -Originally by Jim Randell; modified by a cast of thousands. - -*hacks.noseguy.documentation: \ -A little man with a big nose wanders around your screen saying \ -things. The things which he says can come from a file, or from an \ -external program like `zippy' or `fortune'. This was extracted from \ -`xnlock' by Dan Heller. Colorized by Jamie Zawinski. - -*hacks.flame.documentation: \ -Another iterative fractal generator. Written by Scott Draves. - -*hacks.lmorph.name: LMorph -*hacks.lmorph.documentation: \ -This generates random spline-ish line drawings and morphs between \ -them. Written by Sverre H. Huseby and Glenn T. Lines. - -*hacks.deco.documentation: \ -This one subdivides and colors rectangles randomly. It looks kind of \ -like Brady-Bunch-era rec-room wall paneling. (Raven says: ``this \ -screensaver is ugly enough to peel paint.'') Written by Jamie \ -Zawinski, inspired by Java code by Michael Bayne. - -*hacks.moire.documentation: \ -This one draws cool circular interference patterns. Most of the \ -circles you see aren't explicitly rendered, but show up as a result \ -of interactions between the other pixels that were drawn. Written by \ -Jamie Zawinski, inspired by Java code by Michael Bayne. As he \ -pointed out, the beauty of this one is that the heart of the display \ -algorithm can be expressed with just a pair of loops and a handful of \ -arithmetic, giving it a high ``display hack metric''. - -*hacks.moire2.documentation: \ -Another example of the fun you can have with moire \ -interference patterns; this hack generates fields of concentric \ -circles or ovals, and combines the planes with various operations. \ -The planes are moving independently of one another, causing the \ -interference lines to ``spray.'' Written by Jamie Zawinski. - -*hacks.lightning.documentation: \ -This one draws crackling fractal lightning bolts. It's simple, \ -direct, and to the point. If only it had sound... Written by Keith \ -Romberg. - -*hacks.strange.documentation: \ -This draws strange attractors: it's a colorful, \ -unpredictably-animating field of dots that swoops and twists around. \ -The motion is very nice. Written by Massimino Pascal. - -*hacks.spiral.documentation: \ -Moving circular patterns, by Peter Schmitzberger. Moving circular \ -patterns means moire; interference patterns, of course. - -*hacks.laser.documentation: \ -Moving radiating lines, that look vaguely like scanning laser beams. \ -Written by Pascal Pensa. (Frankie say: relax.) - -*hacks.grav.documentation: \ -This program draws a simple orbital simulation. If you turn on \ -trails, it looks kind of like a cloud-chamber photograph. Written \ -by Greg Bowering. - -*hacks.drift.documentation: \ -How could one possibly describe this except as ``drifting recursive \ -fractal cosmic flames?'' Another fine hack from the Scott Draves \ -collection of fine hacks. - -*hacks.ifs.name: IFS -*hacks.ifs.documentation: \ -This one draws spinning, colliding iterated-function-system images. \ -Written by Massimino Pascal. - -*hacks.julia.documentation: \ -This one draws spinning, animating (are you detecting a pattern here \ -yet?) explorations of the Julia set. You've probably seen static \ -images of this fractal form before, but it's a lot of fun to watch in \ -motion as well. One interesting thing is that there is a small \ -swinging dot passing in front of the image, which indicates the \ -control point from which the rest of the image was generated. \ -Written by Sean McCullough. - -*hacks.penrose.documentation: \ -Draws quasiperiodic tilings; think of the implications on modern \ -formica technology. Written by Timo Korvola. \ - \n\n\ -In April 1997, Sir Roger Penrose, a British math professor who has \ -worked with Stephen Hawking on such topics as relativity, black \ -holes, and whether time has a beginning, filed a \ -copyright-infringement lawsuit against the Kimberly-Clark \ -Corporation, which Penrose said copied a pattern he created (a \ -pattern demonstrating that ``a nonrepeating pattern could exist in \ -nature'') for its Kleenex quilted toilet paper. Penrose said he \ -doesn't like litigation but, ``When it comes to the population of \ -Great Britain being invited by a multinational to wipe their bottoms \ -on what appears to be the work of a Knight of the Realm, then a last \ -stand must be taken.'' \ - \n\n\ -As reported by News of the Weird #491, 4-jul-1997. - -*hacks.sierpinski.documentation: \ -This draws the two-dimensional variant of the recursive Sierpinski \ -triangle fractal. Written by Desmond Daignault. - -*hacks.braid.documentation: \ -Draws random color-cycling inter-braided concentric circles. Written \ -by John Neil. - -*hacks.galaxy.documentation: \ -This draws spinning galaxies, which then collide and scatter their \ -stars to the, uh, four winds or something. Originally an Amiga \ -program by Uli Siegmund. - -*hacks.bouboule.documentation: \ -This draws what looks like a spinning, deforming baloon with \ -varying-sized spots painted on its invisible surface. Written by \ -Jeremie Petit. - -*hacks.swirl.documentation: \ -More flowing, swirly patterns. This version is by M. Dobie and R. \ -Taylor, but you might have seen a Mac program similar to this called \ -FlowFazer. There is also a cool Java applet of a similar concept - -*hacks.flag.documentation: \ -This draws a waving colored flag, that undulates its way around the \ -screen. The trick is the flag can contain arbitrary text and images. \ -By default, it displays either the current system name and OS \ -type, or a picture of ``Bob,'' but you can replace the text or the \ -image with a command-line option. Written by Charles Vidal and Jamie \ -Zawinski. - -*hacks.sphere.documentation: \ -Another of the classic screenhacks of the distant past, this one \ -draws shaded spheres in multiple colors. This hack traces its \ -lineage back to Tom Duff in 1982. - -*hacks.forest.documentation: \ -This draws fractal trees. Written by Peter Baumung. Everybody loves \ -fractals, right? - -*hacks.lisa.documentation: \ -This draws Lisajous loops, by Caleb Cullen. Remember that device \ -they had the Phantom Zone prisoners in during their trial in \ -Superman? I think that was one of these. - -*hacks.lissie.documentation: \ -Another Lissajous figure. This one draws the progress of circular \ -shapes along a path. Written by Alexander Jolk. - -*hacks.goop.documentation: \ -This draws set of animating, transparent, amoeba-like blobs. The \ -blobs change shape as they wander around the screen, and they are \ -translucent, so you can see the lower blobs through the higher ones, \ -and when one passes over another, their colors merge. Written by \ -Jamie Zawinski. I got the idea for this from a cool mouse pad I \ -have, which achieves the same kind of effect in real life by having \ -several layers plastic with colored oil between them. Written by \ -Jamie Zawinski. - -*hacks.starfish.documentation: \ -This generates a sequence of undulating, throbbing, star-like \ -patterns which pulsate, rotate, and turn inside out. Another display \ -mode uses these shapes to lay down a field of colors, which are then \ -cycled. The motion is very organic. Written by Jamie Zawinski. - -*hacks.munch.documentation: \n\ - DATAI 2 \n\ - ADDB 1,2 \n\ - ROTC 2,-22 \n\ - XOR 1,2 \n\ - JRST .-4 \n\ - \n\ -As reported by HAKMEM, in 1962, Jackson Wright wrote the above PDP-1 \ -code. That code still lives on in this screenhack, some 35 years \ -later. The number of lines of enclosing code has increased \ -substantially, however. This version is by Tim Showalter. - -*hacks.fadeplot.name: FadePlot -*hacks.fadeplot.documentation: \ -Draws what looks like a waving ribbon following a sinusoidal path. \ -Written by Bas van Gaalen and Charles Vidal. - -*hacks.coral.documentation: \ -Simulates coral growth, albeit somewhat slowly. This image doesn't \ -really do it justice. Written by Frederick Roeber. - -*hacks.mountain.documentation: \ -Generates random 3d plots that look vaguely mountainous. Written by \ -Pascal Pensa. - -*hacks.triangle.documentation: \ -Generates random mountain ranges using iterative subdivision of \ -triangles. Written by Tobias Gloth. - -*hacks.worm.documentation: \ -An ancient xlock hack that draws multicolored worms that crawl around \ -the screen. Written by Brad Taylor, Dave Lemke, Boris Putanec, and \ -Henrik Theiling. - -*hacks.rotor.documentation: \ -Another ancient xlock demo, this one by Tom Lawrence. It draws a \ -line segment moving along a complex spiraling curve. I tweaked this \ -to generate curvier lines, but still frames of it don't look like \ -much. - -*hacks.ant.documentation: \ -A cellular automaton that is really a two-dimensional Turing machine: \ -as the heads (``ants'') walk along the screen, they change pixel \ -values in their path. Then, as they pass over changed pixels, their \ -behavior is influenced. Written by David Bagley. - -*hacks.demon.documentation: \ -A cellular automaton that starts with a random field, and organizes \ -it into stripes and spirals. Written by David Bagley. - -*hacks.loop.documentation: \ -This one produces loop-shaped colonies that spawn, age, and \ -eventually die. Written by David Bagley. - -*hacks.vines.documentation: \ -This one generates a continuous sequence of small, curvy geometric \ -patterns. It scatters them around your screen until it fills up, \ -then it clears the screen and starts over. Written by Tracy Camp and \ -David Hansen. - -*hacks.kaleidescope.documentation: \ -Another clone of an ancient meme, consisting largely of frenetic \ -rotational motion of colored lines. This one is by Ron Tapia. The \ -motion is nice, but I think it needs more solids, or perhaps just \ -brighter colors. More variations in the rotational speed might help, \ -too. - -*hacks.xjack.documentation: \ -This program behaves schizophrenically and makes a lot of typos. \ -Written by Jamie Zawinski. If you haven't seen Stanley Kubrick's \ -masterpiece, ``The Shining,'' you won't get it. Those who have \ -describe this hack as ``inspired.'' - -*hacks.xlyap.documentation: \ -This generates pretty fractal pictures by doing funky math involving \ -the ``Lyapunov exponent.'' It has a cool interactive mode, too. \ -Written by Ron Record. - -*hacks.cynosure.documentation: \ -A hack similar to `greynetic', but less frenetic. The first \ -implementation was by Stephen Linhart; then Ozymandias G. Desiderata \ -wrote a Java applet clone. That clone was discovered by Jamie \ -Zawinski, and ported to C for inclusion here. - -*hacks.flow.documentation: \ -Another series of strange attractors: a flowing series of points, \ -making strange rotational shapes. Written by Jeff Butterworth. - -*hacks.epicycle.documentation: \ -This program draws the path traced out by a point on the edge of a \ -circle. That circle rotates around a point on the rim of another \ -circle, and so on, several times. These were the basis for the \ -pre-heliocentric model of planetary motion. Written by James \ -Youngman. - -*hacks.interference.documentation: \ -Another color-field hack, this one works by computing decaying \ -sinusoidal waves, and allowing them to interfere with each other as \ -their origins move. Written by Hannu Mallat. - -*hacks.truchet.documentation: \ -This draws line- and arc-based Truchet patterns that tile the screen. \ -Written by Adrian Likins. - -*hacks.bsod.name: BSOD -*hacks.bsod.documentation: \ -BSOD stands for ``Blue Screen of Death.'' The finest in personal \ -computer emulation, this hack simulates popular screen savers from a \ -number of less robust operating systems. Written by Jamie Zawinski. - -*hacks.crystal.documentation: \ -Moving polygons, similar to a kaleidescope (more like a kaleidescope \ -than the hack called `kaleid,' actually.) This one by Jouk Jansen. - -*hacks.discrete.documentation: \ -More ``discrete map'' systems, including new variants of Hopalong and \ -Julia, and a few others. Written by Tim Auckland. - -*hacks.kumppa.documentation: \ -Spiraling, spinning, and very, very fast splashes of color rush \ -toward the screen. Written by Teemu Suutari. - -*hacks.rd-bomb.name: RD-Bomb -*hacks.rd-bomb.documentation: \ -Another variation of the `Bomb' program by Scott Draves. This draws \ -a grid of growing square-like shapes that, once they overtake each \ -other, react in unpredictable ways. ``RD'' stands for \ -reaction-diffusion. - -*hacks.sonar.documentation: \ -This program draws a simulation of a sonar screen. Written by \ -default, it displays a random assortment of ``bogies'' on the screen, \ -but if compiled properly, it can ping (pun intended) your local \ -network, and actually plot the proximity of the other hosts on your \ -network to you. It would be easy to make it monitor other sources of \ -data, too. (Processes? Active network connections? CPU usage per \ -user?) Written by Stephen Martin. - -*hacks.t3d.name: T3D -*hacks.t3d.documentation: \ -This draws a working analog clock composed of floating, throbbing \ -bubbles. Written by Bernd Paysan. - -*hacks.penetrate.documentation: \ -This hack simulates the classic arcade game Missile Command. Written \ -by Adam Miller. - -*hacks.deluxe.documentation: \ -This draws a pulsing sequence of stars, circles, and lines. It would \ -look better if it was faster, but as far as I can tell, there is no \ -way to make this be both: fast, and flicker-free. Yet another reason \ -X sucks. Written by Jamie Zawinski. - -*hacks.compass.documentation: \ -This draws a compass, with all elements spinning about randomly, for \ -that ``lost and nauseous'' feeling. Written by Jamie Zawinski. - -*hacks.squiral.documentation: \ -Draws a set of interacting, square-spiral-producing automata. The \ -spirals grow outward until they hit something, then they go around \ -it. Written by Jeff Epler. - -*hacks.xflame.documentation: \ -Draws a simulation of pulsing fire. It can also take an arbitrary \ -image and set it on fire too. Written by Carsten Haitzler, hacked on \ -by many others. - -*hacks.wander.documentation: \ -Draws a colorful random-walk, in various forms. Written by Rick \ -Campbell. - -*hacks.critical.documentation: \ -Draws a system of self-organizing lines. It starts out as random \ -squiggles, but after a few iterations, order begins to appear. \ -Written by Martin Pool. - -*hacks.phosphor.documentation: \ -Draws a simulation of an old terminal, with large pixels and \ -long-sustain phosphor. It can run any program as a source of the text \ -it displays. Written by Jamie Zawinski. - -*hacks.xmatrix.documentation: \ -A rendition of the text scrolls seen in the movie ``The Matrix.'' \ -Written by Jamie Zawinski. - -*hacks.petri.documentation: \ -This simulates colonies of mold growing in a petri dish. Growing \ -colored circles overlap and leave spiral interference in their wake. \ -Written by Dan Bornstein. - -*hacks.shadebobs.name: ShadeBobs -*hacks.shadebobs.documentation: \ -This draws smoothly-shaded oscilating oval patterns, that look \ -something like vapor trails or neon tubes. Written by Shane Smit. - -*hacks.ccurve.name: C Curve -*hacks.ccurve.documentation: \ -Generates self-similar linear fractals, including the classic ``C \ -Curve.'' Written by Rick Campbell. - -*hacks.blaster.documentation: \ -Draws a simulation of flying space-combat robots (cleverly disguised \ -as colored circles) doing battle in front of a moving star field. \ -Written by Jonathan Lin. - -*hacks.bumps.documentation: \ -A bit like `Spotlight', except that instead of merely exposing part \ -of your desktop, it creates a bump map from it. Basically, it \ -3D-izes a roaming section of your desktop, based on color intensity. \ -Written by Shane Smit. - -*hacks.xteevee.name: XTeeVee -*hacks.xteevee.documentation: \ -XTeeVee simulates various television problems, including static, \ -loss of vertical hold, and a test pattern. By Greg Knauss. - -*hacks.xspirograph.name: XSpiroGraph -*hacks.xspirograph.documentation: \ -Simulates that pen-in-nested-plastic-gears toy from your childhood. \ -By Rohit Singh. - -*hacks.nerverot.name: NerveRot -*hacks.nerverot.documentation: \ -Draws different shapes composed of nervously vibrating squiggles, \ -as if seen through a camera operated by a monkey on crack. \ -By Dan Bornstein. - -*hacks.webcollage.name: WebCollage -*hacks.webcollage.documentation: \ -This program makes collages out of random images pulled off of the \ -World Wide Web. It finds these images by doing random web searches, \ -and then extracting images from the returned pages. It can also be \ -set up to filter the images through the `VidWhacker' program, above, \ -which looks really great. \ - \n\n\ -(Note that most of the images it finds are text, and not pictures. \ -This is because most of the web is pictures of text. Which is pretty \ -sad.) Written by Jamie Zawinski. - -*hacks.vidwhacker.name: VidWhacker -*hacks.vidwhacker.documentation: \ -This is actually just a shell script that grabs a frame of video from \ -the system's video input, and then uses some PBM filters (chosen at \ -random) to manipulate and recombine the video frame in various ways \ -(edge detection, subtracting the image from a rotated version of \ -itself, etc.) Then it displays that image for a few seconds, and \ -does it again. This works really well if you just feed broadcast \ -television into it. \ - \n\n\ -Currently, the three lines of the script that actually grab the \ -source picture are SGI specific, but it should be trivial to adapt it \ -to work on other systems that can grab video (please send me the \ -changes if you do this...) - -*hacks.rocks.documentation: \ -This draws an animation of flight through an asteroid field, with \ -changes in rotation and direction. It can also display 3D \ -separations for red/blue glasses! Mostly written by Jamie Zawinski. - -*hacks.bubbles.documentation: \ -This simulates the kind of bubble formation that happens when water \ -boils:small bubbles appear, and as they get closer to each other, \ -they combine to form larger bubbles, which eventually pop. Written \ -by James Macnicol. - -*hacks.gears.documentation: \ -This draws sets of turning, interlocking gears, rotating in three \ -dimensions. Another GL hack, by Danny Sung, Brian Paul, Ed Mackey, \ -and Jamie Zawinski. - -*hacks.superquadrics.documentation: \ -Ed Mackey reports that he wrote the first version of this program in \ -BASIC on a Commodore 64 in 1987, as a 320x200 black and white \ -wireframe. Now it is GL and has specular reflections. - -*hacks.morph3d.name: Morph3D -*hacks.morph3d.documentation: \ -Another 3d shape-changing GL hack, by Marcelo Vianna. It has the \ -same shiny-plastic feel as Superquadrics, as many computer-generated \ -objects do... - -*hacks.cage.documentation: \ -This draws Escher's ``Impossible Cage,'' a 3d analog of a moebius \ -strip, and rotates it in three dimensions. Written by Marcelo \ -Vianna. - -*hacks.moebius.documentation: \ -Another M. C. Escher hack by Marcelo Vianna, this one draws \ -``Moebius Strip II,'' a GL image of ants walking along the surface of \ -a moebius strip. - -*hacks.stairs.documentation: \ -by Marcelo Vianna's third Escher GL hack, this one draws an \ -``infinite'' staircase. - -*hacks.pipes.documentation: \ -If you've ever been in the same room with a Windows NT machine, \ -you've probably seen this GL hack. This version is by Marcelo \ -Vianna. - -*hacks.sproingies.documentation: \ -Q-Bert meets Marble Madness! Written by Ed Mackey. - -*hacks.rubik.documentation: \ -Draws a Rubik's Cube that rotates in three dimensions and repeatedly \ -shuffles and solves itself. Another fine GL hack by Marcelo Vianna. - -*hacks.atlantis.documentation: \ -This is xfishtank writ large: a GL animation of a number of sharks, \ -dolphins, and whales. The swimming motions are great. Originally \ -written by Mark Kilgard. - -*hacks.lament.documentation: \ -Animates a simulation of Lemarchand's Box, repeatedly solving itself. \ -Requires OpenGL, and a machine with fast hardware support for texture \ -maps. Warning: occasionally opens doors. Written by Jamie Zawinski. - -*hacks.bubble3d.name: Bubble3D -*hacks.bubble3d.documentation: \ -Draws a stream of rising, undulating 3D bubbles, rising toward the \ -top of the screen, with nice specular reflections. Written by Richard \ -Jones. - -*hacks.glplanet.name: GLPlanet -*hacks.glplanet.documentation: \ -Draws a planet bouncing around in space. Written by David Konerding. \ -The built-in image is a map of the earth (extracted from `xearth'), \ -but you can wrap any texture around the sphere, e.g., the planetary \ -textures that come with `ssystem'. - -*hacks.pulsar.documentation: \ -Draws some intersecting planes, making use of alpha blending, fog, \ -textures, and mipmaps, plus a ``frames per second'' meter so that you \ -can tell how fast your graphics card is... Requires OpenGL. Written \ -by David Konerding. - -*hacks.extrusion.documentation: \ -Draws various rotating extruded shapes that twist around, lengthen, \ -and turn inside out. Created by David Konerding from the samples \ -that come with the GL Extrusion library by Linas Vepstas. - -*hacks.sierpinski3d.name: Sierpinski3D -*hacks.sierpinski3d.documentation: \ -This draws the three-dimensional variant of the recursive Sierpinski \ -triangle fractal, using GL. Written by Tim Robinson and Jamie Zawinski. - -*hacks.ripples.documentation: \ -This draws rippling interference patterns like splashing water. \ -With the -water option, it manipulates your desktop image to look \ -like something is dripping into it. Written by Tom Hammersley. - -*hacks.gflux.name: GFlux -*hacks.gflux.documentation: \ -Draws a rippling waves on a rotating wireframe grid, using GL. \ -Written by Josiah Pease. - -*hacks.xrayswarm.name: XRaySwarm -*hacks.xrayswarm.documentation: \ -Draws a few swarms of critters flying around the screen, with nicely \ -faded color trails behind them. Written by Chris Leger. - -*hacks.zoom.documentation: \ -Zooms in on a part of the screen and then moves around. With the \ --lenses option the result is like looking through many overlapping \ -lenses rather than just a simple zoom. Written by James Macnicol. - -*hacks.whirlwindwarp.name: WhirlwindWarp -*hacks.whirlwindwarp.documentation: \ -Floating stars are acted upon by a mixture of simple 2D \ -forcefields. The strength of each forcefield changes \ -continuously, and it is also switched on and off at random. \ -By Paul 'Joey' Clark. - -*hacks.rotzoomer.name: RotZoomer -*hacks.rotzoomer.documentation: \ -Creates a collage of rotated and scaled portions of the \ -screen. Written by Claudio Matsuoka. - -*hacks.stonerview.name: StonerView -*hacks.stonerview.documentation: \ -Chains of colorful squares dance around each other in complex spiral \ -patterns. Written by Andrew Plotkin, based on SGI's `electropaint' \ -screensaver. - -*hacks.starwars.name: StarWars -*hacks.starwars.documentation: \ -Draws a stream of text slowly scrolling into the distance at an \ -angle, over a star field, like at the beginning of the movie of the \ -same name. Written by Jamie Zawinski and Claudio Matauoka. - -*hacks.gltext.name: GLText -*hacks.gltext.documentation: \ -Displays a few lines of text spinning around in a solid 3D font. \ -Written by Jamie Zawinski. - -*hacks.molecule.documentation: \ -Draws several different representations of molecules. Some common \ -molecules are built in, and it can also read PDB (Protein Data Base) \ -files as input. Written by Jamie Zawinski. - -*hacks.dangerball.name: DangerBall -*hacks.dangerball.documentation: \ -Draws a ball that periodically extrudes many random spikes. Ouch! \ -Written by Jamie Zawinski. - -*hacks.whirlygig.name: WhirlyGig -*hacks.whirlygig.documentation: \ -Draws zooming chains of sinusoidal spots. Written by Ashton Trey Belew. - -*hacks.speedmine.name: SpeedMine -*hacks.speedmine.documentation: \ -Simulates speeding down a rocky mineshaft, or a funky dancing worm. \ -Written by Conrad Parker. - -*hacks.circuit.documentation: \ -Animates a number of 3D electronic components. Written by Ben Buxton. - -*hacks.vermiculate.documentation: \ -Draws squiggly worm-like paths. Written by Tyler Pierce. - - !============================================================================= ! -! Documentation for some programs that are not bundled with XScreenSaver +! Pretty names for the hacks that have unusual capitalization. ! !============================================================================= -*hacks.xdaliclock.name: XDaliClock -*hacks.xdaliclock.documentation: \ -XDaliClock draws a large digital clock, the numbers of which change by \ -``melting'' into their new shapes. Written by Jamie Zawinski. This \ -is not included with the XScreenSaver package, but if you don't have \ -it already, you can find it at . - -*hacks.xearth.documentation: \ -XEarth draws an image of the Earth, as seen from your favorite vantage \ -point in space, correctly shaded for the current position of the Sun. \ -Written by Kirk Johnson. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -. - -*hacks.xplanetbg.name: XPlanet -*hacks.xplanetbg.documentation: \ -XPlanet is like XEarth, but with more options. It draws an image of \ -the Earth (or other planets!), as seen from your favorite vantage \ -point in space, correctly shaded for the current position of the Sun. \ -Written by Hari Nair. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -. - -*hacks.ssystem.name: SSystem -*hacks.ssystem.documentation: \ -SSystem is a GL Solar System simulator. It simulates flybys of Sun, \ -the nine planets and a few major satellites, with four camera modes. \ -Written by Raul Alonso. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -. - -*hacks.xmountains.documentation: \ -XMountains generates realistic-looking fractal terrains of snow-capped \ -mountains near water, with either a top view or a side view. \ -Written by Stephen Booth. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -. \ - \n\n\ -Be sure to compile it with -DVROOT or it won't work right when launched \ -by the xscreensaver daemon. - -*hacks.xaos.name: XaoS -*hacks.xaos.documentation: \ -XaoS generates fast fly-through animations of the Mandelbrot and other \ -fractal sets. Written by Thomas Marsh and Jan Hubicka. This is not \ -included with the XScreenSaver package, but if you don't have it \ -already, you can find it at . - -*hacks.xfishtank.name: XFishTank -*hacks.xfishtank.documentation: \ -Fish! This is not included with the XScreenSaver package, but if you \ -don't have it already, you can find it at \ -. - -*hacks.xsnow.documentation: \ -Draws falling snow and the occasional tiny Santa. By Rick Jansen. \ -You can find it at . - -*hacks.goban.documentation: \ -Replays historical games of go (aka wei-chi and baduk) on the screen. \ -By Scott Draves. You can find it at . - -*hacks.electricsheep.name: ElectricSheep -*hacks.electricsheep.documentation: \ -ElectricSheep is an xscreensaver module that displays mpeg video of \ -an animated fractal flame. In the background, it contributes render \ -cycles to the next animation. Periodically it uploades completed \ -frames to the server, where they are compressed for distribution to \ -all clients. \ - \n\n\ -This program is recommended only if you have a high bandwidth \ -connection to the Internet. \ - \n\n\ -By Scott Draves. You can find it at . \ -See that web site for configuration information. - -*hacks.cosmos.documentation: \ -Draws fireworks and zooming, fading flares. By Tom Campbell. \ -You can find it at . - +*hacks.imsmap.name: IMSmap +*hacks.slidescreen.name: SlideScreen +*hacks.decayscreen.name: DecayScreen +*hacks.blitspin.name: BlitSpin +*hacks.lmorph.name: LMorph +*hacks.ifs.name: IFS +*hacks.fadeplot.name: FadePlot +*hacks.bsod.name: BSOD +*hacks.rd-bomb.name: RD-Bomb +*hacks.t3d.name: T3D +*hacks.shadebobs.name: ShadeBobs +*hacks.ccurve.name: C Curve +*hacks.xteevee.name: XTeeVee +*hacks.xspirograph.name: XSpiroGraph +*hacks.nerverot.name: NerveRot +*hacks.webcollage.name: WebCollage +*hacks.vidwhacker.name: VidWhacker +*hacks.morph3d.name: Morph3D +*hacks.bubble3d.name: Bubble3D +*hacks.glplanet.name: GLPlanet +*hacks.sierpinski3d.name: Sierpinski3D +*hacks.gflux.name: GFlux +*hacks.xrayswarm.name: XRaySwarm +*hacks.whirlwindwarp.name: WhirlwindWarp +*hacks.rotzoomer.name: RotZoomer +*hacks.stonerview.name: StonerView +*hacks.starwars.name: StarWars +*hacks.gltext.name: GLText +*hacks.dangerball.name: DangerBall +*hacks.whirlygig.name: WhirlyGig +*hacks.speedmine.name: SpeedMine +*hacks.xdaliclock.name: XDaliClock +*hacks.xplanetbg.name: XPlanet +*hacks.ssystem.name: SSystem +*hacks.xaos.name: XaoS +*hacks.xfishtank.name: XFishTank +*hacks.electricsheep.name: ElectricSheep *hacks.sphereEversion.name: SphereEversion -*hacks.sphereEversion.documentation: \ -SphereEversion draws an animation of a sphere being turned inside out. \ -A sphere can be turned inside out, without any tears, sharp creases or \ -discontinuities, if the surface of the sphere is allowed to intersect \ -itself. This program animates what is known as the Thurston Eversion. \ -Written by Nathaniel Thurston and Michael McGuffin. This program is \ -not included with the XScreenSaver package, but if you don't have it \ -already, you can find it at . + +! obsolete, but still used by xscreensaver-demo-Xm. +*hacks.documentation.isInstalled: True ! (xrdb prevention kludge: whole file) */ diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h index e159f5b4..b06511d9 100644 --- a/driver/XScreenSaver_ad.h +++ b/driver/XScreenSaver_ad.h @@ -18,7 +18,7 @@ "*lock: False", "*lockVTs: True", "*verbose: False", -"*timestamp: False", +"*timestamp: True", "*fade: True", "*unfade: False", "*fadeSeconds: 0:00:03", @@ -43,7 +43,7 @@ "*dateFormat: %d-%b-%y (%a); %I:%M %p", "*installColormap: True", "*programs: \ - \"Qix (solid)\" qix -root -solid -delay 0 -segments 100 \\n\ + \"Qix (solid)\" qix -root -solid -segments 100 \\n\ \"Qix (transparent)\" qix -root -count 4 -solid -transparent \\n\ \"Qix (linear)\" qix -root -count 5 -solid -transparent \ -linear -segments 250 -size 100 \\n\ @@ -145,7 +145,7 @@ xflame -root \\n\ wander -root \\n\ \"Wander (spots)\" wander -root -advance 0 -size 10 -circles \ - True -length 10000 -reset 100000 \\n\ + -length 10000 -reset 100000 \\n\ critical -root \\n\ phosphor -root \\n\ xmatrix -root \\n\ @@ -202,7 +202,9 @@ -texture_quality -light -fog \\n\ GL: extrusion -root \\n\ GL: sierpinski3d -root \\n\ - GL: gflux -root \\n\ + GL: menger -root \\n\ + GL: \"GFlux\" gflux -root \\n\ + GL: \"GFlux (grab)\" gflux -root -mode grab \\n\ GL: stonerview -root \\n\ GL: starwars -root \\n\ GL: gltext -root \\n\ @@ -211,6 +213,8 @@ GL: \"Molecule (lumpy)\" molecule -root -no-bonds -no-labels \\n\ GL: dangerball -root \\n\ GL: circuit -root \\n\ + GL: engine -root \\n\ + GL: flipscreen3d -root \\n\ \ - xdaliclock -root -builtin3 -cycle \\n\ - default-n: xearth -nofork -nostars -ncolors 50 \ @@ -239,20 +243,20 @@ "*Dialog.buttonFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", "*Dialog.dateFont: *-courier-medium-r-*-*-*-80-*-*-*-iso8859-1", "*Dialog.foreground: #000000", -"*Dialog.background: #BFBFBF", +"*Dialog.background: #D6D6D6", "*Dialog.Button.foreground: #000000", -"*Dialog.Button.background: #D0D0D0", +"*Dialog.Button.background: #EAEAEA", "*Dialog.text.foreground: #000000", "*Dialog.text.background: #FFFFFF", "*passwd.thermometer.foreground: #FF0000", "*passwd.thermometer.background: #FFFFFF", -"*Dialog.topShadowColor: #E7E7E7", -"*Dialog.bottomShadowColor: #737373", +"*Dialog.topShadowColor: #FFFFFF", +"*Dialog.bottomShadowColor: #666666", "*Dialog.logo.width: 210", "*Dialog.logo.height: 210", "*Dialog.internalBorderWidth: 30", "*Dialog.borderWidth: 1", -"*Dialog.shadowThickness: 4", +"*Dialog.shadowThickness: 2", "*passwd.heading.label: XScreenSaver %s", "*passwd.body.label: This display is locked.", "*passwd.user.label: User:", @@ -260,10 +264,9 @@ "*passwd.passwdFont: *-courier-medium-r-*-*-*-140-*-*-*-iso8859-1", "*passwd.thermometer.width: 8", "*splash.heading.label: XScreenSaver %s", -"*splash.body.label: Copyright © 1991-2001 by", +"*splash.body.label: Copyright © 1991-2002 by", "*splash.body2.label: Jamie Zawinski ", -"*splash.demo.label: Demo", -"*splash.prefs.label: Prefs", +"*splash.demo.label: Settings", "*splash.help.label: Help", "*fontList: *-helvetica-medium-r-*-*-*-120-*-*-*-iso8859-1", "*demoDialog*label1.fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1", @@ -373,688 +376,42 @@ "*Cancel.marginHeight: 4", "*Cancel.rightOffset: 10", "*Cancel.bottomOffset: 10", -"*hacks.documentation.isInstalled: True", -"*hacks.qix.documentation: \ -This is the swiss army chainsaw of qix programs. It bounces a series \ -of line segments around the screen, and uses variations on this basic \ -motion pattern to produce all sorts of different presentations: line \ -segments, filled polygons, overlapping translucent areas... Written \ -by Jamie Zawinski.", -"*hacks.attraction.documentation: \ -Like qix, this uses a simple simple motion model to generate many \ -different display modes. The control points attract each other up to \ -a certain distance, and then begin to repel each other. The \ -attraction/repulsion is proportional to the distance between any two \ -particles, similar to the strong and weak nuclear forces. \ - \\n\\n\ -One of the most interesting ways to watch this hack is simply as \ -bouncing balls, because their motions and interactions with each \ -other are so odd. Sometimes two balls will get into a tight orbit \ -around each other, to be interrupted later by a third, or by the edge \ -of the screen. It looks quite chaotic. \ - \\n\\n\ -Written by Jamie Zawinski, based on Lisp code by John Pezaris.", -"*hacks.pyro.documentation: \ -Pyro draws exploding fireworks. Blah blah blah. Written by Jamie \ -Zawinski.", -"*hacks.helix.documentation: \ -This repeatedly generates spirally string-art-ish patterns. Written \ -by Jamie Zawinski.", -"*hacks.pedal.documentation: \ -This is sort of a combination spirograph/string-art. It generates a \ -large, complex polygon, and lets the X server do the bulk of the work \ -by giving it an even/odd winding rule. Written by Dale Moore, based \ -on some ancient PDP-11 code.", -"*hacks.rorschach.documentation: \ -This generates random inkblot patterns. The algorithm is deceptively \ -simple for how well it works; it merely walks a dot around the screen \ -randomly, and then reflects the image horizontally, vertically, or \ -both. Any deep-seated neurotic tendencies which this program reveals \ -are your own problem. Written by Jamie Zawinski.", -"*hacks.hopalong.documentation: \ -This draws lacy fractal patterns, based on iteration in the imaginary \ -plane, from a 1986 Scientific American article. Mostly written by \ -Patrick Naughton.", -"*hacks.greynetic.documentation: \ -This draws random colored and stippled rectangles. Written by Jamie \ -Zawinski.", -"*hacks.imsmap.name: IMSmap", -"*hacks.imsmap.documentation: \ -This generates random cloud-like patterns. It looks quite different \ -in monochrome and color. The basic idea is to take four points on \ -the edge of the image, and assign each a random ``elevation''. Then \ -find the point between them, and give it a value which is the average \ -of the other four, plus some small random offset. Then coloration is \ -done based on elevation. \ - \\n\\n\ -The color selection is done by binding the elevation to either hue, \ -saturation, or brightness, and assigning random values to the others. \ -The ``brightness'' mode tends to yield cloudlike patterns, and the \ -others tend to generate images that look like heat-maps or CAT-scans. \ -Written by Juergen Nickelsen and Jamie Zawinski.", -"*hacks.slidescreen.name: SlideScreen", -"*hacks.slidescreen.documentation: \ -This takes an image, divides it into a grid, and then randomly shuffles \ -the squares around as if it was one of those annoying ``16-puzzle'' \ -games, where there is a grid of squares, one of which is missing. \ -I hate trying to solve those puzzles, but watching one permute itself \ -is more amusing. Written by Jamie Zawinski.", -"*hacks.decayscreen.name: DecayScreen", -"*hacks.decayscreen.documentation: \ -This takes an image and makes it melt. You've no doubt seen this \ -effect before, but no screensaver would really be complete without it. \ -It works best if there's something colorful visible. Warning, if the \ -effect continues after the screen saver is off, seek medical attention. \ -Written by David Wald and Vivek Khera.", -"*hacks.jigsaw.documentation: \ -This grabs a screen image, carves it up into a jigsaw puzzle, \ -shuffles it, and then solves the puzzle. This works especially well \ -when you feed it an external video signal instead of letting it grab \ -the screen image (actually, I guess this is generally true...) When \ -it is grabbing a video image, it is sometimes pretty hard to guess \ -what the image is going to look like once the puzzle is solved. \ -Written by Jamie Zawinski.", -"*hacks.blitspin.name: BlitSpin", -"*hacks.blitspin.documentation: \ -The ``blitspin'' hack repeatedly rotates a bitmap by 90 degrees by \ -using logical operations: the bitmap is divided into quadrants, and \ -the quadrants are shifted clockwise. Then the same thing is done \ -again with progressively smaller quadrants, except that all \ -sub-quadrants of a given size are rotated in parallel. Written by \ -Jamie Zawinski based on some cool SmallTalk code seen in in Byte \ -Magazine in 1981. \ - \\n\\n\ -As you watch it, the image appears to dissolve into static and then \ -reconstitute itself, but rotated. You can provide the image to use, \ -as an XBM or XPM file, or tell it to grab a screen image and rotate \ -that.", -"*hacks.slip.documentation: \ -This program throws some random bits on the screen, then sucks them \ -through a jet engine and spews them out the other side. To avoid \ -turning the image completely to mush, every now and then it will and \ -then it interjects some splashes of color into the scene, or go into \ -a spin cycle, or stretch the image like taffy, or (this is my \ -addition) grab an image of your current desktop to chew on. \ -Originally written by Scott Draves; whacked on by Jamie Zawinski.", -"*hacks.distort.documentation: \ -This hack grabs an image of the screen, and then lets a transparent \ -lens wander around the screen, magnifying whatever is underneath. \ -Written by Jonas Munsin.", -"*hacks.spotlight.documentation: \ -Draws a spotlight scanning across a black screen, illumnating the \ -underlying desktop when it passes. Written by Rick Schultz.", -"*hacks.hypercube.documentation: \ -This displays 2D projections of the sequence of 3D objects which are \ -the projections of the 4D analog to the cube: as a square is composed \ -of four lines, each touching two others; and a cube is composed of \ -six squares, each touching four others; a hypercube is composed of \ -eight cubes, each touching six others. To make it easier to \ -visualize the rotation, it uses a different color for the edges of \ -each face. Don't think about it too long, or your brain will melt. \ -Written by Joe Keane, Fritz Mueller, and Jamie Zawinski.", -"*hacks.hyperball.documentation: \ -Hyperball is to hypercube as dodecahedron is to cube: this displays \ -a 2D projection of the sequence of 3D objects which are the projections \ -of the 4D analog to the dodecahedron. Written by Joe Keane.", -"*hacks.halo.documentation: \ -This draws trippy psychedelic circular patterns that hurt to look at. \ -It can also animate the control-points, but that takes a lot of CPU \ -and bandwidth. Written by Jamie Zawinski.", -"*hacks.maze.documentation: \ -This is the ancient X maze demo, modified to work with xscreensaver. \ -It generates a random maze, then solves it with visual feedback. \ -Originally by Jim Randell; modified by a cast of thousands.", -"*hacks.noseguy.documentation: \ -A little man with a big nose wanders around your screen saying \ -things. The things which he says can come from a file, or from an \ -external program like `zippy' or `fortune'. This was extracted from \ -`xnlock' by Dan Heller. Colorized by Jamie Zawinski.", -"*hacks.flame.documentation: \ -Another iterative fractal generator. Written by Scott Draves.", -"*hacks.lmorph.name: LMorph", -"*hacks.lmorph.documentation: \ -This generates random spline-ish line drawings and morphs between \ -them. Written by Sverre H. Huseby and Glenn T. Lines.", -"*hacks.deco.documentation: \ -This one subdivides and colors rectangles randomly. It looks kind of \ -like Brady-Bunch-era rec-room wall paneling. (Raven says: ``this \ -screensaver is ugly enough to peel paint.'') Written by Jamie \ -Zawinski, inspired by Java code by Michael Bayne.", -"*hacks.moire.documentation: \ -This one draws cool circular interference patterns. Most of the \ -circles you see aren't explicitly rendered, but show up as a result \ -of interactions between the other pixels that were drawn. Written by \ -Jamie Zawinski, inspired by Java code by Michael Bayne. As he \ -pointed out, the beauty of this one is that the heart of the display \ -algorithm can be expressed with just a pair of loops and a handful of \ -arithmetic, giving it a high ``display hack metric''.", -"*hacks.moire2.documentation: \ -Another example of the fun you can have with moire \ -interference patterns; this hack generates fields of concentric \ -circles or ovals, and combines the planes with various operations. \ -The planes are moving independently of one another, causing the \ -interference lines to ``spray.'' Written by Jamie Zawinski.", -"*hacks.lightning.documentation: \ -This one draws crackling fractal lightning bolts. It's simple, \ -direct, and to the point. If only it had sound... Written by Keith \ -Romberg.", -"*hacks.strange.documentation: \ -This draws strange attractors: it's a colorful, \ -unpredictably-animating field of dots that swoops and twists around. \ -The motion is very nice. Written by Massimino Pascal.", -"*hacks.spiral.documentation: \ -Moving circular patterns, by Peter Schmitzberger. Moving circular \ -patterns means moire; interference patterns, of course.", -"*hacks.laser.documentation: \ -Moving radiating lines, that look vaguely like scanning laser beams. \ -Written by Pascal Pensa. (Frankie say: relax.)", -"*hacks.grav.documentation: \ -This program draws a simple orbital simulation. If you turn on \ -trails, it looks kind of like a cloud-chamber photograph. Written \ -by Greg Bowering.", -"*hacks.drift.documentation: \ -How could one possibly describe this except as ``drifting recursive \ -fractal cosmic flames?'' Another fine hack from the Scott Draves \ -collection of fine hacks.", -"*hacks.ifs.name: IFS", -"*hacks.ifs.documentation: \ -This one draws spinning, colliding iterated-function-system images. \ -Written by Massimino Pascal.", -"*hacks.julia.documentation: \ -This one draws spinning, animating (are you detecting a pattern here \ -yet?) explorations of the Julia set. You've probably seen static \ -images of this fractal form before, but it's a lot of fun to watch in \ -motion as well. One interesting thing is that there is a small \ -swinging dot passing in front of the image, which indicates the \ -control point from which the rest of the image was generated. \ -Written by Sean McCullough.", -"*hacks.penrose.documentation: \ -Draws quasiperiodic tilings; think of the implications on modern \ -formica technology. Written by Timo Korvola. \ - \\n\\n\ -In April 1997, Sir Roger Penrose, a British math professor who has \ -worked with Stephen Hawking on such topics as relativity, black \ -holes, and whether time has a beginning, filed a \ -copyright-infringement lawsuit against the Kimberly-Clark \ -Corporation, which Penrose said copied a pattern he created (a \ -pattern demonstrating that ``a nonrepeating pattern could exist in \ -nature'') for its Kleenex quilted toilet paper. Penrose said he \ -doesn't like litigation but, ``When it comes to the population of \ -Great Britain being invited by a multinational to wipe their bottoms \ -on what appears to be the work of a Knight of the Realm, then a last \ -stand must be taken.'' \ - \\n\\n\ -As reported by News of the Weird #491, 4-jul-1997.", -"*hacks.sierpinski.documentation: \ -This draws the two-dimensional variant of the recursive Sierpinski \ -triangle fractal. Written by Desmond Daignault.", -"*hacks.braid.documentation: \ -Draws random color-cycling inter-braided concentric circles. Written \ -by John Neil.", -"*hacks.galaxy.documentation: \ -This draws spinning galaxies, which then collide and scatter their \ -stars to the, uh, four winds or something. Originally an Amiga \ -program by Uli Siegmund.", -"*hacks.bouboule.documentation: \ -This draws what looks like a spinning, deforming baloon with \ -varying-sized spots painted on its invisible surface. Written by \ -Jeremie Petit.", -"*hacks.swirl.documentation: \ -More flowing, swirly patterns. This version is by M. Dobie and R. \ -Taylor, but you might have seen a Mac program similar to this called \ -FlowFazer. There is also a cool Java applet of a similar concept", -"*hacks.flag.documentation: \ -This draws a waving colored flag, that undulates its way around the \ -screen. The trick is the flag can contain arbitrary text and images. \ -By default, it displays either the current system name and OS \ -type, or a picture of ``Bob,'' but you can replace the text or the \ -image with a command-line option. Written by Charles Vidal and Jamie \ -Zawinski.", -"*hacks.sphere.documentation: \ -Another of the classic screenhacks of the distant past, this one \ -draws shaded spheres in multiple colors. This hack traces its \ -lineage back to Tom Duff in 1982.", -"*hacks.forest.documentation: \ -This draws fractal trees. Written by Peter Baumung. Everybody loves \ -fractals, right?", -"*hacks.lisa.documentation: \ -This draws Lisajous loops, by Caleb Cullen. Remember that device \ -they had the Phantom Zone prisoners in during their trial in \ -Superman? I think that was one of these.", -"*hacks.lissie.documentation: \ -Another Lissajous figure. This one draws the progress of circular \ -shapes along a path. Written by Alexander Jolk.", -"*hacks.goop.documentation: \ -This draws set of animating, transparent, amoeba-like blobs. The \ -blobs change shape as they wander around the screen, and they are \ -translucent, so you can see the lower blobs through the higher ones, \ -and when one passes over another, their colors merge. Written by \ -Jamie Zawinski. I got the idea for this from a cool mouse pad I \ -have, which achieves the same kind of effect in real life by having \ -several layers plastic with colored oil between them. Written by \ -Jamie Zawinski.", -"*hacks.starfish.documentation: \ -This generates a sequence of undulating, throbbing, star-like \ -patterns which pulsate, rotate, and turn inside out. Another display \ -mode uses these shapes to lay down a field of colors, which are then \ -cycled. The motion is very organic. Written by Jamie Zawinski.", -"*hacks.munch.documentation: \\n\ - DATAI 2 \\n\ - ADDB 1,2 \\n\ - ROTC 2,-22 \\n\ - XOR 1,2 \\n\ - JRST .-4 \\n\ - \\n\ -As reported by HAKMEM, in 1962, Jackson Wright wrote the above PDP-1 \ -code. That code still lives on in this screenhack, some 35 years \ -later. The number of lines of enclosing code has increased \ -substantially, however. This version is by Tim Showalter.", -"*hacks.fadeplot.name: FadePlot", -"*hacks.fadeplot.documentation: \ -Draws what looks like a waving ribbon following a sinusoidal path. \ -Written by Bas van Gaalen and Charles Vidal.", -"*hacks.coral.documentation: \ -Simulates coral growth, albeit somewhat slowly. This image doesn't \ -really do it justice. Written by Frederick Roeber.", -"*hacks.mountain.documentation: \ -Generates random 3d plots that look vaguely mountainous. Written by \ -Pascal Pensa.", -"*hacks.triangle.documentation: \ -Generates random mountain ranges using iterative subdivision of \ -triangles. Written by Tobias Gloth.", -"*hacks.worm.documentation: \ -An ancient xlock hack that draws multicolored worms that crawl around \ -the screen. Written by Brad Taylor, Dave Lemke, Boris Putanec, and \ -Henrik Theiling.", -"*hacks.rotor.documentation: \ -Another ancient xlock demo, this one by Tom Lawrence. It draws a \ -line segment moving along a complex spiraling curve. I tweaked this \ -to generate curvier lines, but still frames of it don't look like \ -much.", -"*hacks.ant.documentation: \ -A cellular automaton that is really a two-dimensional Turing machine: \ -as the heads (``ants'') walk along the screen, they change pixel \ -values in their path. Then, as they pass over changed pixels, their \ -behavior is influenced. Written by David Bagley.", -"*hacks.demon.documentation: \ -A cellular automaton that starts with a random field, and organizes \ -it into stripes and spirals. Written by David Bagley.", -"*hacks.loop.documentation: \ -This one produces loop-shaped colonies that spawn, age, and \ -eventually die. Written by David Bagley.", -"*hacks.vines.documentation: \ -This one generates a continuous sequence of small, curvy geometric \ -patterns. It scatters them around your screen until it fills up, \ -then it clears the screen and starts over. Written by Tracy Camp and \ -David Hansen.", -"*hacks.kaleidescope.documentation: \ -Another clone of an ancient meme, consisting largely of frenetic \ -rotational motion of colored lines. This one is by Ron Tapia. The \ -motion is nice, but I think it needs more solids, or perhaps just \ -brighter colors. More variations in the rotational speed might help, \ -too.", -"*hacks.xjack.documentation: \ -This program behaves schizophrenically and makes a lot of typos. \ -Written by Jamie Zawinski. If you haven't seen Stanley Kubrick's \ -masterpiece, ``The Shining,'' you won't get it. Those who have \ -describe this hack as ``inspired.''", -"*hacks.xlyap.documentation: \ -This generates pretty fractal pictures by doing funky math involving \ -the ``Lyapunov exponent.'' It has a cool interactive mode, too. \ -Written by Ron Record.", -"*hacks.cynosure.documentation: \ -A hack similar to `greynetic', but less frenetic. The first \ -implementation was by Stephen Linhart; then Ozymandias G. Desiderata \ -wrote a Java applet clone. That clone was discovered by Jamie \ -Zawinski, and ported to C for inclusion here.", -"*hacks.flow.documentation: \ -Another series of strange attractors: a flowing series of points, \ -making strange rotational shapes. Written by Jeff Butterworth.", -"*hacks.epicycle.documentation: \ -This program draws the path traced out by a point on the edge of a \ -circle. That circle rotates around a point on the rim of another \ -circle, and so on, several times. These were the basis for the \ -pre-heliocentric model of planetary motion. Written by James \ -Youngman.", -"*hacks.interference.documentation: \ -Another color-field hack, this one works by computing decaying \ -sinusoidal waves, and allowing them to interfere with each other as \ -their origins move. Written by Hannu Mallat.", -"*hacks.truchet.documentation: \ -This draws line- and arc-based Truchet patterns that tile the screen. \ -Written by Adrian Likins.", -"*hacks.bsod.name: BSOD", -"*hacks.bsod.documentation: \ -BSOD stands for ``Blue Screen of Death.'' The finest in personal \ -computer emulation, this hack simulates popular screen savers from a \ -number of less robust operating systems. Written by Jamie Zawinski.", -"*hacks.crystal.documentation: \ -Moving polygons, similar to a kaleidescope (more like a kaleidescope \ -than the hack called `kaleid,' actually.) This one by Jouk Jansen.", -"*hacks.discrete.documentation: \ -More ``discrete map'' systems, including new variants of Hopalong and \ -Julia, and a few others. Written by Tim Auckland.", -"*hacks.kumppa.documentation: \ -Spiraling, spinning, and very, very fast splashes of color rush \ -toward the screen. Written by Teemu Suutari.", -"*hacks.rd-bomb.name: RD-Bomb", -"*hacks.rd-bomb.documentation: \ -Another variation of the `Bomb' program by Scott Draves. This draws \ -a grid of growing square-like shapes that, once they overtake each \ -other, react in unpredictable ways. ``RD'' stands for \ -reaction-diffusion.", -"*hacks.sonar.documentation: \ -This program draws a simulation of a sonar screen. Written by \ -default, it displays a random assortment of ``bogies'' on the screen, \ -but if compiled properly, it can ping (pun intended) your local \ -network, and actually plot the proximity of the other hosts on your \ -network to you. It would be easy to make it monitor other sources of \ -data, too. (Processes? Active network connections? CPU usage per \ -user?) Written by Stephen Martin.", -"*hacks.t3d.name: T3D", -"*hacks.t3d.documentation: \ -This draws a working analog clock composed of floating, throbbing \ -bubbles. Written by Bernd Paysan.", -"*hacks.penetrate.documentation: \ -This hack simulates the classic arcade game Missile Command. Written \ -by Adam Miller.", -"*hacks.deluxe.documentation: \ -This draws a pulsing sequence of stars, circles, and lines. It would \ -look better if it was faster, but as far as I can tell, there is no \ -way to make this be both: fast, and flicker-free. Yet another reason \ -X sucks. Written by Jamie Zawinski.", -"*hacks.compass.documentation: \ -This draws a compass, with all elements spinning about randomly, for \ -that ``lost and nauseous'' feeling. Written by Jamie Zawinski.", -"*hacks.squiral.documentation: \ -Draws a set of interacting, square-spiral-producing automata. The \ -spirals grow outward until they hit something, then they go around \ -it. Written by Jeff Epler.", -"*hacks.xflame.documentation: \ -Draws a simulation of pulsing fire. It can also take an arbitrary \ -image and set it on fire too. Written by Carsten Haitzler, hacked on \ -by many others.", -"*hacks.wander.documentation: \ -Draws a colorful random-walk, in various forms. Written by Rick \ -Campbell.", -"*hacks.critical.documentation: \ -Draws a system of self-organizing lines. It starts out as random \ -squiggles, but after a few iterations, order begins to appear. \ -Written by Martin Pool.", -"*hacks.phosphor.documentation: \ -Draws a simulation of an old terminal, with large pixels and \ -long-sustain phosphor. It can run any program as a source of the text \ -it displays. Written by Jamie Zawinski.", -"*hacks.xmatrix.documentation: \ -A rendition of the text scrolls seen in the movie ``The Matrix.'' \ -Written by Jamie Zawinski.", -"*hacks.petri.documentation: \ -This simulates colonies of mold growing in a petri dish. Growing \ -colored circles overlap and leave spiral interference in their wake. \ -Written by Dan Bornstein.", -"*hacks.shadebobs.name: ShadeBobs", -"*hacks.shadebobs.documentation: \ -This draws smoothly-shaded oscilating oval patterns, that look \ -something like vapor trails or neon tubes. Written by Shane Smit.", -"*hacks.ccurve.name: C Curve", -"*hacks.ccurve.documentation: \ -Generates self-similar linear fractals, including the classic ``C \ -Curve.'' Written by Rick Campbell.", -"*hacks.blaster.documentation: \ -Draws a simulation of flying space-combat robots (cleverly disguised \ -as colored circles) doing battle in front of a moving star field. \ -Written by Jonathan Lin.", -"*hacks.bumps.documentation: \ -A bit like `Spotlight', except that instead of merely exposing part \ -of your desktop, it creates a bump map from it. Basically, it \ -3D-izes a roaming section of your desktop, based on color intensity. \ -Written by Shane Smit.", -"*hacks.xteevee.name: XTeeVee", -"*hacks.xteevee.documentation: \ -XTeeVee simulates various television problems, including static, \ -loss of vertical hold, and a test pattern. By Greg Knauss.", -"*hacks.xspirograph.name: XSpiroGraph", -"*hacks.xspirograph.documentation: \ -Simulates that pen-in-nested-plastic-gears toy from your childhood. \ -By Rohit Singh.", -"*hacks.nerverot.name: NerveRot", -"*hacks.nerverot.documentation: \ -Draws different shapes composed of nervously vibrating squiggles, \ -as if seen through a camera operated by a monkey on crack. \ -By Dan Bornstein.", -"*hacks.webcollage.name: WebCollage", -"*hacks.webcollage.documentation: \ -This program makes collages out of random images pulled off of the \ -World Wide Web. It finds these images by doing random web searches, \ -and then extracting images from the returned pages. It can also be \ -set up to filter the images through the `VidWhacker' program, above, \ -which looks really great. \ - \\n\\n\ -(Note that most of the images it finds are text, and not pictures. \ -This is because most of the web is pictures of text. Which is pretty \ -sad.) Written by Jamie Zawinski.", -"*hacks.vidwhacker.name: VidWhacker", -"*hacks.vidwhacker.documentation: \ -This is actually just a shell script that grabs a frame of video from \ -the system's video input, and then uses some PBM filters (chosen at \ -random) to manipulate and recombine the video frame in various ways \ -(edge detection, subtracting the image from a rotated version of \ -itself, etc.) Then it displays that image for a few seconds, and \ -does it again. This works really well if you just feed broadcast \ -television into it. \ - \\n\\n\ -Currently, the three lines of the script that actually grab the \ -source picture are SGI specific, but it should be trivial to adapt it \ -to work on other systems that can grab video (please send me the \ -changes if you do this...)", -"*hacks.rocks.documentation: \ -This draws an animation of flight through an asteroid field, with \ -changes in rotation and direction. It can also display 3D \ -separations for red/blue glasses! Mostly written by Jamie Zawinski.", -"*hacks.bubbles.documentation: \ -This simulates the kind of bubble formation that happens when water \ -boils:small bubbles appear, and as they get closer to each other, \ -they combine to form larger bubbles, which eventually pop. Written \ -by James Macnicol.", -"*hacks.gears.documentation: \ -This draws sets of turning, interlocking gears, rotating in three \ -dimensions. Another GL hack, by Danny Sung, Brian Paul, Ed Mackey, \ -and Jamie Zawinski.", -"*hacks.superquadrics.documentation: \ -Ed Mackey reports that he wrote the first version of this program in \ -BASIC on a Commodore 64 in 1987, as a 320x200 black and white \ -wireframe. Now it is GL and has specular reflections.", -"*hacks.morph3d.name: Morph3D", -"*hacks.morph3d.documentation: \ -Another 3d shape-changing GL hack, by Marcelo Vianna. It has the \ -same shiny-plastic feel as Superquadrics, as many computer-generated \ -objects do...", -"*hacks.cage.documentation: \ -This draws Escher's ``Impossible Cage,'' a 3d analog of a moebius \ -strip, and rotates it in three dimensions. Written by Marcelo \ -Vianna.", -"*hacks.moebius.documentation: \ -Another M. C. Escher hack by Marcelo Vianna, this one draws \ -``Moebius Strip II,'' a GL image of ants walking along the surface of \ -a moebius strip.", -"*hacks.stairs.documentation: \ -by Marcelo Vianna's third Escher GL hack, this one draws an \ -``infinite'' staircase.", -"*hacks.pipes.documentation: \ -If you've ever been in the same room with a Windows NT machine, \ -you've probably seen this GL hack. This version is by Marcelo \ -Vianna.", -"*hacks.sproingies.documentation: \ -Q-Bert meets Marble Madness! Written by Ed Mackey.", -"*hacks.rubik.documentation: \ -Draws a Rubik's Cube that rotates in three dimensions and repeatedly \ -shuffles and solves itself. Another fine GL hack by Marcelo Vianna.", -"*hacks.atlantis.documentation: \ -This is xfishtank writ large: a GL animation of a number of sharks, \ -dolphins, and whales. The swimming motions are great. Originally \ -written by Mark Kilgard.", -"*hacks.lament.documentation: \ -Animates a simulation of Lemarchand's Box, repeatedly solving itself. \ -Requires OpenGL, and a machine with fast hardware support for texture \ -maps. Warning: occasionally opens doors. Written by Jamie Zawinski.", -"*hacks.bubble3d.name: Bubble3D", -"*hacks.bubble3d.documentation: \ -Draws a stream of rising, undulating 3D bubbles, rising toward the \ -top of the screen, with nice specular reflections. Written by Richard \ -Jones.", -"*hacks.glplanet.name: GLPlanet", -"*hacks.glplanet.documentation: \ -Draws a planet bouncing around in space. Written by David Konerding. \ -The built-in image is a map of the earth (extracted from `xearth'), \ -but you can wrap any texture around the sphere, e.g., the planetary \ -textures that come with `ssystem'.", -"*hacks.pulsar.documentation: \ -Draws some intersecting planes, making use of alpha blending, fog, \ -textures, and mipmaps, plus a ``frames per second'' meter so that you \ -can tell how fast your graphics card is... Requires OpenGL. Written \ -by David Konerding.", -"*hacks.extrusion.documentation: \ -Draws various rotating extruded shapes that twist around, lengthen, \ -and turn inside out. Created by David Konerding from the samples \ -that come with the GL Extrusion library by Linas Vepstas.", -"*hacks.sierpinski3d.name: Sierpinski3D", -"*hacks.sierpinski3d.documentation: \ -This draws the three-dimensional variant of the recursive Sierpinski \ -triangle fractal, using GL. Written by Tim Robinson and Jamie Zawinski.", -"*hacks.ripples.documentation: \ -This draws rippling interference patterns like splashing water. \ -With the -water option, it manipulates your desktop image to look \ -like something is dripping into it. Written by Tom Hammersley.", -"*hacks.gflux.name: GFlux", -"*hacks.gflux.documentation: \ -Draws a rippling waves on a rotating wireframe grid, using GL. \ -Written by Josiah Pease.", -"*hacks.xrayswarm.name: XRaySwarm", -"*hacks.xrayswarm.documentation: \ -Draws a few swarms of critters flying around the screen, with nicely \ -faded color trails behind them. Written by Chris Leger.", -"*hacks.zoom.documentation: \ -Zooms in on a part of the screen and then moves around. With the \ --lenses option the result is like looking through many overlapping \ -lenses rather than just a simple zoom. Written by James Macnicol.", -"*hacks.whirlwindwarp.name: WhirlwindWarp", -"*hacks.whirlwindwarp.documentation: \ -Floating stars are acted upon by a mixture of simple 2D \ -forcefields. The strength of each forcefield changes \ -continuously, and it is also switched on and off at random. \ -By Paul 'Joey' Clark.", -"*hacks.rotzoomer.name: RotZoomer", -"*hacks.rotzoomer.documentation: \ -Creates a collage of rotated and scaled portions of the \ -screen. Written by Claudio Matsuoka.", -"*hacks.stonerview.name: StonerView", -"*hacks.stonerview.documentation: \ -Chains of colorful squares dance around each other in complex spiral \ -patterns. Written by Andrew Plotkin, based on SGI's `electropaint' \ -screensaver.", -"*hacks.starwars.name: StarWars", -"*hacks.starwars.documentation: \ -Draws a stream of text slowly scrolling into the distance at an \ -angle, over a star field, like at the beginning of the movie of the \ -same name. Written by Jamie Zawinski and Claudio Matauoka.", -"*hacks.gltext.name: GLText", -"*hacks.gltext.documentation: \ -Displays a few lines of text spinning around in a solid 3D font. \ -Written by Jamie Zawinski.", -"*hacks.molecule.documentation: \ -Draws several different representations of molecules. Some common \ -molecules are built in, and it can also read PDB (Protein Data Base) \ -files as input. Written by Jamie Zawinski.", -"*hacks.dangerball.name: DangerBall", -"*hacks.dangerball.documentation: \ -Draws a ball that periodically extrudes many random spikes. Ouch! \ -Written by Jamie Zawinski.", -"*hacks.whirlygig.name: WhirlyGig", -"*hacks.whirlygig.documentation: \ -Draws zooming chains of sinusoidal spots. Written by Ashton Trey Belew.", -"*hacks.speedmine.name: SpeedMine", -"*hacks.speedmine.documentation: \ -Simulates speeding down a rocky mineshaft, or a funky dancing worm. \ -Written by Conrad Parker.", -"*hacks.circuit.documentation: \ -Animates a number of 3D electronic components. Written by Ben Buxton.", -"*hacks.vermiculate.documentation: \ -Draws squiggly worm-like paths. Written by Tyler Pierce.", -"*hacks.xdaliclock.name: XDaliClock", -"*hacks.xdaliclock.documentation: \ -XDaliClock draws a large digital clock, the numbers of which change by \ -``melting'' into their new shapes. Written by Jamie Zawinski. This \ -is not included with the XScreenSaver package, but if you don't have \ -it already, you can find it at .", -"*hacks.xearth.documentation: \ -XEarth draws an image of the Earth, as seen from your favorite vantage \ -point in space, correctly shaded for the current position of the Sun. \ -Written by Kirk Johnson. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -.", -"*hacks.xplanetbg.name: XPlanet", -"*hacks.xplanetbg.documentation: \ -XPlanet is like XEarth, but with more options. It draws an image of \ -the Earth (or other planets!), as seen from your favorite vantage \ -point in space, correctly shaded for the current position of the Sun. \ -Written by Hari Nair. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -.", -"*hacks.ssystem.name: SSystem", -"*hacks.ssystem.documentation: \ -SSystem is a GL Solar System simulator. It simulates flybys of Sun, \ -the nine planets and a few major satellites, with four camera modes. \ -Written by Raul Alonso. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -.", -"*hacks.xmountains.documentation: \ -XMountains generates realistic-looking fractal terrains of snow-capped \ -mountains near water, with either a top view or a side view. \ -Written by Stephen Booth. This is not included with the XScreenSaver \ -package, but if you don't have it already, you can find it at \ -. \ - \\n\\n\ -Be sure to compile it with -DVROOT or it won't work right when launched \ -by the xscreensaver daemon.", -"*hacks.xaos.name: XaoS", -"*hacks.xaos.documentation: \ -XaoS generates fast fly-through animations of the Mandelbrot and other \ -fractal sets. Written by Thomas Marsh and Jan Hubicka. This is not \ -included with the XScreenSaver package, but if you don't have it \ -already, you can find it at .", -"*hacks.xfishtank.name: XFishTank", -"*hacks.xfishtank.documentation: \ -Fish! This is not included with the XScreenSaver package, but if you \ -don't have it already, you can find it at \ -.", -"*hacks.xsnow.documentation: \ -Draws falling snow and the occasional tiny Santa. By Rick Jansen. \ -You can find it at .", -"*hacks.goban.documentation: \ -Replays historical games of go (aka wei-chi and baduk) on the screen. \ -By Scott Draves. You can find it at .", -"*hacks.electricsheep.name: ElectricSheep", -"*hacks.electricsheep.documentation: \ -ElectricSheep is an xscreensaver module that displays mpeg video of \ -an animated fractal flame. In the background, it contributes render \ -cycles to the next animation. Periodically it uploades completed \ -frames to the server, where they are compressed for distribution to \ -all clients. \ - \\n\\n\ -This program is recommended only if you have a high bandwidth \ -connection to the Internet. \ - \\n\\n\ -By Scott Draves. You can find it at . \ -See that web site for configuration information.", -"*hacks.cosmos.documentation: \ -Draws fireworks and zooming, fading flares. By Tom Campbell. \ -You can find it at .", +"*hacks.imsmap.name: IMSmap", +"*hacks.slidescreen.name: SlideScreen", +"*hacks.decayscreen.name: DecayScreen", +"*hacks.blitspin.name: BlitSpin", +"*hacks.lmorph.name: LMorph", +"*hacks.ifs.name: IFS", +"*hacks.fadeplot.name: FadePlot", +"*hacks.bsod.name: BSOD", +"*hacks.rd-bomb.name: RD-Bomb", +"*hacks.t3d.name: T3D", +"*hacks.shadebobs.name: ShadeBobs", +"*hacks.ccurve.name: C Curve", +"*hacks.xteevee.name: XTeeVee", +"*hacks.xspirograph.name: XSpiroGraph", +"*hacks.nerverot.name: NerveRot", +"*hacks.webcollage.name: WebCollage", +"*hacks.vidwhacker.name: VidWhacker", +"*hacks.morph3d.name: Morph3D", +"*hacks.bubble3d.name: Bubble3D", +"*hacks.glplanet.name: GLPlanet", +"*hacks.sierpinski3d.name: Sierpinski3D", +"*hacks.gflux.name: GFlux", +"*hacks.xrayswarm.name: XRaySwarm", +"*hacks.whirlwindwarp.name: WhirlwindWarp", +"*hacks.rotzoomer.name: RotZoomer", +"*hacks.stonerview.name: StonerView", +"*hacks.starwars.name: StarWars", +"*hacks.gltext.name: GLText", +"*hacks.dangerball.name: DangerBall", +"*hacks.whirlygig.name: WhirlyGig", +"*hacks.speedmine.name: SpeedMine", +"*hacks.xdaliclock.name: XDaliClock", +"*hacks.xplanetbg.name: XPlanet", +"*hacks.ssystem.name: SSystem", +"*hacks.xaos.name: XaoS", +"*hacks.xfishtank.name: XFishTank", +"*hacks.electricsheep.name: ElectricSheep", "*hacks.sphereEversion.name: SphereEversion", -"*hacks.sphereEversion.documentation: \ -SphereEversion draws an animation of a sphere being turned inside out. \ -A sphere can be turned inside out, without any tears, sharp creases or \ -discontinuities, if the surface of the sphere is allowed to intersect \ -itself. This program animates what is known as the Thurston Eversion. \ -Written by Nathaniel Thurston and Michael McGuffin. This program is \ -not included with the XScreenSaver package, but if you don't have it \ -already, you can find it at .", +"*hacks.documentation.isInstalled: True", diff --git a/driver/demo-Gtk-conf.c b/driver/demo-Gtk-conf.c new file mode 100644 index 00000000..b8bb1ee6 --- /dev/null +++ b/driver/demo-Gtk-conf.c @@ -0,0 +1,1853 @@ +/* demo-Gtk-conf.c --- implements the dynamic configuration dialogs. + * xscreensaver, Copyright (c) 2001 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if defined(HAVE_GTK) && defined(HAVE_XML) /* whole file */ + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include +#include + +#include /* XML */ + +#include + +#include "demo-Gtk-conf.h" + +extern const char *blurb (void); + + +static gboolean debug_p = FALSE; + + +typedef enum { + COMMAND, + FAKE, + DESCRIPTION, + FAKEPREVIEW, + STRING, + FILENAME, + SLIDER, + SPINBUTTON, + BOOLEAN, + SELECT, + SELECT_OPTION +} parameter_type; + + +typedef struct { + + parameter_type type; + + char *id; /* widget name */ + char *label; /* heading label, or null */ + + /* command, fake, description, fakepreview, string, file + */ + char *string; /* file name, description, whatever. */ + + /* slider, spinbutton + */ + char *low_label; /* label for the left side */ + char *high_label; /* label for the right side */ + float low; /* minimum value */ + float high; /* maximum value */ + float value; /* default value */ + gboolean integer_p; /* whether the range is integral, or real */ + char *arg; /* command-line option to set (substitute "%") */ + gboolean invert_p; /* whether to flip the value and pretend the + range goes from hi-low instead of low-hi. */ + + /* boolean, select-option + */ + char *arg_set; /* command-line option to set for "yes", or null */ + char *arg_unset; /* command-line option to set for "no", or null */ + char *test; /* #### no idea - enablement? */ + + /* select + */ + GList *options; + + /* select_option + */ + GList *enable; + + GtkWidget *widget; + +} parameter; + + +static parameter *make_select_option (const char *file, xmlNodePtr); +static void make_parameter_widget (const char *filename, + parameter *, GtkWidget *, int *); +static void browse_button_cb (GtkButton *button, gpointer user_data); + + +/* Frees the parameter object and all strings and sub-parameters. + Does not destroy the widget, if any. + */ +static void +free_parameter (parameter *p) +{ + GList *rest; + if (p->id) free (p->id); + if (p->label) free (p->label); + if (p->string) free (p->string); + if (p->low_label) free (p->low_label); + if (p->high_label) free (p->high_label); + if (p->arg) free (p->arg); + if (p->arg_set) free (p->arg_set); + if (p->arg_unset) free (p->arg_unset); + if (p->test) free (p->test); + + for (rest = p->options; rest; rest = rest->next) + if (rest->data) + free_parameter ((parameter *) rest->data); + + for (rest = p->enable; rest; rest = rest->next) + { + free ((char *) rest->data); + rest->data = 0; + } + if (p->enable) g_list_free (p->enable); + + memset (p, ~0, sizeof(*p)); + free (p); +} + + +/* Debugging: dumps out a `parameter' structure. + */ +#if 0 +void +describe_parameter (FILE *out, parameter *p) +{ + fprintf (out, "<"); + switch (p->type) + { + case COMMAND: fprintf (out, "command"); break; + case FAKE: fprintf (out, "fake"); break; + case DESCRIPTION: fprintf (out, "_description"); break; + case FAKEPREVIEW: fprintf (out, "fakepreview"); break; + case STRING: fprintf (out, "string"); break; + case FILENAME: fprintf (out, "filename"); break; + case SLIDER: fprintf (out, "number type=\"slider\""); break; + case SPINBUTTON: fprintf (out, "number type=\"spinbutton\""); break; + case BOOLEAN: fprintf (out, "boolean"); break; + case SELECT: fprintf (out, "select"); break; + default: abort(); break; + } + if (p->id) fprintf (out, " id=\"%s\"", p->id); + if (p->label) fprintf (out, " _label=\"%s\"", p->label); + if (p->string && p->type != DESCRIPTION) + fprintf (out, " string=\"%s\"", p->string); + if (p->low_label) fprintf (out, " _low-label=\"%s\"", p->low_label); + if (p->high_label) fprintf (out, " _high-label=\"%s\"", p->high_label); + if (p->low) fprintf (out, " low=\"%.2f\"", p->low); + if (p->high) fprintf (out, " high=\"%.2f\"", p->high); + if (p->value) fprintf (out, " default=\"%.2f\"", p->value); + if (p->arg) fprintf (out, " arg=\"%s\"", p->arg); + if (p->invert_p) fprintf (out, " convert=\"invert\""); + if (p->arg_set) fprintf (out, " arg-set=\"%s\"", p->arg_set); + if (p->arg_unset) fprintf (out, " arg-unset=\"%s\"", p->arg_unset); + if (p->test) fprintf (out, " test=\"%s\"", p->test); + fprintf (out, ">\n"); + + if (p->type == SELECT) + { + GList *opt; + for (opt = p->options; opt; opt = opt->next) + { + parameter *o = (parameter *) opt->data; + if (o->type != SELECT_OPTION) abort(); + fprintf (out, " id) fprintf (out, " id=\"%s\"", o->id); + if (o->label) fprintf (out, " _label=\"%s\"", o->label); + if (o->arg_set) fprintf (out, " arg-set=\"%s\"", o->arg_set); + if (o->arg_unset) fprintf (out, " arg-unset=\"%s\"", o->arg_unset); + if (o->test) fprintf (out, " test=\"%s\"", o->test); + if (o->enable) + { + GList *e; + fprintf (out, " enable=\""); + for (e = o->enable; e; e = e->next) + fprintf (out, "%s%s", (char *) e->data, (e->next ? "," : "")); + fprintf (out, "\""); + } + fprintf (out, ">\n"); + } + fprintf (out, "\n"); + } + else if (p->type == DESCRIPTION) + { + if (p->string) + fprintf (out, " %s\n", p->string); + fprintf (out, "\n"); + } +} +#endif /* 0 */ + + +/* Like xmlGetProp() but parses a float out of the string. + If the number was expressed as a float and not an integer + (that is, the string contained a decimal point) then + `floatp' is set to TRUE. Otherwise, it is unchanged. + */ +static float +xml_get_float (xmlNodePtr node, const char *name, gboolean *floatpP) +{ + const char *s = xmlGetProp (node, name); + float f; + char c; + if (!s || 1 != sscanf (s, "%f %c", &f, &c)) + return 0; + else + { + if (strchr (s, '.')) *floatpP = TRUE; + return f; + } +} + + +static void sanity_check_parameter (const char *filename, + const char *node_name, + parameter *p); + +/* Allocates and returns a new `parameter' object based on the + properties in the given XML node. Returns 0 if there's nothing + to create (comment, or unknown tag.) + */ +static parameter * +make_parameter (const char *filename, xmlNodePtr node) +{ + parameter *p; + const char *name = node->name; + const char *convert; + gboolean floatp = FALSE; + + if (node->type == XML_COMMENT_NODE) + return 0; + + p = calloc (1, sizeof(*p)); + + if (!name) abort(); + else if (!strcmp (name, "command")) p->type = COMMAND; + else if (!strcmp (name, "fullcommand")) p->type = COMMAND; + else if (!strcmp (name, "_description")) p->type = DESCRIPTION; + else if (!strcmp (name, "fakepreview")) p->type = FAKEPREVIEW; + else if (!strcmp (name, "fake")) p->type = FAKE; + else if (!strcmp (name, "boolean")) p->type = BOOLEAN; + else if (!strcmp (name, "string")) p->type = STRING; + else if (!strcmp (name, "file")) p->type = FILENAME; + else if (!strcmp (name, "number")) p->type = SPINBUTTON; + else if (!strcmp (name, "select")) p->type = SELECT; + else + { + if (debug_p) + fprintf (stderr, "%s: WARNING: %s: unknown tag: \"%s\"\n", + blurb(), filename, name); + free (p); + return 0; + } + + if (p->type == SPINBUTTON) + { + const char *type = xmlGetProp (node, "type"); + if (!type || !strcmp (type, "spinbutton")) p->type = SPINBUTTON; + else if (!strcmp (type, "slider")) p->type = SLIDER; + else + { + if (debug_p) + fprintf (stderr, "%s: WARNING: %s: unknown %s type: \"%s\"\n", + blurb(), filename, name, type); + free (p); + return 0; + } + } + else if (p->type == DESCRIPTION) + { + if (node->childs && + node->childs->type == XML_TEXT_NODE && + !node->childs->next) + p->string = strdup (node->childs->content); + } + + p->id = xmlGetProp (node, "id"); + p->label = xmlGetProp (node, "_label"); + p->low_label = xmlGetProp (node, "_low-label"); + p->high_label = xmlGetProp (node, "_high-label"); + p->low = xml_get_float (node, "low", &floatp); + p->high = xml_get_float (node, "high", &floatp); + p->value = xml_get_float (node, "default", &floatp); + p->integer_p = !floatp; + convert = xmlGetProp (node, "convert"); + p->invert_p = (convert && !strcmp (convert, "invert")); + p->arg = xmlGetProp (node, "arg"); + p->arg_set = xmlGetProp (node, "arg-set"); + p->arg_unset = xmlGetProp (node, "arg-unset"); + p->test = xmlGetProp (node, "test"); + + /* Check for missing decimal point */ + if (debug_p && + p->integer_p && + (p->high != p->low) && + (p->high - p->low) <= 1) + fprintf (stderr, + "%s: WARNING: %s: %s: range [%.1f, %.1f] shouldn't be integral!\n", + blurb(), filename, p->id, + p->low, p->high); + + if (p->type == SELECT) + { + xmlNodePtr kids; + for (kids = node->childs; kids; kids = kids->next) + { + parameter *s = make_select_option (filename, kids); + if (s) + p->options = g_list_append (p->options, s); + } + } + + sanity_check_parameter (filename, name, p); + + return p; +} + + +/* Allocates and returns a new SELECT_OPTION `parameter' object based + on the properties in the given XML node. Returns 0 if there's nothing + to create (comment, or unknown tag.) + */ +static parameter * +make_select_option (const char *filename, xmlNodePtr node) +{ + if (node->type == XML_COMMENT_NODE) + return 0; + else if (node->type != XML_ELEMENT_NODE) + { + if (debug_p) + fprintf (stderr, + "%s: WARNING: %s: %s: unexpected child tag type %d\n", + blurb(), filename, node->name, (int)node->type); + return 0; + } + else if (strcmp (node->name, "option")) + { + if (debug_p) + fprintf (stderr, + "%s: WARNING: %s: %s: child not an option tag: \"%s\"\n", + blurb(), filename, node->name, node->name); + return 0; + } + else + { + parameter *s = calloc (1, sizeof(*s)); + char *enable, *e; + + s->type = SELECT_OPTION; + s->id = xmlGetProp (node, "id"); + s->label = xmlGetProp (node, "_label"); + s->arg_set = xmlGetProp (node, "arg-set"); + s->arg_unset = xmlGetProp (node, "arg-unset"); + s->test = xmlGetProp (node, "test"); + enable = xmlGetProp (node, "enable"); + + if (enable) + { + enable = strdup (enable); + e = strtok (enable, ", "); + while (e) + { + s->enable = g_list_append (s->enable, strdup (e)); + e = strtok (0, ", "); + } + free (enable); + } + + sanity_check_parameter (filename, node->name, s); + return s; + } +} + + +/* Rudimentary check to make sure someone hasn't typed "arg-set=" + when they should have typed "arg=", etc. + */ +static void +sanity_check_parameter (const char *filename, const char *node_name, + parameter *p) +{ + struct { + gboolean id; + gboolean label; + gboolean string; + gboolean low_label; + gboolean high_label; + gboolean low; + gboolean high; + gboolean value; + gboolean arg; + gboolean invert_p; + gboolean arg_set; + gboolean arg_unset; + } allowed, require; + + memset (&allowed, 0, sizeof (allowed)); + memset (&require, 0, sizeof (require)); + + switch (p->type) + { + case COMMAND: + allowed.arg = TRUE; + require.arg = TRUE; + break; + case FAKE: + break; + case DESCRIPTION: + allowed.string = TRUE; + break; + case FAKEPREVIEW: + break; + case STRING: + allowed.id = TRUE; + require.id = TRUE; + allowed.label = TRUE; + require.label = TRUE; + allowed.arg = TRUE; + require.arg = TRUE; + break; + case FILENAME: + allowed.id = TRUE; + require.id = TRUE; + allowed.label = TRUE; + allowed.arg = TRUE; + require.arg = TRUE; + break; + case SLIDER: + allowed.id = TRUE; + require.id = TRUE; + allowed.label = TRUE; + allowed.low_label = TRUE; + allowed.high_label = TRUE; + allowed.arg = TRUE; + require.arg = TRUE; + allowed.low = TRUE; + /* require.low = TRUE; -- may be 0 */ + allowed.high = TRUE; + /* require.high = TRUE; -- may be 0 */ + allowed.value = TRUE; + /* require.value = TRUE; -- may be 0 */ + allowed.invert_p = TRUE; + break; + case SPINBUTTON: + allowed.id = TRUE; + require.id = TRUE; + allowed.label = TRUE; + allowed.arg = TRUE; + require.arg = TRUE; + allowed.low = TRUE; + /* require.low = TRUE; -- may be 0 */ + allowed.high = TRUE; + /* require.high = TRUE; -- may be 0 */ + allowed.value = TRUE; + /* require.value = TRUE; -- may be 0 */ + allowed.invert_p = TRUE; + break; + case BOOLEAN: + allowed.id = TRUE; + require.id = TRUE; + allowed.label = TRUE; + allowed.arg_set = TRUE; + allowed.arg_unset = TRUE; + break; + case SELECT: + allowed.id = TRUE; + require.id = TRUE; + break; + case SELECT_OPTION: + allowed.id = TRUE; + allowed.label = TRUE; + require.label = TRUE; + allowed.arg_set = TRUE; + break; + default: + abort(); + break; + } + +# define WARN(STR) \ + fprintf (stderr, "%s: %s: " STR " in <%s%s id=\"%s\">\n", \ + blurb(), filename, node_name, \ + (!strcmp(node_name, "number") \ + ? (p->type == SPINBUTTON ? " type=spinbutton" : " type=slider")\ + : ""), \ + (p->id ? p->id : "")) +# define CHECK(SLOT,NAME) \ + if (p->SLOT && !allowed.SLOT) \ + WARN ("\"" NAME "\" is not a valid option"); \ + if (!p->SLOT && require.SLOT) \ + WARN ("\"" NAME "\" is required") + + CHECK (id, "id"); + CHECK (label, "_label"); + CHECK (string, "(body text)"); + CHECK (low_label, "_low-label"); + CHECK (high_label, "_high-label"); + CHECK (low, "low"); + CHECK (high, "high"); + CHECK (value, "default"); + CHECK (arg, "arg"); + CHECK (invert_p, "convert"); + CHECK (arg_set, "arg-set"); + CHECK (arg_unset, "arg-unset"); +# undef CHECK +# undef WARN +} + + + +/* Helper for make_parameters() + */ +static GList * +make_parameters_1 (const char *filename, xmlNodePtr node, + GtkWidget *parent, int *row) +{ + GList *list = 0; + + for (; node; node = node->next) + { + const char *name = node->name; + if (!strcmp (name, "hgroup") || + !strcmp (name, "vgroup")) + { + GtkWidget *box = (*name == 'h' + ? gtk_hbox_new (FALSE, 0) + : gtk_vbox_new (FALSE, 0)); + GList *list2; + gtk_widget_show (box); + + if (row) + gtk_table_attach (GTK_TABLE (parent), box, 0, 3, *row, *row + 1, + 0, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), box, FALSE, FALSE, 0); + + if (row) + (*row)++; + + list2 = make_parameters_1 (filename, node->childs, box, 0); + if (list2) + list = g_list_concat (list, list2); + } + else + { + parameter *p = make_parameter (filename, node); + if (p) + { + list = g_list_append (list, p); + make_parameter_widget (filename, p, parent, row); + } + } + } + return list; +} + + +/* Calls make_parameter() and make_parameter_widget() on each relevant + tag in the XML tree. Also handles the "hgroup" and "vgroup" flags. + Returns a GList of `parameter' objects. + */ +static GList * +make_parameters (const char *filename, xmlNodePtr node, GtkWidget *parent) +{ + int row = 0; + for (; node; node = node->next) + { + if (node->type == XML_ELEMENT_NODE && + !strcmp (node->name, "screensaver")) + return make_parameters_1 (filename, node->childs, parent, &row); + } + return 0; +} + + +static gfloat +invert_range (gfloat low, gfloat high, gfloat value) +{ + gfloat range = high-low; + gfloat off = value-low; + return (low + (range - off)); +} + + +static GtkAdjustment * +make_adjustment (const char *filename, parameter *p) +{ + float range = (p->high - p->low); + float value = (p->invert_p + ? invert_range (p->low, p->high, p->value) + : p->value); + gfloat si = (p->high - p->low) / 100; + gfloat pi = (p->high - p->low) / 10; + + if (p->value < p->low || p->value > p->high) + { + if (debug_p && p->integer_p) + fprintf (stderr, "%s: WARNING: %s: %d is not in range [%d, %d]\n", + blurb(), filename, + (int) p->value, (int) p->low, (int) p->high); + else if (debug_p) + fprintf (stderr, + "%s: WARNING: %s: %.2f is not in range [%.2f, %.2f]\n", + blurb(), filename, p->value, p->low, p->high); + value = (value < p->low ? p->low : p->high); + } +#if 0 + else if (debug_p && p->value < 1000 && p->high >= 10000) + { + if (p->integer_p) + fprintf (stderr, + "%s: WARNING: %s: %d is suspicious for range [%d, %d]\n", + blurb(), filename, + (int) p->value, (int) p->low, (int) p->high); + else + fprintf (stderr, + "%s: WARNING: %s: %.2f is suspicious for range [%.2f, %.2f]\n", + blurb(), filename, p->value, p->low, p->high); + } +#endif /* 0 */ + + if (p->integer_p) + { + si = (int) (si + 0.5); + pi = (int) (pi + 0.5); + if (si < 1) si = 1; + if (pi < 1) pi = 1; + + if (range <= 500) si = 1; + } + return GTK_ADJUSTMENT (gtk_adjustment_new (value, p->low, p->high, + si, pi, pi)); +} + + + +/* Given a `parameter' struct, allocates an appropriate GtkWidget for it, + and stores it in `p->widget'. + `row' is used for keeping track of our position during table layout. + `parent' must be a GtkTable or a GtkBox. + */ +static void +make_parameter_widget (const char *filename, + parameter *p, GtkWidget *parent, int *row) +{ + const char *label = p->label; + if (p->widget) return; + + switch (p->type) + { + case STRING: + { + if (label) + { + GtkWidget *w = gtk_label_new (label); + gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); + gtk_widget_show (w); + if (row) + gtk_table_attach (GTK_TABLE (parent), w, 0, 1, *row, *row + 1, + GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); + } + + p->widget = gtk_entry_new (); + if (p->string) + gtk_entry_set_text (GTK_ENTRY (p->widget), p->string); + if (row) + gtk_table_attach (GTK_TABLE (parent), p->widget, 1, 3, + *row, *row + 1, + GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), p->widget, FALSE, FALSE, 4); + break; + } + case FILENAME: + { + GtkWidget *L = gtk_label_new (label ? label : ""); + GtkWidget *entry = gtk_entry_new (); + GtkWidget *button = gtk_button_new_with_label ("Browse..."); + gtk_widget_show (entry); + gtk_widget_show (button); + p->widget = entry; + + gtk_signal_connect (GTK_OBJECT (button), + "clicked", GTK_SIGNAL_FUNC (browse_button_cb), + (gpointer) entry); + + gtk_label_set_justify (GTK_LABEL (L), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (L), 1.0, 0.5); + gtk_widget_show (L); + + if (p->string) + gtk_entry_set_text (GTK_ENTRY (entry), p->string); + + if (row) + { + gtk_table_attach (GTK_TABLE (parent), L, 0, 1, + *row, *row + 1, + GTK_FILL, 0, 0, 0); + gtk_table_attach (GTK_TABLE (parent), entry, 1, 2, + *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtk_table_attach (GTK_TABLE (parent), button, 2, 3, + *row, *row + 1, + 0, 0, 0, 0); + } + else + { + gtk_box_pack_start (GTK_BOX (parent), L, FALSE, FALSE, 4); + gtk_box_pack_start (GTK_BOX (parent), entry, TRUE, TRUE, 4); + gtk_box_pack_start (GTK_BOX (parent), button, FALSE, FALSE, 4); + } + break; + } + case SLIDER: + { + GtkAdjustment *adj = make_adjustment (filename, p); + GtkWidget *scale = gtk_hscale_new (adj); + GtkWidget *labelw = 0; + + if (label) + { + labelw = gtk_label_new (label); + gtk_label_set_justify (GTK_LABEL (labelw), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (labelw), 0.0, 0.5); + gtk_widget_show (labelw); + } + + if (GTK_IS_VBOX (parent)) + { + /* If we're inside a vbox, we need to put an hbox in it, to get + the low/high labels to be to the left/right of the slider. + */ + GtkWidget *hbox = gtk_hbox_new (FALSE, 0); + + /* But if we have a label, put that above the slider's hbox. */ + if (labelw) + { + gtk_box_pack_start (GTK_BOX (parent), labelw, FALSE, TRUE, 2); + labelw = 0; + } + + gtk_box_pack_start (GTK_BOX (parent), hbox, TRUE, TRUE, 6); + gtk_widget_show (hbox); + parent = hbox; + } + + if (labelw) + { + if (row) + { + gtk_table_attach (GTK_TABLE (parent), labelw, + 0, 3, *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + (*row)++; + } + else + { + if (GTK_IS_HBOX (parent)) + { + GtkWidget *box = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (parent), box, FALSE, TRUE, 0); + gtk_widget_show (box); + gtk_box_pack_start (GTK_BOX (box), labelw, FALSE, TRUE, 4); + parent = box; + box = gtk_hbox_new (FALSE, 0); + gtk_widget_show (box); + gtk_box_pack_start (GTK_BOX (parent), box, TRUE, TRUE, 0); + parent = box; + } + else + gtk_box_pack_start (GTK_BOX (parent), labelw, + FALSE, TRUE, 0); + } + } + + if (p->low_label) + { + GtkWidget *w = gtk_label_new (p->low_label); + gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); + gtk_widget_show (w); + if (row) + gtk_table_attach (GTK_TABLE (parent), w, 0, 1, *row, *row + 1, + GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); + } + + gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_BOTTOM); + gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE); + gtk_scale_set_digits (GTK_SCALE (scale), (p->integer_p ? 0 : 2)); + if (row) + gtk_table_attach (GTK_TABLE (parent), scale, 1, 2, + *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), scale, TRUE, TRUE, 4); + + gtk_widget_show (scale); + + if (p->high_label) + { + GtkWidget *w = gtk_label_new (p->high_label); + gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); + gtk_widget_show (w); + if (row) + gtk_table_attach (GTK_TABLE (parent), w, 2, 3, *row, *row + 1, + GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); + } + + p->widget = scale; + break; + } + case SPINBUTTON: + { + GtkAdjustment *adj = make_adjustment (filename, p); + GtkWidget *spin = gtk_spin_button_new (adj, 15, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (spin), TRUE); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), adj->value); + + if (label) + { + GtkWidget *w = gtk_label_new (label); + gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); + gtk_widget_show (w); + if (row) + gtk_table_attach (GTK_TABLE (parent), w, 0, 1, *row, *row + 1, + GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), w, TRUE, TRUE, 4); + } + + gtk_widget_show (spin); + if (row) + { + GtkWidget *hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox); + gtk_table_attach (GTK_TABLE (parent), hbox, 1, 3, + *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 8, 0); + gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0); + } + else + gtk_box_pack_start (GTK_BOX (parent), spin, FALSE, FALSE, 4); + + p->widget = spin; + break; + } + case BOOLEAN: + { + p->widget = gtk_check_button_new_with_label (label); + if (row) + gtk_table_attach (GTK_TABLE (parent), p->widget, 0, 3, + *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), p->widget, FALSE, FALSE, 4); + break; + } + case SELECT: + { + GtkWidget *opt = gtk_option_menu_new (); + GtkWidget *menu = gtk_menu_new (); + GList *opts; + + if (label && row) + { + GtkWidget *w = gtk_label_new (label); + gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); + gtk_widget_show (w); + gtk_table_attach (GTK_TABLE (parent), w, 0, 3, *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + (*row)++; + } + + for (opts = p->options; opts; opts = opts->next) + { + parameter *s = (parameter *) opts->data; + GtkWidget *i = gtk_menu_item_new_with_label (s->label); + gtk_widget_show (i); + gtk_menu_append (GTK_MENU (menu), i); + } + + gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); + p->widget = opt; + if (row) + gtk_table_attach (GTK_TABLE (parent), p->widget, 0, 3, + *row, *row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + else + gtk_box_pack_start (GTK_BOX (parent), p->widget, TRUE, TRUE, 4); + break; + } + + case COMMAND: + case FAKE: + case DESCRIPTION: + case FAKEPREVIEW: + break; + default: + abort(); + } + + if (p->widget) + { + gtk_widget_set_name (p->widget, p->id); + gtk_widget_show (p->widget); + if (row) + (*row)++; + } +} + + +/* File selection. + Absurdly, there is no GTK file entry widget, only a GNOME one, + so in order to avoid depending on GNOME in this code, we have + to do it ourselves. + */ + +/* cancel button on GtkFileSelection: user_data unused */ +static void +file_sel_cancel (GtkWidget *button, gpointer user_data) +{ + GtkWidget *dialog = button; + while (dialog->parent) + dialog = dialog->parent; + gtk_widget_destroy (dialog); +} + +/* ok button on GtkFileSelection: user_data is the corresponding GtkEntry */ +static void +file_sel_ok (GtkWidget *button, gpointer user_data) +{ + GtkWidget *entry = GTK_WIDGET (user_data); + GtkWidget *dialog = button; + char *path; + while (dialog->parent) + dialog = dialog->parent; + gtk_widget_hide (dialog); + + path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog)); + /* apparently one doesn't free `path' */ + + gtk_entry_set_text (GTK_ENTRY (entry), path); + gtk_entry_set_position (GTK_ENTRY (entry), strlen (path)); + + gtk_widget_destroy (dialog); +} + +/* WM close on GtkFileSelection: user_data unused */ +static void +file_sel_close (GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + file_sel_cancel (widget, user_data); +} + +/* "Browse" button: user_data is the corresponding GtkEntry */ +static void +browse_button_cb (GtkButton *button, gpointer user_data) +{ + GtkWidget *entry = GTK_WIDGET (user_data); + char *text = gtk_entry_get_text (GTK_ENTRY (entry)); + GtkFileSelection *selector = + GTK_FILE_SELECTION (gtk_file_selection_new ("Select file.")); + + gtk_file_selection_set_filename (selector, text); + gtk_signal_connect (GTK_OBJECT (selector->ok_button), + "clicked", GTK_SIGNAL_FUNC (file_sel_ok), + (gpointer) entry); + gtk_signal_connect (GTK_OBJECT (selector->cancel_button), + "clicked", GTK_SIGNAL_FUNC (file_sel_cancel), + (gpointer) entry); + gtk_signal_connect (GTK_OBJECT (selector), "delete_event", + GTK_SIGNAL_FUNC (file_sel_close), + (gpointer) entry); + + gtk_window_set_modal (GTK_WINDOW (selector), TRUE); + gtk_widget_show (GTK_WIDGET (selector)); +} + + +/* Converting to and from command-lines + */ + + +/* Returns a copy of string that has been quoted according to shell rules: + it may have been wrapped in "" and had some characters backslashed; or + it may be unchanged. + */ +static char * +shell_quotify (const char *string) +{ + char *string2 = (char *) malloc ((strlen (string) * 2) + 10); + const char *in; + char *out; + int need_quotes = 0; + int in_length = 0; + + out = string2; + *out++ = '"'; + for (in = string; *in; in++) + { + in_length++; + if (*in == '!' || + *in == '"' || + *in == '$') + { + need_quotes = 1; + *out++ = '\\'; + *out++ = *in; + } + else if (*in <= ' ' || + *in >= 127 || + *in == '\'' || + *in == '#' || + *in == '%' || + *in == '&' || + *in == '(' || + *in == ')' || + *in == '*') + { + need_quotes = 1; + *out++ = *in; + } + else + *out++ = *in; + } + *out++ = '"'; + *out = 0; + + if (in_length == 0) + need_quotes = 1; + + if (need_quotes) + return (string2); + + free (string2); + return strdup (string); +} + +/* Modify the string in place to remove wrapping double-quotes + and interior backslashes. + */ +static void +de_stringify (char *s) +{ + char q = s[0]; + if (q != '\'' && q != '\"' && q != '`') + abort(); + memmove (s, s+1, strlen (s)+1); + while (*s && *s != q) + { + if (*s == '\\') + memmove (s, s+1, strlen (s)+1); + s++; + } + if (*s != q) abort(); + *s = 0; +} + + +/* Substitutes a shell-quotified version of `value' into `p->arg' at + the place where the `%' character appeared. + */ +static char * +format_switch (parameter *p, const char *value) +{ + char *fmt = p->arg; + char *v2; + char *result, *s; + if (!fmt || !value) return 0; + v2 = shell_quotify (value); + result = (char *) malloc (strlen (fmt) + strlen (v2) + 10); + s = result; + for (; *fmt; fmt++) + if (*fmt != '%') + *s++ = *fmt; + else + { + strcpy (s, v2); + s += strlen (s); + } + *s = 0; + + free (v2); + return result; +} + + +/* Maps a `parameter' to a command-line switch. + Returns 0 if it can't, or if the parameter has the default value. + */ +static char * +parameter_to_switch (parameter *p) +{ + switch (p->type) + { + case COMMAND: + if (p->arg) + return strdup (p->arg); + else + return 0; + break; + case STRING: + case FILENAME: + if (!p->widget) return 0; + { + const char *s = gtk_entry_get_text (GTK_ENTRY (p->widget)); + char *v; + if (!strcmp ((s ? s : ""), + (p->string ? p->string : ""))) + v = 0; /* same as default */ + else + v = format_switch (p, s); + + /* don't free `s' */ + return v; + } + case SLIDER: + case SPINBUTTON: + if (!p->widget) return 0; + { + GtkAdjustment *adj = + (p->type == SLIDER + ? gtk_range_get_adjustment (GTK_RANGE (p->widget)) + : gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (p->widget))); + char buf[255]; + char *s1; + float value = (p->invert_p + ? invert_range (adj->lower, adj->upper, adj->value) + : adj->value); + + if (value == p->value) /* same as default */ + return 0; + + if (p->integer_p) + sprintf (buf, "%d", (int) (value + 0.5)); + else + sprintf (buf, "%.4f", value); + + s1 = strchr (buf, '.'); + if (s1) + { + char *s2 = s1 + strlen(s1) - 1; + while (s2 > s1 && *s2 == '0') /* lose trailing zeroes */ + *s2-- = 0; + if (s2 >= s1 && *s2 == '.') /* lose trailing decimal */ + *s2-- = 0; + } + return format_switch (p, buf); + } + case BOOLEAN: + if (!p->widget) return 0; + { + GtkToggleButton *b = GTK_TOGGLE_BUTTON (p->widget); + const char *s = (gtk_toggle_button_get_active (b) + ? p->arg_set + : p->arg_unset); + if (s) + return strdup (s); + else + return 0; + } + case SELECT: + if (!p->widget) return 0; + { + GtkOptionMenu *opt = GTK_OPTION_MENU (p->widget); + GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt)); + GtkWidget *selected = gtk_menu_get_active (menu); + GList *kids = gtk_container_children (GTK_CONTAINER (menu)); + int menu_elt = g_list_index (kids, (gpointer) selected); + GList *ol = g_list_nth (p->options, menu_elt); + parameter *o = (ol ? (parameter *) ol->data : 0); + const char *s; + if (!o) abort(); + if (o->type != SELECT_OPTION) abort(); + s = o->arg_set; + if (s) + return strdup (s); + else + return 0; + } + default: + if (p->widget) + abort(); + else + return 0; + } +} + +/* Maps a GList of `parameter' objects to a complete command-line string. + All arguments will be properly quoted. + */ +static char * +parameters_to_cmd_line (GList *parms) +{ + int L = g_list_length (parms); + int LL = 0; + char **strs = (char **) calloc (sizeof (*parms), L); + char *result; + char *out; + int i; + + for (i = 0; parms; parms = parms->next, i++) + { + char *s = parameter_to_switch ((parameter *) parms->data); + strs[i] = s; + LL += (s ? strlen(s) : 0) + 1; + } + + result = (char *) malloc (LL + 10); + out = result; + for (i = 0; i < L; i++) + if (strs[i]) + { + strcpy (out, strs[i]); + out += strlen (out); + *out++ = ' '; + free (strs[i]); + } + *out = 0; + while (out > result && out[-1] == ' ') /* strip trailing spaces */ + *(--out) = 0; + free (strs); + + return result; +} + + +/* Returns a GList of the tokens the string, using shell syntax; + Quoted strings are handled as a single token. + */ +static GList * +tokenize_command_line (const char *cmd) +{ + GList *result = 0; + const char *s = cmd; + while (*s) + { + const char *start; + char *ss; + for (; isspace(*s); s++); /* skip whitespace */ + + start = s; + if (*s == '\'' || *s == '\"' || *s == '`') + { + char q = *s; + s++; + while (*s && *s != q) /* skip to matching quote */ + { + if (*s == '\\' && s[1]) /* allowing backslash quoting */ + s++; + s++; + } + s++; + } + else + { + while (*s && + (! (isspace(*s) || + *s == '\'' || + *s == '\"' || + *s == '`'))) + s++; + } + + if (s > start) + { + ss = (char *) malloc ((s - start) + 1); + strncpy (ss, start, s-start); + ss[s-start] = 0; + if (*ss == '\'' || *ss == '\"' || *ss == '`') + de_stringify (ss); + result = g_list_append (result, ss); + } + } + + return result; +} + +static void parameter_set_switch (parameter *, gpointer value); +static gboolean parse_command_line_into_parameters_1 (const char *filename, + GList *parms, + const char *option, + const char *value, + parameter *parent); + + +/* Parses the command line, and flushes those options down into + the `parameter' structs in the list. + */ +static void +parse_command_line_into_parameters (const char *filename, + const char *cmd, GList *parms) +{ + GList *tokens = tokenize_command_line (cmd); + GList *rest; + for (rest = tokens; rest; rest = rest->next) + { + char *option = rest->data; + rest->data = 0; + + if (option[0] != '-') + { + if (debug_p) + fprintf (stderr, "%s: WARNING: %s: not a switch: \"%s\"\n", + blurb(), filename, option); + } + else + { + char *value = 0; + + if (rest->next) /* pop off the arg to this option */ + { + char *s = (char *) rest->next->data; + /* the next token is the next switch iff it matches "-[a-z]". + (To avoid losing on "-x -3.1".) + */ + if (s && (s[0] != '-' || !isalpha(s[1]))) + { + value = s; + rest->next->data = 0; + rest = rest->next; + } + } + + parse_command_line_into_parameters_1 (filename, parms, + option, value, 0); + if (value) free (value); + free (option); + } + } + g_list_free (tokens); +} + + +static gboolean +compare_opts (const char *option, const char *value, + const char *template) +{ + int ol = strlen (option); + char *c; + + if (strncmp (option, template, ol)) + return FALSE; + + if (template[ol] != (value ? ' ' : 0)) + return FALSE; + + /* At this point, we have a match against "option". + If template contains a %, we're done. + Else, compare against "value" too. + */ + c = strchr (template, '%'); + if (c) + return TRUE; + + if (!value) + return (template[ol] == 0); + if (strcmp (template + ol + 1, value)) + return FALSE; + + return TRUE; +} + + +static gboolean +parse_command_line_into_parameters_1 (const char *filename, + GList *parms, + const char *option, + const char *value, + parameter *parent) +{ + GList *p; + parameter *match = 0; + int which = -1; + int index = 0; + + for (p = parms; p; p = p->next) + { + parameter *pp = (parameter *) p->data; + which = -99; + + if (pp->type == SELECT) + { + if (parse_command_line_into_parameters_1 (filename, + pp->options, + option, value, + pp)) + { + which = -2; + match = pp; + } + } + else if (pp->arg) + { + if (compare_opts (option, value, pp->arg)) + { + which = -1; + match = pp; + } + } + else if (pp->arg_set) + { + if (compare_opts (option, value, pp->arg_set)) + { + which = 1; + match = pp; + } + } + else if (pp->arg_unset) + { + if (compare_opts (option, value, pp->arg_unset)) + { + which = 0; + match = pp; + } + } + + if (match) + break; + + index++; + } + + if (!match) + { + if (debug_p && !parent) + fprintf (stderr, "%s: WARNING: %s: no match for %s %s\n", + blurb(), filename, option, (value ? value : "")); + return FALSE; + } + + switch (match->type) + { + case STRING: + case FILENAME: + case SLIDER: + case SPINBUTTON: + if (which != -1) abort(); + parameter_set_switch (match, (gpointer) value); + break; + case BOOLEAN: + if (which != 0 && which != 1) abort(); + parameter_set_switch (match, (gpointer) which); + break; + case SELECT_OPTION: + if (which != 1) abort(); + parameter_set_switch (parent, (gpointer) index); + break; + default: + break; + } + return TRUE; +} + + +/* Set the parameter's value. + For STRING, FILENAME, SLIDER, and SPINBUTTON, `value' is a char*. + For BOOLEAN and SELECT, `value' is an int. + */ +static void +parameter_set_switch (parameter *p, gpointer value) +{ + if (p->type == SELECT_OPTION) abort(); + if (!p->widget) return; + switch (p->type) + { + case STRING: + case FILENAME: + { + gtk_entry_set_text (GTK_ENTRY (p->widget), (char *) value); + break; + } + case SLIDER: + case SPINBUTTON: + { + GtkAdjustment *adj = + (p->type == SLIDER + ? gtk_range_get_adjustment (GTK_RANGE (p->widget)) + : gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (p->widget))); + float f; + char c; + + if (1 == sscanf ((char *) value, "%f %c", &f, &c)) + { + if (p->invert_p) + f = invert_range (adj->lower, adj->upper, f); + gtk_adjustment_set_value (adj, f); + } + break; + } + case BOOLEAN: + { + GtkToggleButton *b = GTK_TOGGLE_BUTTON (p->widget); + gtk_toggle_button_set_active (b, (int) value); + break; + } + case SELECT: + { + gtk_option_menu_set_history (GTK_OPTION_MENU (p->widget), + (int) value); + break; + } + default: + abort(); + } +} + + +static void +restore_defaults (const char *progname, GList *parms) +{ + for (; parms; parms = parms->next) + { + parameter *p = (parameter *) parms->data; + if (!p->widget) continue; + switch (p->type) + { + case STRING: + case FILENAME: + { + gtk_entry_set_text (GTK_ENTRY (p->widget), + (p->string ? p->string : "")); + break; + } + case SLIDER: + case SPINBUTTON: + { + GtkAdjustment *adj = + (p->type == SLIDER + ? gtk_range_get_adjustment (GTK_RANGE (p->widget)) + : gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (p->widget))); + float value = (p->invert_p + ? invert_range (p->low, p->high, p->value) + : p->value); + gtk_adjustment_set_value (adj, value); + break; + } + case BOOLEAN: + { + /* A toggle button should be on by default if it inserts + nothing into the command line when on. E.g., it should + be on if `arg_set' is null. + */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p->widget), + (!p->arg_set || !*p->arg_set)); + break; + } + case SELECT: + { + GtkOptionMenu *opt = GTK_OPTION_MENU (p->widget); + GList *opts; + int selected = 0; + int index; + + for (opts = p->options, index = 0; opts; + opts = opts->next, index++) + { + parameter *s = (parameter *) opts->data; + /* The default menu item is the first one with + no `arg_set' field. */ + if (!s->arg_set) + { + selected = index; + break; + } + } + + gtk_option_menu_set_history (GTK_OPTION_MENU (opt), selected); + break; + } + default: + abort(); + } + } +} + + + +/* Documentation strings + */ + +static char * +get_description (GList *parms) +{ + parameter *doc = 0; + for (; parms; parms = parms->next) + { + parameter *p = (parameter *) parms->data; + if (p->type == DESCRIPTION) + { + doc = p; + break; + } + } + + if (!doc || !doc->string) + return 0; + else + { + char *d = strdup (doc->string); + char *s; + for (s = d; *s; s++) + if (s[0] == '\n') + { + if (s[1] == '\n') /* blank line: leave it */ + s++; + else if (s[1] == ' ' || s[1] == '\t') + s++; /* next line is indented: leave newline */ + else + s[0] = ' '; /* delete newline to un-fold this line */ + } + + /* strip off leading whitespace on first line only */ + for (s = d; *s && (*s == ' ' || *s == '\t'); s++) + ; + while (*s == '\n') /* strip leading newlines */ + s++; + if (s != d) + memmove (d, s, strlen(s)+1); + + /* strip off trailing whitespace and newlines */ + { + int L = strlen(d); + while (L && isspace(d[L-1])) + d[--L] = 0; + } + + return d; + } +} + + +/* External interface. + */ + +static conf_data * +load_configurator_1 (const char *program, const char *arguments, + gboolean verbose_p) +{ + const char *dir = HACK_CONFIGURATION_PATH; + int L = strlen (dir); + char *file = (char *) malloc (L + strlen (program) + 10); + char *s; + FILE *f; + conf_data *data = (conf_data *) calloc (1, sizeof(*data)); + + strcpy (file, dir); + if (file[L-1] != '/') + file[L++] = '/'; + strcpy (file+L, program); + + for (s = file+L; *s; s++) + if (*s == '/' || *s == ' ') + *s = '_'; + else if (isupper (*s)) + *s = tolower (*s); + + strcat (file+L, ".xml"); + + f = fopen (file, "r"); + if (f) + { + int res, size = 1024; + char chars[1024]; + xmlParserCtxtPtr ctxt; + xmlDocPtr doc = 0; + GtkWidget *table; + GList *parms; + + if (verbose_p) + fprintf (stderr, "%s: reading %s...\n", blurb(), file); + + res = fread (chars, 1, 4, f); + if (res <= 0) return 0; + + ctxt = xmlCreatePushParserCtxt(NULL, NULL, chars, res, file); + while ((res = fread(chars, 1, size, f)) > 0) + xmlParseChunk (ctxt, chars, res, 0); + xmlParseChunk (ctxt, chars, 0, 1); + doc = ctxt->myDoc; + xmlFreeParserCtxt (ctxt); + fclose (f); + + /* Parsed the XML file. Now make some widgets. */ + + table = gtk_table_new (1, 3, FALSE); + gtk_table_set_row_spacings (GTK_TABLE (table), 4); + gtk_table_set_col_spacings (GTK_TABLE (table), 4); + gtk_container_set_border_width (GTK_CONTAINER (table), 8); + gtk_widget_show (table); + + parms = make_parameters (file, doc->root, table); + + xmlFreeDoc (doc); + + restore_defaults (program, parms); + if (arguments && *arguments) + parse_command_line_into_parameters (program, arguments, parms); + + data->widget = table; + data->parameters = parms; + data->description = get_description (parms); + } + else + { + parameter *p; + + if (verbose_p) + fprintf (stderr, "%s: %s does not exist.\n", blurb(), file); + + p = calloc (1, sizeof(*p)); + p->type = COMMAND; + p->arg = strdup (arguments); + + data->parameters = g_list_append (0, (gpointer) p); + } + + data->progname = strdup (program); + return data; +} + +static void +split_command_line (const char *full_command_line, + char **prog_ret, char **args_ret) +{ + char *line = strdup (full_command_line); + char *prog; + char *args; + char *s; + + prog = line; + s = line; + while (*s) + { + if (isspace (*s)) + { + *s = 0; + s++; + while (isspace (*s)) s++; + break; + } + else if (*s == '=') /* if the leading word contains an "=", skip it. */ + { + while (*s && !isspace (*s)) s++; + while (isspace (*s)) s++; + prog = s; + } + s++; + } + args = s; + + *prog_ret = strdup (prog); + *args_ret = strdup (args); + free (line); +} + + +conf_data * +load_configurator (const char *full_command_line, gboolean verbose_p) +{ + char *prog; + char *args; + conf_data *cd; + split_command_line (full_command_line, &prog, &args); + cd = load_configurator_1 (prog, args, verbose_p); + free (prog); + free (args); + return cd; +} + + + +char * +get_configurator_command_line (conf_data *data) +{ + char *args = parameters_to_cmd_line (data->parameters); + char *result = (char *) malloc (strlen (data->progname) + + strlen (args) + 2); + strcpy (result, data->progname); + strcat (result, " "); + strcat (result, args); + free (args); + return result; +} + + +void +set_configurator_command_line (conf_data *data, const char *full_command_line) +{ + char *prog; + char *args; + split_command_line (full_command_line, &prog, &args); + if (data->progname) free (data->progname); + data->progname = prog; + restore_defaults (prog, data->parameters); + parse_command_line_into_parameters (prog, args, data->parameters); + free (args); +} + +void +free_conf_data (conf_data *data) +{ + if (data->parameters) + { + GList *rest; + for (rest = data->parameters; rest; rest = rest->next) + { + free_parameter ((parameter *) rest->data); + rest->data = 0; + } + g_list_free (data->parameters); + data->parameters = 0; + } + + if (data->widget) + gtk_widget_destroy (data->widget); + + if (data->progname) + free (data->progname);; + + memset (data, ~0, sizeof(*data)); + free (data); +} + + +#endif /* HAVE_GTK && HAVE_XML -- whole file */ diff --git a/driver/demo-Gtk-conf.h b/driver/demo-Gtk-conf.h new file mode 100644 index 00000000..42b1dbff --- /dev/null +++ b/driver/demo-Gtk-conf.h @@ -0,0 +1,29 @@ +/* demo-Gtk-conf.c --- implements the dynamic configuration dialogs. + * xscreensaver, Copyright (c) 2001 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef _DEMO_GTK_CONF_H_ +#define _DEMO_GTK_CONF_H_ + +typedef struct { + GtkWidget *widget; /* the container widget with the sliders and stuff. */ + GList *parameters; /* internal data -- hands off */ + char *progname; + char *progclass; + char *description; +} conf_data; + +extern conf_data *load_configurator (const char *cmd_line, gboolean verbose_p); +extern char *get_configurator_command_line (conf_data *); +extern void set_configurator_command_line (conf_data *, const char *cmd_line); +extern void free_conf_data (conf_data *); + +#endif /* _DEMO_GTK_CONF_H_ */ diff --git a/driver/demo-Gtk-stubs.h b/driver/demo-Gtk-stubs.h index a9fadcd3..59bc17b9 100644 --- a/driver/demo-Gtk-stubs.h +++ b/driver/demo-Gtk-stubs.h @@ -41,6 +41,16 @@ void doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data); +void +switch_page_cb (GtkNotebook *notebook, + GtkNotebookPage *page, + gint page_num, + gpointer user_data); + +void +pref_changed_cb (GtkWidget *widget, + gpointer user_data); + void run_next_cb (GtkButton *button, gpointer user_data); @@ -54,35 +64,39 @@ run_this_cb (GtkButton *button, gpointer user_data); void -apply_manual_cb (GtkButton *button, +manual_cb (GtkButton *button, gpointer user_data); void -prefs_ok_cb (GtkButton *button, +settings_cb (GtkButton *button, gpointer user_data); void -prefs_cancel_cb (GtkButton *button, +browse_image_dir_cb (GtkButton *button, gpointer user_data); void -manual_cb (GtkButton *button, +settings_switch_page_cb (GtkNotebook *notebook, + GtkNotebookPage *page, + gint page_num, gpointer user_data); void -notebook_switch_page_cb (GtkNotebook *notebook, - GtkNotebookPage *page, - gint page_num, +enabled_cb (GtkToggleButton *togglebutton, gpointer user_data); void -pref_changed_cb (GtkToggleButton *togglebutton, +settings_adv_cb (GtkButton *button, gpointer user_data); void -enabled_cb (GtkToggleButton *togglebutton, +settings_std_cb (GtkButton *button, gpointer user_data); void -browse_image_dir_cb (GtkButton *button, +settings_ok_cb (GtkButton *button, + gpointer user_data); + +void +settings_cancel_cb (GtkButton *button, gpointer user_data); diff --git a/driver/demo-Gtk-support.c b/driver/demo-Gtk-support.c new file mode 100644 index 00000000..df64c82f --- /dev/null +++ b/driver/demo-Gtk-support.c @@ -0,0 +1,162 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include + +#include "demo-Gtk-support.h" + +/* This is an internally used function to check if a pixmap file exists. */ +static gchar* check_file_exists (const gchar *directory, + const gchar *filename); + +/* This is an internally used function to create pixmaps. */ +static GtkWidget* create_dummy_pixmap (GtkWidget *widget); + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = widget->parent; + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +/* This is a dummy pixmap we use when a pixmap can't be found. */ +static char *dummy_pixmap_xpm[] = { +/* columns rows colors chars-per-pixel */ +"1 1 1 1", +" c None", +/* pixels */ +" " +}; + +/* This is an internally used function to create pixmaps. */ +static GtkWidget* +create_dummy_pixmap (GtkWidget *widget) +{ + GdkColormap *colormap; + GdkPixmap *gdkpixmap; + GdkBitmap *mask; + GtkWidget *pixmap; + + colormap = gtk_widget_get_colormap (widget); + gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask, + NULL, dummy_pixmap_xpm); + if (gdkpixmap == NULL) + g_error ("Couldn't create replacement pixmap."); + pixmap = gtk_pixmap_new (gdkpixmap, mask); + gdk_pixmap_unref (gdkpixmap); + gdk_bitmap_unref (mask); + return pixmap; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *found_filename = NULL; + GdkColormap *colormap; + GdkPixmap *gdkpixmap; + GdkBitmap *mask; + GtkWidget *pixmap; + GList *elem; + + if (!filename || !filename[0]) + return create_dummy_pixmap (widget); + + /* We first try any pixmaps directories set by the application. */ + elem = pixmaps_directories; + while (elem) + { + found_filename = check_file_exists ((gchar*)elem->data, filename); + if (found_filename) + break; + elem = elem->next; + } + + /* If we haven't found the pixmap, try the source directory. */ + if (!found_filename) + { + found_filename = check_file_exists ("", filename); + } + + if (!found_filename) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return create_dummy_pixmap (widget); + } + + colormap = gtk_widget_get_colormap (widget); + gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask, + NULL, found_filename); + if (gdkpixmap == NULL) + { + g_warning ("Error loading pixmap file: %s", found_filename); + g_free (found_filename); + return create_dummy_pixmap (widget); + } + g_free (found_filename); + pixmap = gtk_pixmap_new (gdkpixmap, mask); + gdk_pixmap_unref (gdkpixmap); + gdk_bitmap_unref (mask); + return pixmap; +} + +/* This is an internally used function to check if a pixmap file exists. */ +gchar* +check_file_exists (const gchar *directory, + const gchar *filename) +{ + gchar *full_filename; + struct stat s; + gint status; + + full_filename = (gchar*) g_malloc (strlen (directory) + 1 + + strlen (filename) + 1); + strcpy (full_filename, directory); + strcat (full_filename, G_DIR_SEPARATOR_S); + strcat (full_filename, filename); + + status = stat (full_filename, &s); + if (status == 0 && S_ISREG (s.st_mode)) + return full_filename; + g_free (full_filename); + return NULL; +} + diff --git a/driver/demo-Gtk-support.h b/driver/demo-Gtk-support.h new file mode 100644 index 00000000..aee31f93 --- /dev/null +++ b/driver/demo-Gtk-support.h @@ -0,0 +1,38 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Public Functions. + */ + +/* + * This function returns a widget in a component created by Glade. + * Call it with the toplevel widget in the component (i.e. a window/dialog), + * or alternatively any widget in the component, and the name of the widget + * you want returned. + */ +GtkWidget* lookup_widget (GtkWidget *widget, + const gchar *widget_name); + +/* get_widget() is deprecated. Use lookup_widget instead. */ +#define get_widget lookup_widget + +/* Use this function to set the directory containing installed pixmaps. */ +void add_pixmap_directory (const gchar *directory); + + +/* + * Private Functions. + */ + +/* This is used to create the pixmaps in the interface. */ +GtkWidget* create_pixmap (GtkWidget *widget, + const gchar *filename); + diff --git a/driver/demo-Gtk-widgets.c b/driver/demo-Gtk-widgets.c index 08392c1f..50794917 100644 --- a/driver/demo-Gtk-widgets.c +++ b/driver/demo-Gtk-widgets.c @@ -16,6 +16,7 @@ #include "demo-Gtk-stubs.h" #include "demo-Gtk-widgets.h" +#include "demo-Gtk-support.h" GtkWidget* create_xscreensaver_demo (void) @@ -33,20 +34,41 @@ create_xscreensaver_demo (void) GtkWidget *restart; GtkWidget *separator1; GtkWidget *exit_menu; - GtkWidget *edit; - GtkWidget *edit_menu; - GtkAccelGroup *edit_menu_accels; - GtkWidget *cut_menu; - GtkWidget *copy_menu; - GtkWidget *paste_menu; GtkWidget *help; GtkWidget *help_menu; GtkAccelGroup *help_menu_accels; GtkWidget *about_menu; GtkWidget *doc_menu; GtkWidget *notebook; - GtkWidget *demos_hbox; + GtkWidget *demos_table; + GtkWidget *blanking_table; + GtkWidget *cycle_label; + GtkWidget *lock_button_eventbox; + GtkWidget *lock_button; + GtkWidget *timeout_label; + GtkObject *timeout_spinbutton_adj; + GtkWidget *timeout_spinbutton; + GtkWidget *timeout_mlabel; + GtkWidget *cycle_mlabel; + GtkWidget *lock_mlabel; + GtkObject *lock_spinbutton_adj; + GtkWidget *lock_spinbutton; + GtkObject *cycle_spinbutton_adj; + GtkWidget *cycle_spinbutton; + GtkWidget *demo_manual_hbbox; + GtkWidget *demo; + GtkWidget *settings; GtkWidget *list_vbox; + GtkWidget *mode_hbox; + GtkWidget *mode_label; + GtkWidget *mode_menu; + GtkWidget *mode_menu_menu; + GtkWidget *glade_menuitem; + GtkWidget *col_head_hbox; + GtkWidget *use_col_frame; + GtkWidget *use_label; + GtkWidget *saver_col_frame; + GtkWidget *saver_label; GtkWidget *scroller; GtkWidget *viewport; GtkWidget *list; @@ -54,81 +76,71 @@ create_xscreensaver_demo (void) GtkWidget *next_prev_hbox; GtkWidget *next; GtkWidget *prev; - GtkWidget *opts_vbox; - GtkWidget *frame; - GtkWidget *doc; - GtkWidget *opts_vbox2; - GtkWidget *cmd_label; - GtkWidget *cmd_text; - GtkWidget *opts_hbox3; - GtkWidget *enabled; - GtkWidget *visual; - GtkWidget *visual_combo; - GList *visual_combo_items = NULL; - GtkWidget *combo_entry1; - GtkWidget *demo_hline; - GtkWidget *demo_manual_hbox; - GtkWidget *demo; - GtkWidget *manual; + GtkWidget *preview_frame; + GtkWidget *preview_aspectframe; + GtkWidget *preview; GtkWidget *demo_tab; - GtkWidget *options_vbox; GtkWidget *options_table; - GtkWidget *options_table_2; - GtkWidget *dpms_frame; - GtkWidget *dpms_table; - GtkWidget *dpms_off_text; - GtkWidget *dpms_suspend_text; - GtkWidget *dpms_standby_text; - GtkWidget *dpms_standby_label; - GtkWidget *dpms_off_label; - GtkWidget *dpms_suspend_label; - GtkWidget *dpms_dummy; - GtkWidget *dpms_button_eventbox; - GtkWidget *dpms_button; + GtkWidget *diag_frame; + GtkWidget *diag_hbox; + GtkWidget *diag_logo; + GtkWidget *diag_vbox; + GtkWidget *verbose_button_eventbox; + GtkWidget *verbose_button; + GtkWidget *capture_button_eventbox; + GtkWidget *capture_button; + GtkWidget *splash_button_eventbox; + GtkWidget *splash_button; GtkWidget *cmap_frame; - GtkWidget *cmap_table; - GtkWidget *fade_text; - GtkWidget *cmap_dummy; - GtkWidget *fade_label; + GtkWidget *cmap_hbox; + GtkWidget *cmap_logo; + GtkWidget *cmap_vbox; GtkWidget *install_button_eventbox; GtkWidget *install_button; + GtkWidget *cmap_hr; GtkWidget *fade_button_eventbox; GtkWidget *fade_button; GtkWidget *unfade_button_eventbox; GtkWidget *unfade_button; - GtkWidget *cmap_hr; - GtkWidget *options_table_1; + GtkWidget *fade_hbox; + GtkWidget *fade_dummy; + GtkWidget *fade_label; + GtkObject *fade_spinbutton_adj; + GtkWidget *fade_spinbutton; + GtkWidget *fade_sec_label; + GtkWidget *dpms_frame; + GtkWidget *dpms_hbox; + GtkWidget *dpms_logo; + GtkWidget *dpms_vbox; + GtkWidget *dpms_button_eventbox; + GtkWidget *dpms_button; + GtkWidget *dpms_table; + GtkObject *dpms_standby_spinbutton_adj; + GtkWidget *dpms_standby_spinbutton; + GtkWidget *dpms_standby_mlabel; + GtkWidget *dpms_suspend_mlabel; + GtkWidget *dpms_off_mlabel; + GtkWidget *dpms_off_label; + GtkWidget *dpms_suspend_label; + GtkWidget *dpms_standby_label; + GtkObject *dpms_suspend_spinbutton_adj; + GtkWidget *dpms_suspend_spinbutton; + GtkObject *dpms_off_spinbutton_adj; + GtkWidget *dpms_off_spinbutton; GtkWidget *grab_frame; - GtkWidget *grab_table; - GtkWidget *grab_image_eventbox; - GtkWidget *grab_image_button; - GtkWidget *image_browse_button; - GtkWidget *grab_video_eventbox; - GtkWidget *grab_video_button; + GtkWidget *grab_hbox; + GtkWidget *img_logo; + GtkWidget *grab_vbox; GtkWidget *grab_desk_eventbox; GtkWidget *grab_desk_button; + GtkWidget *grab_video_eventbox; + GtkWidget *grab_video_button; + GtkWidget *grab_image_eventbox; + GtkWidget *grab_image_button; + GtkWidget *image_hbox; GtkWidget *grab_dummy; GtkWidget *image_text; - GtkWidget *blanking_frame; - GtkWidget *blanking_table; - GtkWidget *lock_text; - GtkWidget *cycle_text; - GtkWidget *timeout_text; - GtkWidget *timeout_label; - GtkWidget *cycle_label; - GtkWidget *lock_label; - GtkWidget *blanking_dummy; - GtkWidget *lock_button_eventbox; - GtkWidget *lock_button; - GtkWidget *blanking_hr; - GtkWidget *diag_frame; - GtkWidget *diag_table; - GtkWidget *splash_button_eventbox; - GtkWidget *splash_button; - GtkWidget *capture_button_eventbox; - GtkWidget *capture_button; - GtkWidget *verbose_button_eventbox; - GtkWidget *verbose_button; + GtkWidget *image_browse_button; GtkWidget *options_tab; GtkAccelGroup *accel_group; GtkTooltips *tooltips; @@ -141,7 +153,6 @@ create_xscreensaver_demo (void) gtk_widget_set_name (xscreensaver_demo, "xscreensaver_demo"); gtk_object_set_data (GTK_OBJECT (xscreensaver_demo), "xscreensaver_demo", xscreensaver_demo); gtk_window_set_title (GTK_WINDOW (xscreensaver_demo), "XScreenSaver"); - gtk_window_set_policy (GTK_WINDOW (xscreensaver_demo), TRUE, TRUE, FALSE); gtk_window_set_wmclass (GTK_WINDOW (xscreensaver_demo), "xscreensaver", "XScreenSaver"); outer_vbox = gtk_vbox_new (FALSE, 5); @@ -164,7 +175,7 @@ create_xscreensaver_demo (void) tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (file)->child), "_File"); gtk_widget_add_accelerator (file, "activate_item", accel_group, - tmp_key, GDK_MOD1_MASK, 0); + tmp_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); gtk_widget_set_name (file, "file"); gtk_widget_ref (file); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "file", file, @@ -204,7 +215,7 @@ create_xscreensaver_demo (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (lock_menu); gtk_container_add (GTK_CONTAINER (file_menu), lock_menu); - gtk_tooltips_set_tip (tooltips, lock_menu, "Lock the screen now (even if \"Require Password\" is unchecked.)", NULL); + gtk_tooltips_set_tip (tooltips, lock_menu, "Lock the screen now (even if \"Lock Screen\" is unchecked.)", NULL); kill_menu = gtk_menu_item_new_with_label (""); tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (kill_menu)->child), @@ -254,67 +265,11 @@ create_xscreensaver_demo (void) gtk_container_add (GTK_CONTAINER (file_menu), exit_menu); gtk_tooltips_set_tip (tooltips, exit_menu, "Exit the xscreensaver-demo program (but leave the XScreenSaver daemon running in the background.)", NULL); - edit = gtk_menu_item_new_with_label (""); - tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (edit)->child), - "_Edit"); - gtk_widget_add_accelerator (edit, "activate_item", accel_group, - tmp_key, GDK_MOD1_MASK, 0); - gtk_widget_set_name (edit, "edit"); - gtk_widget_ref (edit); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "edit", edit, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (edit); - gtk_container_add (GTK_CONTAINER (menubar), edit); - - edit_menu = gtk_menu_new (); - gtk_widget_set_name (edit_menu, "edit_menu"); - gtk_widget_ref (edit_menu); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "edit_menu", edit_menu, - (GtkDestroyNotify) gtk_widget_unref); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (edit), edit_menu); - edit_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (edit_menu)); - - cut_menu = gtk_menu_item_new_with_label (""); - tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (cut_menu)->child), - "C_ut"); - gtk_widget_add_accelerator (cut_menu, "activate_item", edit_menu_accels, - tmp_key, 0, 0); - gtk_widget_set_name (cut_menu, "cut_menu"); - gtk_widget_ref (cut_menu); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cut_menu", cut_menu, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cut_menu); - gtk_container_add (GTK_CONTAINER (edit_menu), cut_menu); - - copy_menu = gtk_menu_item_new_with_label (""); - tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (copy_menu)->child), - "_Copy"); - gtk_widget_add_accelerator (copy_menu, "activate_item", edit_menu_accels, - tmp_key, 0, 0); - gtk_widget_set_name (copy_menu, "copy_menu"); - gtk_widget_ref (copy_menu); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "copy_menu", copy_menu, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (copy_menu); - gtk_container_add (GTK_CONTAINER (edit_menu), copy_menu); - - paste_menu = gtk_menu_item_new_with_label (""); - tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (paste_menu)->child), - "_Paste"); - gtk_widget_add_accelerator (paste_menu, "activate_item", edit_menu_accels, - tmp_key, 0, 0); - gtk_widget_set_name (paste_menu, "paste_menu"); - gtk_widget_ref (paste_menu); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "paste_menu", paste_menu, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (paste_menu); - gtk_container_add (GTK_CONTAINER (edit_menu), paste_menu); - help = gtk_menu_item_new_with_label (""); tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (help)->child), "_Help"); gtk_widget_add_accelerator (help, "activate_item", accel_group, - tmp_key, GDK_MOD1_MASK, 0); + tmp_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); gtk_widget_set_name (help, "help"); gtk_widget_ref (help); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "help", help, @@ -364,23 +319,280 @@ create_xscreensaver_demo (void) gtk_widget_show (notebook); gtk_box_pack_start (GTK_BOX (outer_vbox), notebook, TRUE, TRUE, 0); - demos_hbox = gtk_hbox_new (FALSE, 5); - gtk_widget_set_name (demos_hbox, "demos_hbox"); - gtk_widget_ref (demos_hbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demos_hbox", demos_hbox, + demos_table = gtk_table_new (2, 2, FALSE); + gtk_widget_set_name (demos_table, "demos_table"); + gtk_widget_ref (demos_table); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demos_table", demos_table, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (demos_table); + gtk_container_add (GTK_CONTAINER (notebook), demos_table); + gtk_container_set_border_width (GTK_CONTAINER (demos_table), 10); + + blanking_table = gtk_table_new (3, 4, FALSE); + gtk_widget_set_name (blanking_table, "blanking_table"); + gtk_widget_ref (blanking_table); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "blanking_table", blanking_table, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (blanking_table); + gtk_table_attach (GTK_TABLE (demos_table), blanking_table, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_table_set_row_spacings (GTK_TABLE (blanking_table), 2); + + cycle_label = gtk_label_new ("Cycle After"); + gtk_widget_set_name (cycle_label, "cycle_label"); + gtk_widget_ref (cycle_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cycle_label", cycle_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cycle_label); + gtk_table_attach (GTK_TABLE (blanking_table), cycle_label, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (cycle_label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (cycle_label), 1, 0.5); + gtk_misc_set_padding (GTK_MISC (cycle_label), 8, 0); + + lock_button_eventbox = gtk_event_box_new (); + gtk_widget_set_name (lock_button_eventbox, "lock_button_eventbox"); + gtk_widget_ref (lock_button_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_button_eventbox", lock_button_eventbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (lock_button_eventbox); + gtk_table_attach (GTK_TABLE (blanking_table), lock_button_eventbox, 0, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, lock_button_eventbox, "Whether a password should be required to un-blank the screen.", NULL); + + lock_button = gtk_check_button_new_with_label ("Lock Screen After"); + gtk_widget_set_name (lock_button, "lock_button"); + gtk_widget_ref (lock_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_button", lock_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (lock_button); + gtk_container_add (GTK_CONTAINER (lock_button_eventbox), lock_button); + + timeout_label = gtk_label_new ("Blank After"); + gtk_widget_set_name (timeout_label, "timeout_label"); + gtk_widget_ref (timeout_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "timeout_label", timeout_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (timeout_label); + gtk_table_attach (GTK_TABLE (blanking_table), timeout_label, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (timeout_label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (timeout_label), 1, 0.5); + gtk_misc_set_padding (GTK_MISC (timeout_label), 8, 0); + + timeout_spinbutton_adj = gtk_adjustment_new (0, 1, 720, 1, 30, 30); + timeout_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (timeout_spinbutton_adj), 15, 0); + gtk_widget_set_name (timeout_spinbutton, "timeout_spinbutton"); + gtk_widget_ref (timeout_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "timeout_spinbutton", timeout_spinbutton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (timeout_spinbutton); + gtk_table_attach (GTK_TABLE (blanking_table), timeout_spinbutton, 2, 3, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, timeout_spinbutton, "How long before the monitor goes completely black.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (timeout_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (timeout_spinbutton), TRUE); + + timeout_mlabel = gtk_label_new ("minutes"); + gtk_widget_set_name (timeout_mlabel, "timeout_mlabel"); + gtk_widget_ref (timeout_mlabel); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "timeout_mlabel", timeout_mlabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (timeout_mlabel); + gtk_table_attach (GTK_TABLE (blanking_table), timeout_mlabel, 3, 4, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (timeout_mlabel), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (timeout_mlabel), 0, 0.5); + + cycle_mlabel = gtk_label_new ("minutes"); + gtk_widget_set_name (cycle_mlabel, "cycle_mlabel"); + gtk_widget_ref (cycle_mlabel); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cycle_mlabel", cycle_mlabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cycle_mlabel); + gtk_table_attach (GTK_TABLE (blanking_table), cycle_mlabel, 3, 4, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (cycle_mlabel), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (cycle_mlabel), 0, 0.5); + + lock_mlabel = gtk_label_new ("minutes"); + gtk_widget_set_name (lock_mlabel, "lock_mlabel"); + gtk_widget_ref (lock_mlabel); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_mlabel", lock_mlabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (lock_mlabel); + gtk_table_attach (GTK_TABLE (blanking_table), lock_mlabel, 3, 4, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (lock_mlabel), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (lock_mlabel), 0, 0.5); + + lock_spinbutton_adj = gtk_adjustment_new (0, 0, 720, 1, 30, 30); + lock_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (lock_spinbutton_adj), 15, 0); + gtk_widget_set_name (lock_spinbutton, "lock_spinbutton"); + gtk_widget_ref (lock_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_spinbutton", lock_spinbutton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (lock_spinbutton); + gtk_table_attach (GTK_TABLE (blanking_table), lock_spinbutton, 2, 3, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 10); + gtk_tooltips_set_tip (tooltips, lock_spinbutton, "How long before the monitor goes completely black.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (lock_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (lock_spinbutton), TRUE); + + cycle_spinbutton_adj = gtk_adjustment_new (0, 1, 720, 1, 30, 30); + cycle_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (cycle_spinbutton_adj), 15, 0); + gtk_widget_set_name (cycle_spinbutton, "cycle_spinbutton"); + gtk_widget_ref (cycle_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cycle_spinbutton", cycle_spinbutton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cycle_spinbutton); + gtk_table_attach (GTK_TABLE (blanking_table), cycle_spinbutton, 2, 3, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, cycle_spinbutton, "How long before the monitor goes completely black.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (cycle_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (cycle_spinbutton), TRUE); + + demo_manual_hbbox = gtk_hbutton_box_new (); + gtk_widget_set_name (demo_manual_hbbox, "demo_manual_hbbox"); + gtk_widget_ref (demo_manual_hbbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo_manual_hbbox", demo_manual_hbbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (demo_manual_hbbox); + gtk_table_attach (GTK_TABLE (demos_table), demo_manual_hbbox, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_button_box_set_layout (GTK_BUTTON_BOX (demo_manual_hbbox), GTK_BUTTONBOX_SPREAD); + + demo = gtk_button_new_with_label ("Preview"); + gtk_widget_set_name (demo, "demo"); + gtk_widget_ref (demo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo", demo, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (demo); + gtk_container_add (GTK_CONTAINER (demo_manual_hbbox), demo); + GTK_WIDGET_SET_FLAGS (demo, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, demo, "Demo the selected screen saver in full-screen mode (click the mouse to return.)", NULL); + + settings = gtk_button_new_with_label ("Settings..."); + gtk_widget_set_name (settings, "settings"); + gtk_widget_ref (settings); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "settings", settings, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (demos_hbox); - gtk_container_add (GTK_CONTAINER (notebook), demos_hbox); + gtk_widget_show (settings); + gtk_container_add (GTK_CONTAINER (demo_manual_hbbox), settings); + GTK_WIDGET_SET_FLAGS (settings, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, settings, "Customization and explanation of the selected screen saver.", NULL); - list_vbox = gtk_vbox_new (FALSE, 5); + list_vbox = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (list_vbox, "list_vbox"); gtk_widget_ref (list_vbox); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "list_vbox", list_vbox, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (list_vbox); - gtk_box_pack_start (GTK_BOX (demos_hbox), list_vbox, FALSE, FALSE, 0); + gtk_table_attach (GTK_TABLE (demos_table), list_vbox, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_container_set_border_width (GTK_CONTAINER (list_vbox), 10); + mode_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (mode_hbox, "mode_hbox"); + gtk_widget_ref (mode_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "mode_hbox", mode_hbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (mode_hbox); + gtk_box_pack_start (GTK_BOX (list_vbox), mode_hbox, FALSE, TRUE, 10); + + mode_label = gtk_label_new ("Mode:"); + gtk_widget_set_name (mode_label, "mode_label"); + gtk_widget_ref (mode_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "mode_label", mode_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (mode_label); + gtk_box_pack_start (GTK_BOX (mode_hbox), mode_label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (mode_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (mode_label), 0, 0.5); + + mode_menu = gtk_option_menu_new (); + gtk_widget_set_name (mode_menu, "mode_menu"); + gtk_widget_ref (mode_menu); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "mode_menu", mode_menu, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (mode_menu); + gtk_box_pack_start (GTK_BOX (mode_hbox), mode_menu, FALSE, FALSE, 4); + mode_menu_menu = gtk_menu_new (); + glade_menuitem = gtk_menu_item_new_with_label ("Disable Screen Saver"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (mode_menu_menu), glade_menuitem); + glade_menuitem = gtk_menu_item_new_with_label ("Blank Screen Only"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (mode_menu_menu), glade_menuitem); + glade_menuitem = gtk_menu_item_new_with_label ("Only One Screen Saver"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (mode_menu_menu), glade_menuitem); + glade_menuitem = gtk_menu_item_new_with_label ("Random Screen Saver"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (mode_menu_menu), glade_menuitem); + gtk_option_menu_set_menu (GTK_OPTION_MENU (mode_menu), mode_menu_menu); + gtk_option_menu_set_history (GTK_OPTION_MENU (mode_menu), 3); + + col_head_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (col_head_hbox, "col_head_hbox"); + gtk_widget_ref (col_head_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "col_head_hbox", col_head_hbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (col_head_hbox); + gtk_box_pack_start (GTK_BOX (list_vbox), col_head_hbox, FALSE, TRUE, 0); + + use_col_frame = gtk_frame_new (NULL); + gtk_widget_set_name (use_col_frame, "use_col_frame"); + gtk_widget_ref (use_col_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "use_col_frame", use_col_frame, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (use_col_frame); + gtk_box_pack_start (GTK_BOX (col_head_hbox), use_col_frame, FALSE, FALSE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (use_col_frame), GTK_SHADOW_OUT); + + use_label = gtk_label_new ("Use"); + gtk_widget_set_name (use_label, "use_label"); + gtk_widget_ref (use_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "use_label", use_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (use_label); + gtk_container_add (GTK_CONTAINER (use_col_frame), use_label); + gtk_label_set_justify (GTK_LABEL (use_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (use_label), 0, 0.5); + gtk_misc_set_padding (GTK_MISC (use_label), 3, 0); + + saver_col_frame = gtk_frame_new (NULL); + gtk_widget_set_name (saver_col_frame, "saver_col_frame"); + gtk_widget_ref (saver_col_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "saver_col_frame", saver_col_frame, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (saver_col_frame); + gtk_box_pack_start (GTK_BOX (col_head_hbox), saver_col_frame, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (saver_col_frame), GTK_SHADOW_OUT); + + saver_label = gtk_label_new ("Screen Saver"); + gtk_widget_set_name (saver_label, "saver_label"); + gtk_widget_ref (saver_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "saver_label", saver_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (saver_label); + gtk_container_add (GTK_CONTAINER (saver_col_frame), saver_label); + gtk_label_set_justify (GTK_LABEL (saver_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (saver_label), 0, 0.5); + gtk_misc_set_padding (GTK_MISC (saver_label), 6, 0); + scroller = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_name (scroller, "scroller"); gtk_widget_ref (scroller); @@ -413,7 +625,7 @@ create_xscreensaver_demo (void) gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "centering_hbox", centering_hbox, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (centering_hbox); - gtk_box_pack_start (GTK_BOX (list_vbox), centering_hbox, FALSE, TRUE, 0); + gtk_box_pack_end (GTK_BOX (list_vbox), centering_hbox, FALSE, TRUE, 0); next_prev_hbox = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (next_prev_hbox, "next_prev_hbox"); @@ -431,7 +643,7 @@ create_xscreensaver_demo (void) gtk_widget_show (next); gtk_box_pack_start (GTK_BOX (next_prev_hbox), next, FALSE, FALSE, 0); GTK_WIDGET_SET_FLAGS (next, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, next, "Run the next demo in this list in full-screen mode (click the mouse to return.)", NULL); + gtk_tooltips_set_tip (tooltips, next, "Run the next screen saver in the list in full-screen mode (click the mouse to return.)", NULL); prev = gtk_button_new_with_label ("/\\"); gtk_widget_set_name (prev, "prev"); @@ -441,162 +653,36 @@ create_xscreensaver_demo (void) gtk_widget_show (prev); gtk_box_pack_start (GTK_BOX (next_prev_hbox), prev, FALSE, FALSE, 0); GTK_WIDGET_SET_FLAGS (prev, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, prev, "Run the previous demo in this list in full-screen mode (click the mouse to return.)", NULL); - - opts_vbox = gtk_vbox_new (FALSE, 0); - gtk_widget_set_name (opts_vbox, "opts_vbox"); - gtk_widget_ref (opts_vbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "opts_vbox", opts_vbox, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opts_vbox); - gtk_box_pack_start (GTK_BOX (demos_hbox), opts_vbox, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (opts_vbox), 10); - - frame = gtk_frame_new (NULL); - gtk_widget_set_name (frame, "frame"); - gtk_widget_ref (frame); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "frame", frame, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (frame); - gtk_box_pack_start (GTK_BOX (opts_vbox), frame, TRUE, TRUE, 0); - - doc = gtk_label_new (""); - gtk_widget_set_name (doc, "doc"); - gtk_widget_ref (doc); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "doc", doc, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (doc); - gtk_container_add (GTK_CONTAINER (frame), doc); - gtk_label_set_justify (GTK_LABEL (doc), GTK_JUSTIFY_LEFT); - gtk_label_set_line_wrap (GTK_LABEL (doc), TRUE); - gtk_misc_set_alignment (GTK_MISC (doc), 0, 0); - gtk_misc_set_padding (GTK_MISC (doc), 10, 10); - - opts_vbox2 = gtk_vbox_new (FALSE, 2); - gtk_widget_set_name (opts_vbox2, "opts_vbox2"); - gtk_widget_ref (opts_vbox2); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "opts_vbox2", opts_vbox2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opts_vbox2); - gtk_box_pack_start (GTK_BOX (opts_vbox), opts_vbox2, FALSE, TRUE, 0); - - cmd_label = gtk_label_new ("Command Line:"); - gtk_widget_set_name (cmd_label, "cmd_label"); - gtk_widget_ref (cmd_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmd_label", cmd_label, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cmd_label); - gtk_box_pack_start (GTK_BOX (opts_vbox2), cmd_label, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (cmd_label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (cmd_label), 0, 1); - gtk_misc_set_padding (GTK_MISC (cmd_label), 0, 2); - - cmd_text = gtk_entry_new (); - gtk_widget_set_name (cmd_text, "cmd_text"); - gtk_widget_ref (cmd_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmd_text", cmd_text, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cmd_text); - gtk_box_pack_start (GTK_BOX (opts_vbox2), cmd_text, FALSE, TRUE, 0); - - opts_hbox3 = gtk_hbox_new (FALSE, 0); - gtk_widget_set_name (opts_hbox3, "opts_hbox3"); - gtk_widget_ref (opts_hbox3); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "opts_hbox3", opts_hbox3, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opts_hbox3); - gtk_box_pack_start (GTK_BOX (opts_vbox2), opts_hbox3, FALSE, TRUE, 4); - gtk_container_set_border_width (GTK_CONTAINER (opts_hbox3), 4); - - enabled = gtk_check_button_new_with_label ("Enabled"); - gtk_widget_set_name (enabled, "enabled"); - gtk_widget_ref (enabled); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "enabled", enabled, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (enabled); - gtk_box_pack_start (GTK_BOX (opts_hbox3), enabled, FALSE, FALSE, 0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enabled), TRUE); - - visual = gtk_label_new ("Visual:"); - gtk_widget_set_name (visual, "visual"); - gtk_widget_ref (visual); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "visual", visual, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (visual); - gtk_box_pack_start (GTK_BOX (opts_hbox3), visual, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (visual), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (visual), 1, 0.5); - gtk_misc_set_padding (GTK_MISC (visual), 10, 0); - - visual_combo = gtk_combo_new (); - gtk_widget_set_name (visual_combo, "visual_combo"); - gtk_widget_ref (visual_combo); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "visual_combo", visual_combo, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (visual_combo); - gtk_box_pack_start (GTK_BOX (opts_hbox3), visual_combo, FALSE, FALSE, 0); - visual_combo_items = g_list_append (visual_combo_items, "Any"); - visual_combo_items = g_list_append (visual_combo_items, "Best"); - visual_combo_items = g_list_append (visual_combo_items, "Default"); - visual_combo_items = g_list_append (visual_combo_items, "Default-N"); - visual_combo_items = g_list_append (visual_combo_items, "GL"); - visual_combo_items = g_list_append (visual_combo_items, "TrueColor"); - visual_combo_items = g_list_append (visual_combo_items, "PseudoColor"); - visual_combo_items = g_list_append (visual_combo_items, "StaticGray"); - visual_combo_items = g_list_append (visual_combo_items, "GrayScale"); - visual_combo_items = g_list_append (visual_combo_items, "DirectColor"); - visual_combo_items = g_list_append (visual_combo_items, "Color"); - visual_combo_items = g_list_append (visual_combo_items, "Gray"); - visual_combo_items = g_list_append (visual_combo_items, "Mono"); - gtk_combo_set_popdown_strings (GTK_COMBO (visual_combo), visual_combo_items); - g_list_free (visual_combo_items); - - combo_entry1 = GTK_COMBO (visual_combo)->entry; - gtk_widget_set_name (combo_entry1, "combo_entry1"); - gtk_widget_ref (combo_entry1); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "combo_entry1", combo_entry1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (combo_entry1); - gtk_tooltips_set_tip (tooltips, combo_entry1, "The X visual type that this demo will require. If that visual is available it will be used, otherwise, this demo will not be run.", NULL); - gtk_entry_set_text (GTK_ENTRY (combo_entry1), "Any"); + gtk_tooltips_set_tip (tooltips, prev, "Run the previous screen saver in the list in full-screen mode (click the mouse to return.)", NULL); - demo_hline = gtk_hseparator_new (); - gtk_widget_set_name (demo_hline, "demo_hline"); - gtk_widget_ref (demo_hline); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo_hline", demo_hline, + preview_frame = gtk_frame_new ("Description"); + gtk_widget_set_name (preview_frame, "preview_frame"); + gtk_widget_ref (preview_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "preview_frame", preview_frame, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (demo_hline); - gtk_box_pack_start (GTK_BOX (opts_vbox), demo_hline, FALSE, FALSE, 5); + gtk_widget_show (preview_frame); + gtk_table_attach (GTK_TABLE (demos_table), preview_frame, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 6); - demo_manual_hbox = gtk_hbutton_box_new (); - gtk_widget_set_name (demo_manual_hbox, "demo_manual_hbox"); - gtk_widget_ref (demo_manual_hbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo_manual_hbox", demo_manual_hbox, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (demo_manual_hbox); - gtk_box_pack_start (GTK_BOX (opts_vbox), demo_manual_hbox, FALSE, TRUE, 0); - - demo = gtk_button_new_with_label ("Demo"); - gtk_widget_set_name (demo, "demo"); - gtk_widget_ref (demo); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo", demo, + preview_aspectframe = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.33, FALSE); + gtk_widget_set_name (preview_aspectframe, "preview_aspectframe"); + gtk_widget_ref (preview_aspectframe); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "preview_aspectframe", preview_aspectframe, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (demo); - gtk_container_add (GTK_CONTAINER (demo_manual_hbox), demo); - GTK_WIDGET_SET_FLAGS (demo, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, demo, "Run this one in full-screen mode (click the mouse to return.)", NULL); + gtk_widget_show (preview_aspectframe); + gtk_container_add (GTK_CONTAINER (preview_frame), preview_aspectframe); + gtk_container_set_border_width (GTK_CONTAINER (preview_aspectframe), 8); - manual = gtk_button_new_with_label ("Documentation..."); - gtk_widget_set_name (manual, "manual"); - gtk_widget_ref (manual); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "manual", manual, + preview = gtk_drawing_area_new (); + gtk_widget_set_name (preview, "preview"); + gtk_widget_ref (preview); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "preview", preview, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (manual); - gtk_container_add (GTK_CONTAINER (demo_manual_hbox), manual); - GTK_WIDGET_SET_FLAGS (manual, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, manual, "Click here to read the manual for this display mode, if it has one.", NULL); + gtk_widget_show (preview); + gtk_container_add (GTK_CONTAINER (preview_aspectframe), preview); - demo_tab = gtk_label_new ("Graphics Demos"); + demo_tab = gtk_label_new ("Display Modes"); gtk_widget_set_name (demo_tab, "demo_tab"); gtk_widget_ref (demo_tab); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo_tab", demo_tab, @@ -604,209 +690,139 @@ create_xscreensaver_demo (void) gtk_widget_show (demo_tab); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), demo_tab); - options_vbox = gtk_vbox_new (FALSE, 0); - gtk_widget_set_name (options_vbox, "options_vbox"); - gtk_widget_ref (options_vbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "options_vbox", options_vbox, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (options_vbox); - gtk_container_add (GTK_CONTAINER (notebook), options_vbox); - - options_table = gtk_table_new (1, 2, TRUE); + options_table = gtk_table_new (2, 2, TRUE); gtk_widget_set_name (options_table, "options_table"); gtk_widget_ref (options_table); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "options_table", options_table, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (options_table); - gtk_box_pack_start (GTK_BOX (options_vbox), options_table, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (notebook), options_table); - options_table_2 = gtk_table_new (2, 1, FALSE); - gtk_widget_set_name (options_table_2, "options_table_2"); - gtk_widget_ref (options_table_2); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "options_table_2", options_table_2, + diag_frame = gtk_frame_new ("Diagnostics"); + gtk_widget_set_name (diag_frame, "diag_frame"); + gtk_widget_ref (diag_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "diag_frame", diag_frame, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (options_table_2); - gtk_table_attach (GTK_TABLE (options_table), options_table_2, 1, 2, 0, 1, + gtk_widget_show (diag_frame); + gtk_table_attach (GTK_TABLE (options_table), diag_frame, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); + gtk_container_set_border_width (GTK_CONTAINER (diag_frame), 10); - dpms_frame = gtk_frame_new ("Display Power Management:"); - gtk_widget_set_name (dpms_frame, "dpms_frame"); - gtk_widget_ref (dpms_frame); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_frame", dpms_frame, + diag_hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_set_name (diag_hbox, "diag_hbox"); + gtk_widget_ref (diag_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "diag_hbox", diag_hbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_frame); - gtk_table_attach (GTK_TABLE (options_table_2), dpms_frame, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_container_set_border_width (GTK_CONTAINER (dpms_frame), 10); + gtk_widget_show (diag_hbox); + gtk_container_add (GTK_CONTAINER (diag_frame), diag_hbox); + gtk_container_set_border_width (GTK_CONTAINER (diag_hbox), 8); - dpms_table = gtk_table_new (4, 3, FALSE); - gtk_widget_set_name (dpms_table, "dpms_table"); - gtk_widget_ref (dpms_table); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_table", dpms_table, + diag_logo = create_pixmap (xscreensaver_demo, "screensaver-diagnostic.xpm"); + gtk_widget_set_name (diag_logo, "diag_logo"); + gtk_widget_ref (diag_logo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "diag_logo", diag_logo, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_table); - gtk_container_add (GTK_CONTAINER (dpms_frame), dpms_table); - gtk_container_set_border_width (GTK_CONTAINER (dpms_table), 10); - gtk_table_set_row_spacings (GTK_TABLE (dpms_table), 2); - gtk_table_set_col_spacings (GTK_TABLE (dpms_table), 10); + gtk_widget_show (diag_logo); + gtk_box_pack_start (GTK_BOX (diag_hbox), diag_logo, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (diag_logo), 0.5, 0); - dpms_off_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (dpms_off_text, "dpms_off_text"); - gtk_widget_ref (dpms_off_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_off_text", dpms_off_text, + diag_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (diag_vbox, "diag_vbox"); + gtk_widget_ref (diag_vbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "diag_vbox", diag_vbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_off_text); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_off_text, 1, 2, 3, 4, - (GtkAttachOptions) (0), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, dpms_off_text, "How long until the monitor powers down (if Power Management is enabled).", NULL); + gtk_widget_show (diag_vbox); + gtk_box_pack_start (GTK_BOX (diag_hbox), diag_vbox, TRUE, TRUE, 0); - dpms_suspend_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (dpms_suspend_text, "dpms_suspend_text"); - gtk_widget_ref (dpms_suspend_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_suspend_text", dpms_suspend_text, + verbose_button_eventbox = gtk_event_box_new (); + gtk_widget_set_name (verbose_button_eventbox, "verbose_button_eventbox"); + gtk_widget_ref (verbose_button_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "verbose_button_eventbox", verbose_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_suspend_text); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_suspend_text, 1, 2, 2, 3, - (GtkAttachOptions) (0), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, dpms_suspend_text, "How long until the monitor goes into power-saving mode (if Power Management is enabled).", NULL); + gtk_widget_show (verbose_button_eventbox); + gtk_box_pack_start (GTK_BOX (diag_vbox), verbose_button_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, verbose_button_eventbox, "Whether the daemon should print lots of debugging information.", NULL); - dpms_standby_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (dpms_standby_text, "dpms_standby_text"); - gtk_widget_ref (dpms_standby_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_standby_text", dpms_standby_text, + verbose_button = gtk_check_button_new_with_label ("Verbose Diagnostics"); + gtk_widget_set_name (verbose_button, "verbose_button"); + gtk_widget_ref (verbose_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "verbose_button", verbose_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_standby_text); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_standby_text, 1, 2, 1, 2, - (GtkAttachOptions) (0), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, dpms_standby_text, "How long before the monitor goes completely black (if Power Management is enabled).", NULL); - - dpms_standby_label = gtk_label_new ("Standby After:"); - gtk_widget_set_name (dpms_standby_label, "dpms_standby_label"); - gtk_widget_ref (dpms_standby_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_standby_label", dpms_standby_label, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_standby_label); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_standby_label, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (dpms_standby_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (dpms_standby_label), 1, 0.5); - - dpms_off_label = gtk_label_new ("Off After:"); - gtk_widget_set_name (dpms_off_label, "dpms_off_label"); - gtk_widget_ref (dpms_off_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_off_label", dpms_off_label, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_off_label); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_off_label, 0, 1, 3, 4, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (dpms_off_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (dpms_off_label), 1, 0.5); + gtk_widget_show (verbose_button); + gtk_container_add (GTK_CONTAINER (verbose_button_eventbox), verbose_button); - dpms_suspend_label = gtk_label_new ("Suspend After:"); - gtk_widget_set_name (dpms_suspend_label, "dpms_suspend_label"); - gtk_widget_ref (dpms_suspend_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_suspend_label", dpms_suspend_label, + capture_button_eventbox = gtk_event_box_new (); + gtk_widget_set_name (capture_button_eventbox, "capture_button_eventbox"); + gtk_widget_ref (capture_button_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "capture_button_eventbox", capture_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_suspend_label); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_suspend_label, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (dpms_suspend_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (dpms_suspend_label), 1, 0.5); + gtk_widget_show (capture_button_eventbox); + gtk_box_pack_start (GTK_BOX (diag_vbox), capture_button_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, capture_button_eventbox, "Whether any error output of the display modes should be redirected to the screen.", NULL); - dpms_dummy = gtk_label_new (""); - gtk_widget_set_name (dpms_dummy, "dpms_dummy"); - gtk_widget_ref (dpms_dummy); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_dummy", dpms_dummy, + capture_button = gtk_check_button_new_with_label ("Display Subprocess Errors"); + gtk_widget_set_name (capture_button, "capture_button"); + gtk_widget_ref (capture_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "capture_button", capture_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_dummy); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_dummy, 2, 3, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (dpms_dummy), GTK_JUSTIFY_LEFT); + gtk_widget_show (capture_button); + gtk_container_add (GTK_CONTAINER (capture_button_eventbox), capture_button); - dpms_button_eventbox = gtk_event_box_new (); - gtk_widget_set_name (dpms_button_eventbox, "dpms_button_eventbox"); - gtk_widget_ref (dpms_button_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_button_eventbox", dpms_button_eventbox, + splash_button_eventbox = gtk_event_box_new (); + gtk_widget_set_name (splash_button_eventbox, "splash_button_eventbox"); + gtk_widget_ref (splash_button_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "splash_button_eventbox", splash_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_button_eventbox); - gtk_table_attach (GTK_TABLE (dpms_table), dpms_button_eventbox, 0, 3, 0, 1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_tooltips_set_tip (tooltips, dpms_button_eventbox, "Whether the monitor should be powered down after a while.", NULL); + gtk_widget_show (splash_button_eventbox); + gtk_box_pack_start (GTK_BOX (diag_vbox), splash_button_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, splash_button_eventbox, "Whether the splash screen (with the version number and `Help' button) should be momentarily displayed when the daemon first starts up.", NULL); - dpms_button = gtk_check_button_new_with_label ("Power Management Enabled"); - gtk_widget_set_name (dpms_button, "dpms_button"); - gtk_widget_ref (dpms_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_button", dpms_button, + splash_button = gtk_check_button_new_with_label ("Display Splash Screen at Startup"); + gtk_widget_set_name (splash_button, "splash_button"); + gtk_widget_ref (splash_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "splash_button", splash_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (dpms_button); - gtk_container_add (GTK_CONTAINER (dpms_button_eventbox), dpms_button); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dpms_button), TRUE); + gtk_widget_show (splash_button); + gtk_container_add (GTK_CONTAINER (splash_button_eventbox), splash_button); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (splash_button), TRUE); - cmap_frame = gtk_frame_new ("Colormaps:"); + cmap_frame = gtk_frame_new ("Colormaps"); gtk_widget_set_name (cmap_frame, "cmap_frame"); gtk_widget_ref (cmap_frame); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_frame", cmap_frame, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (cmap_frame); - gtk_table_attach (GTK_TABLE (options_table_2), cmap_frame, 0, 1, 1, 2, + gtk_table_attach (GTK_TABLE (options_table), cmap_frame, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_container_set_border_width (GTK_CONTAINER (cmap_frame), 10); - cmap_table = gtk_table_new (5, 3, FALSE); - gtk_widget_set_name (cmap_table, "cmap_table"); - gtk_widget_ref (cmap_table); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_table", cmap_table, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cmap_table); - gtk_container_add (GTK_CONTAINER (cmap_frame), cmap_table); - gtk_container_set_border_width (GTK_CONTAINER (cmap_table), 10); - gtk_table_set_row_spacings (GTK_TABLE (cmap_table), 2); - gtk_table_set_col_spacings (GTK_TABLE (cmap_table), 10); - - fade_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (fade_text, "fade_text"); - gtk_widget_ref (fade_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_text", fade_text, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (fade_text); - gtk_table_attach (GTK_TABLE (cmap_table), fade_text, 1, 2, 4, 5, - (GtkAttachOptions) (0), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, fade_text, "How long it should take for the screen to fade in and out.", NULL); + cmap_hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_set_name (cmap_hbox, "cmap_hbox"); + gtk_widget_ref (cmap_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_hbox", cmap_hbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cmap_hbox); + gtk_container_add (GTK_CONTAINER (cmap_frame), cmap_hbox); + gtk_container_set_border_width (GTK_CONTAINER (cmap_hbox), 8); - cmap_dummy = gtk_label_new (""); - gtk_widget_set_name (cmap_dummy, "cmap_dummy"); - gtk_widget_ref (cmap_dummy); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_dummy", cmap_dummy, + cmap_logo = create_pixmap (xscreensaver_demo, "screensaver-colorselector.xpm"); + gtk_widget_set_name (cmap_logo, "cmap_logo"); + gtk_widget_ref (cmap_logo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_logo", cmap_logo, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cmap_dummy); - gtk_table_attach (GTK_TABLE (cmap_table), cmap_dummy, 2, 3, 4, 5, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (cmap_dummy), GTK_JUSTIFY_LEFT); + gtk_widget_show (cmap_logo); + gtk_box_pack_start (GTK_BOX (cmap_hbox), cmap_logo, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (cmap_logo), 0.5, 0); - fade_label = gtk_label_new ("Fade Duration:"); - gtk_widget_set_name (fade_label, "fade_label"); - gtk_widget_ref (fade_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_label", fade_label, + cmap_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (cmap_vbox, "cmap_vbox"); + gtk_widget_ref (cmap_vbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_vbox", cmap_vbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (fade_label); - gtk_table_attach (GTK_TABLE (cmap_table), fade_label, 0, 1, 4, 5, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (fade_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (fade_label), 1, 0.5); + gtk_widget_show (cmap_vbox); + gtk_box_pack_start (GTK_BOX (cmap_hbox), cmap_vbox, TRUE, TRUE, 0); install_button_eventbox = gtk_event_box_new (); gtk_widget_set_name (install_button_eventbox, "install_button_eventbox"); @@ -814,9 +830,7 @@ create_xscreensaver_demo (void) gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "install_button_eventbox", install_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (install_button_eventbox); - gtk_table_attach (GTK_TABLE (cmap_table), install_button_eventbox, 0, 3, 0, 1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_box_pack_start (GTK_BOX (cmap_vbox), install_button_eventbox, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, install_button_eventbox, "Whether to install a private colormap when running in 8-bit mode on the default Visual.", NULL); install_button = gtk_check_button_new_with_label ("Install Colormap"); @@ -827,15 +841,21 @@ create_xscreensaver_demo (void) gtk_widget_show (install_button); gtk_container_add (GTK_CONTAINER (install_button_eventbox), install_button); + cmap_hr = gtk_hseparator_new (); + gtk_widget_set_name (cmap_hr, "cmap_hr"); + gtk_widget_ref (cmap_hr); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_hr", cmap_hr, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cmap_hr); + gtk_box_pack_start (GTK_BOX (cmap_vbox), cmap_hr, FALSE, FALSE, 4); + fade_button_eventbox = gtk_event_box_new (); gtk_widget_set_name (fade_button_eventbox, "fade_button_eventbox"); gtk_widget_ref (fade_button_eventbox); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_button_eventbox", fade_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (fade_button_eventbox); - gtk_table_attach (GTK_TABLE (cmap_table), fade_button_eventbox, 0, 3, 2, 3, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_box_pack_start (GTK_BOX (cmap_vbox), fade_button_eventbox, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, fade_button_eventbox, "Whether the screen should slowly fade to black when the screen saver activates.", NULL); fade_button = gtk_check_button_new_with_label ("Fade To Black When Blanking"); @@ -852,9 +872,7 @@ create_xscreensaver_demo (void) gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "unfade_button_eventbox", unfade_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (unfade_button_eventbox); - gtk_table_attach (GTK_TABLE (cmap_table), unfade_button_eventbox, 0, 3, 3, 4, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_box_pack_start (GTK_BOX (cmap_vbox), unfade_button_eventbox, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, unfade_button_eventbox, "Whether the screen should slowly fade in from black when the screen saver deactivates.", NULL); unfade_button = gtk_check_button_new_with_label ("Fade From Black When Unblanking"); @@ -865,348 +883,361 @@ create_xscreensaver_demo (void) gtk_widget_show (unfade_button); gtk_container_add (GTK_CONTAINER (unfade_button_eventbox), unfade_button); - cmap_hr = gtk_hseparator_new (); - gtk_widget_set_name (cmap_hr, "cmap_hr"); - gtk_widget_ref (cmap_hr); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cmap_hr", cmap_hr, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cmap_hr); - gtk_table_attach (GTK_TABLE (cmap_table), cmap_hr, 0, 3, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 2); - - options_table_1 = gtk_table_new (3, 1, FALSE); - gtk_widget_set_name (options_table_1, "options_table_1"); - gtk_widget_ref (options_table_1); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "options_table_1", options_table_1, + fade_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (fade_hbox, "fade_hbox"); + gtk_widget_ref (fade_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_hbox", fade_hbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (options_table_1); - gtk_table_attach (GTK_TABLE (options_table), options_table_1, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); + gtk_widget_show (fade_hbox); + gtk_box_pack_start (GTK_BOX (cmap_vbox), fade_hbox, FALSE, FALSE, 0); - grab_frame = gtk_frame_new ("Image Manipulation:"); - gtk_widget_set_name (grab_frame, "grab_frame"); - gtk_widget_ref (grab_frame); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_frame", grab_frame, + fade_dummy = gtk_label_new (""); + gtk_widget_set_name (fade_dummy, "fade_dummy"); + gtk_widget_ref (fade_dummy); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_dummy", fade_dummy, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_frame); - gtk_table_attach (GTK_TABLE (options_table_1), grab_frame, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_container_set_border_width (GTK_CONTAINER (grab_frame), 10); + gtk_widget_show (fade_dummy); + gtk_box_pack_start (GTK_BOX (fade_hbox), fade_dummy, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (fade_dummy), GTK_JUSTIFY_LEFT); + gtk_misc_set_padding (GTK_MISC (fade_dummy), 3, 0); - grab_table = gtk_table_new (4, 3, FALSE); - gtk_widget_set_name (grab_table, "grab_table"); - gtk_widget_ref (grab_table); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_table", grab_table, + fade_label = gtk_label_new ("Fade Duration"); + gtk_widget_set_name (fade_label, "fade_label"); + gtk_widget_ref (fade_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_label", fade_label, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_table); - gtk_container_add (GTK_CONTAINER (grab_frame), grab_table); - gtk_container_set_border_width (GTK_CONTAINER (grab_table), 10); - - grab_image_eventbox = gtk_event_box_new (); - gtk_widget_set_name (grab_image_eventbox, "grab_image_eventbox"); - gtk_widget_ref (grab_image_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_image_eventbox", grab_image_eventbox, + gtk_widget_show (fade_label); + gtk_box_pack_start (GTK_BOX (fade_hbox), fade_label, FALSE, FALSE, 10); + gtk_label_set_justify (GTK_LABEL (fade_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (fade_label), 0, 0.5); + + fade_spinbutton_adj = gtk_adjustment_new (0, 0, 10, 1, 1, 1); + fade_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (fade_spinbutton_adj), 1, 0); + gtk_widget_set_name (fade_spinbutton, "fade_spinbutton"); + gtk_widget_ref (fade_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_spinbutton", fade_spinbutton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (fade_spinbutton); + gtk_box_pack_start (GTK_BOX (fade_hbox), fade_spinbutton, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, fade_spinbutton, "How long it should take for the screen to fade in and out.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (fade_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (fade_spinbutton), TRUE); + + fade_sec_label = gtk_label_new ("seconds"); + gtk_widget_set_name (fade_sec_label, "fade_sec_label"); + gtk_widget_ref (fade_sec_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "fade_sec_label", fade_sec_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (fade_sec_label); + gtk_box_pack_start (GTK_BOX (fade_hbox), fade_sec_label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (fade_sec_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (fade_sec_label), 0, 0.5); + + dpms_frame = gtk_frame_new ("Display Power Management"); + gtk_widget_set_name (dpms_frame, "dpms_frame"); + gtk_widget_ref (dpms_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_frame", dpms_frame, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_image_eventbox); - gtk_table_attach (GTK_TABLE (grab_table), grab_image_eventbox, 0, 3, 2, 3, + gtk_widget_show (dpms_frame); + gtk_table_attach (GTK_TABLE (options_table), dpms_frame, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_tooltips_set_tip (tooltips, grab_image_eventbox, "Whether the image-manipulating modes should operate on random images loaded from disk.", NULL); - - grab_image_button = gtk_check_button_new_with_label ("Choose Random Image:"); - gtk_widget_set_name (grab_image_button, "grab_image_button"); - gtk_widget_ref (grab_image_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_image_button", grab_image_button, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_image_button); - gtk_container_add (GTK_CONTAINER (grab_image_eventbox), grab_image_button); + gtk_container_set_border_width (GTK_CONTAINER (dpms_frame), 10); - image_browse_button = gtk_button_new_with_label ("Browse"); - gtk_widget_set_name (image_browse_button, "image_browse_button"); - gtk_widget_ref (image_browse_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "image_browse_button", image_browse_button, + dpms_hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_set_name (dpms_hbox, "dpms_hbox"); + gtk_widget_ref (dpms_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_hbox", dpms_hbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (image_browse_button); - gtk_table_attach (GTK_TABLE (grab_table), image_browse_button, 2, 3, 3, 4, - (GtkAttachOptions) (0), - (GtkAttachOptions) (0), 4, 0); + gtk_widget_show (dpms_hbox); + gtk_container_add (GTK_CONTAINER (dpms_frame), dpms_hbox); + gtk_container_set_border_width (GTK_CONTAINER (dpms_hbox), 8); - grab_video_eventbox = gtk_event_box_new (); - gtk_widget_set_name (grab_video_eventbox, "grab_video_eventbox"); - gtk_widget_ref (grab_video_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_video_eventbox", grab_video_eventbox, + dpms_logo = create_pixmap (xscreensaver_demo, "screensaver-power.xpm"); + gtk_widget_set_name (dpms_logo, "dpms_logo"); + gtk_widget_ref (dpms_logo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_logo", dpms_logo, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_video_eventbox); - gtk_table_attach (GTK_TABLE (grab_table), grab_video_eventbox, 0, 3, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_tooltips_set_tip (tooltips, grab_video_eventbox, "Whether the image-manipulating modes should operate on images captured from the system's video input (if there is one).", NULL); + gtk_widget_show (dpms_logo); + gtk_box_pack_start (GTK_BOX (dpms_hbox), dpms_logo, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (dpms_logo), 0.5, 0); - grab_video_button = gtk_check_button_new_with_label ("Grab Video Frames"); - gtk_widget_set_name (grab_video_button, "grab_video_button"); - gtk_widget_ref (grab_video_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_video_button", grab_video_button, + dpms_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (dpms_vbox, "dpms_vbox"); + gtk_widget_ref (dpms_vbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_vbox", dpms_vbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_video_button); - gtk_container_add (GTK_CONTAINER (grab_video_eventbox), grab_video_button); + gtk_widget_show (dpms_vbox); + gtk_box_pack_start (GTK_BOX (dpms_hbox), dpms_vbox, FALSE, FALSE, 0); - grab_desk_eventbox = gtk_event_box_new (); - gtk_widget_set_name (grab_desk_eventbox, "grab_desk_eventbox"); - gtk_widget_ref (grab_desk_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_desk_eventbox", grab_desk_eventbox, + dpms_button_eventbox = gtk_event_box_new (); + gtk_widget_set_name (dpms_button_eventbox, "dpms_button_eventbox"); + gtk_widget_ref (dpms_button_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_button_eventbox", dpms_button_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_desk_eventbox); - gtk_table_attach (GTK_TABLE (grab_table), grab_desk_eventbox, 0, 3, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_tooltips_set_tip (tooltips, grab_desk_eventbox, "Whether the image-manipulating modes should be allowed to operate on an image of your desktop.", NULL); + gtk_widget_show (dpms_button_eventbox); + gtk_box_pack_start (GTK_BOX (dpms_vbox), dpms_button_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, dpms_button_eventbox, "Whether the monitor should be powered down after a while.", NULL); - grab_desk_button = gtk_check_button_new_with_label ("Grab Desktop Images"); - gtk_widget_set_name (grab_desk_button, "grab_desk_button"); - gtk_widget_ref (grab_desk_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_desk_button", grab_desk_button, + dpms_button = gtk_check_button_new_with_label ("Power Management Enabled"); + gtk_widget_set_name (dpms_button, "dpms_button"); + gtk_widget_ref (dpms_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_button", dpms_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_desk_button); - gtk_container_add (GTK_CONTAINER (grab_desk_eventbox), grab_desk_button); + gtk_widget_show (dpms_button); + gtk_container_add (GTK_CONTAINER (dpms_button_eventbox), dpms_button); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dpms_button), TRUE); - grab_dummy = gtk_label_new (""); - gtk_widget_set_name (grab_dummy, "grab_dummy"); - gtk_widget_ref (grab_dummy); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_dummy", grab_dummy, + dpms_table = gtk_table_new (3, 3, FALSE); + gtk_widget_set_name (dpms_table, "dpms_table"); + gtk_widget_ref (dpms_table); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_table", dpms_table, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (grab_dummy); - gtk_table_attach (GTK_TABLE (grab_table), grab_dummy, 0, 1, 3, 4, - (GtkAttachOptions) (GTK_SHRINK | GTK_FILL), - (GtkAttachOptions) (GTK_SHRINK), 0, 0); - gtk_label_set_justify (GTK_LABEL (grab_dummy), GTK_JUSTIFY_LEFT); - gtk_misc_set_padding (GTK_MISC (grab_dummy), 8, 0); + gtk_widget_show (dpms_table); + gtk_box_pack_start (GTK_BOX (dpms_vbox), dpms_table, FALSE, FALSE, 0); + gtk_table_set_row_spacings (GTK_TABLE (dpms_table), 2); - image_text = gtk_entry_new (); - gtk_widget_set_name (image_text, "image_text"); - gtk_widget_ref (image_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "image_text", image_text, + dpms_standby_spinbutton_adj = gtk_adjustment_new (0, 0, 1440, 1, 30, 30); + dpms_standby_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (dpms_standby_spinbutton_adj), 15, 0); + gtk_widget_set_name (dpms_standby_spinbutton, "dpms_standby_spinbutton"); + gtk_widget_ref (dpms_standby_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_standby_spinbutton", dpms_standby_spinbutton, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (image_text); - gtk_table_attach (GTK_TABLE (grab_table), image_text, 1, 2, 3, 4, - (GtkAttachOptions) (GTK_SHRINK | GTK_FILL), + gtk_widget_show (dpms_standby_spinbutton); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_standby_spinbutton, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, image_text, "The directory from which images will be randomly chosen.", NULL); + gtk_tooltips_set_tip (tooltips, dpms_standby_spinbutton, "How long before the monitor goes completely black.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (dpms_standby_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (dpms_standby_spinbutton), TRUE); - blanking_frame = gtk_frame_new ("Blanking and Locking:"); - gtk_widget_set_name (blanking_frame, "blanking_frame"); - gtk_widget_ref (blanking_frame); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "blanking_frame", blanking_frame, + dpms_standby_mlabel = gtk_label_new ("minutes"); + gtk_widget_set_name (dpms_standby_mlabel, "dpms_standby_mlabel"); + gtk_widget_ref (dpms_standby_mlabel); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_standby_mlabel", dpms_standby_mlabel, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (blanking_frame); - gtk_table_attach (GTK_TABLE (options_table_1), blanking_frame, 0, 1, 0, 1, + gtk_widget_show (dpms_standby_mlabel); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_standby_mlabel, 2, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_container_set_border_width (GTK_CONTAINER (blanking_frame), 10); - - blanking_table = gtk_table_new (5, 3, FALSE); - gtk_widget_set_name (blanking_table, "blanking_table"); - gtk_widget_ref (blanking_table); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "blanking_table", blanking_table, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (blanking_table); - gtk_container_add (GTK_CONTAINER (blanking_frame), blanking_table); - gtk_container_set_border_width (GTK_CONTAINER (blanking_table), 10); - gtk_table_set_row_spacings (GTK_TABLE (blanking_table), 2); - gtk_table_set_col_spacings (GTK_TABLE (blanking_table), 10); - - lock_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (lock_text, "lock_text"); - gtk_widget_ref (lock_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_text", lock_text, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (lock_text); - gtk_table_attach (GTK_TABLE (blanking_table), lock_text, 1, 2, 4, 5, - (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, lock_text, "How long after the screen saver has activated until a password will be required (if `Require Password' is also set.)", NULL); + gtk_label_set_justify (GTK_LABEL (dpms_standby_mlabel), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (dpms_standby_mlabel), 0, 0.5); - cycle_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (cycle_text, "cycle_text"); - gtk_widget_ref (cycle_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cycle_text", cycle_text, + dpms_suspend_mlabel = gtk_label_new ("minutes"); + gtk_widget_set_name (dpms_suspend_mlabel, "dpms_suspend_mlabel"); + gtk_widget_ref (dpms_suspend_mlabel); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_suspend_mlabel", dpms_suspend_mlabel, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cycle_text); - gtk_table_attach (GTK_TABLE (blanking_table), cycle_text, 1, 2, 1, 2, - (GtkAttachOptions) (0), + gtk_widget_show (dpms_suspend_mlabel); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_suspend_mlabel, 2, 3, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, cycle_text, "How long each demo will be run before moving on to another.", NULL); + gtk_label_set_justify (GTK_LABEL (dpms_suspend_mlabel), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (dpms_suspend_mlabel), 0, 0.5); - timeout_text = gtk_entry_new_with_max_length (8); - gtk_widget_set_name (timeout_text, "timeout_text"); - gtk_widget_ref (timeout_text); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "timeout_text", timeout_text, + dpms_off_mlabel = gtk_label_new ("minutes"); + gtk_widget_set_name (dpms_off_mlabel, "dpms_off_mlabel"); + gtk_widget_ref (dpms_off_mlabel); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_off_mlabel", dpms_off_mlabel, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (timeout_text); - gtk_table_attach (GTK_TABLE (blanking_table), timeout_text, 1, 2, 0, 1, - (GtkAttachOptions) (0), + gtk_widget_show (dpms_off_mlabel); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_off_mlabel, 2, 3, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, timeout_text, "How long until the screen saver activates and begins running demos.", NULL); + gtk_label_set_justify (GTK_LABEL (dpms_off_mlabel), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (dpms_off_mlabel), 0, 0.5); - timeout_label = gtk_label_new ("Blank After:"); - gtk_widget_set_name (timeout_label, "timeout_label"); - gtk_widget_ref (timeout_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "timeout_label", timeout_label, + dpms_off_label = gtk_label_new ("Off After"); + gtk_widget_set_name (dpms_off_label, "dpms_off_label"); + gtk_widget_ref (dpms_off_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_off_label", dpms_off_label, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (timeout_label); - gtk_table_attach (GTK_TABLE (blanking_table), timeout_label, 0, 1, 0, 1, + gtk_widget_show (dpms_off_label); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_off_label, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (timeout_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (timeout_label), 1, 0.5); + gtk_label_set_justify (GTK_LABEL (dpms_off_label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (dpms_off_label), 1, 0.5); + gtk_misc_set_padding (GTK_MISC (dpms_off_label), 10, 0); - cycle_label = gtk_label_new ("Cycle After:"); - gtk_widget_set_name (cycle_label, "cycle_label"); - gtk_widget_ref (cycle_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cycle_label", cycle_label, + dpms_suspend_label = gtk_label_new ("Suspend After"); + gtk_widget_set_name (dpms_suspend_label, "dpms_suspend_label"); + gtk_widget_ref (dpms_suspend_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_suspend_label", dpms_suspend_label, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cycle_label); - gtk_table_attach (GTK_TABLE (blanking_table), cycle_label, 0, 1, 1, 2, + gtk_widget_show (dpms_suspend_label); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_suspend_label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (cycle_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (cycle_label), 1, 0.5); + gtk_label_set_justify (GTK_LABEL (dpms_suspend_label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (dpms_suspend_label), 1, 0.5); + gtk_misc_set_padding (GTK_MISC (dpms_suspend_label), 10, 0); - lock_label = gtk_label_new ("Lock After:"); - gtk_widget_set_name (lock_label, "lock_label"); - gtk_widget_ref (lock_label); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_label", lock_label, + dpms_standby_label = gtk_label_new ("Standby After"); + gtk_widget_set_name (dpms_standby_label, "dpms_standby_label"); + gtk_widget_ref (dpms_standby_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_standby_label", dpms_standby_label, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (lock_label); - gtk_table_attach (GTK_TABLE (blanking_table), lock_label, 0, 1, 4, 5, + gtk_widget_show (dpms_standby_label); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_standby_label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (lock_label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment (GTK_MISC (lock_label), 1, 0.5); + gtk_label_set_justify (GTK_LABEL (dpms_standby_label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (dpms_standby_label), 1, 0.5); + gtk_misc_set_padding (GTK_MISC (dpms_standby_label), 10, 0); - blanking_dummy = gtk_label_new (""); - gtk_widget_set_name (blanking_dummy, "blanking_dummy"); - gtk_widget_ref (blanking_dummy); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "blanking_dummy", blanking_dummy, + dpms_suspend_spinbutton_adj = gtk_adjustment_new (0, 0, 1440, 1, 30, 30); + dpms_suspend_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (dpms_suspend_spinbutton_adj), 15, 0); + gtk_widget_set_name (dpms_suspend_spinbutton, "dpms_suspend_spinbutton"); + gtk_widget_ref (dpms_suspend_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_suspend_spinbutton", dpms_suspend_spinbutton, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (blanking_dummy); - gtk_table_attach (GTK_TABLE (blanking_table), blanking_dummy, 2, 3, 4, 5, + gtk_widget_show (dpms_suspend_spinbutton); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_suspend_spinbutton, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, dpms_suspend_spinbutton, "How long until the monitor goes into power-saving mode.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (dpms_suspend_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (dpms_suspend_spinbutton), TRUE); + + dpms_off_spinbutton_adj = gtk_adjustment_new (0, 0, 1440, 1, 30, 30); + dpms_off_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (dpms_off_spinbutton_adj), 15, 0); + gtk_widget_set_name (dpms_off_spinbutton, "dpms_off_spinbutton"); + gtk_widget_ref (dpms_off_spinbutton); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "dpms_off_spinbutton", dpms_off_spinbutton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (dpms_off_spinbutton); + gtk_table_attach (GTK_TABLE (dpms_table), dpms_off_spinbutton, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_label_set_justify (GTK_LABEL (blanking_dummy), GTK_JUSTIFY_LEFT); + gtk_tooltips_set_tip (tooltips, dpms_off_spinbutton, "How long until the monitor powers down.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (dpms_off_spinbutton), TRUE); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (dpms_off_spinbutton), TRUE); - lock_button_eventbox = gtk_event_box_new (); - gtk_widget_set_name (lock_button_eventbox, "lock_button_eventbox"); - gtk_widget_ref (lock_button_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_button_eventbox", lock_button_eventbox, + grab_frame = gtk_frame_new ("Image Manipulation"); + gtk_widget_set_name (grab_frame, "grab_frame"); + gtk_widget_ref (grab_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_frame", grab_frame, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (lock_button_eventbox); - gtk_table_attach (GTK_TABLE (blanking_table), lock_button_eventbox, 0, 3, 3, 4, - (GtkAttachOptions) (GTK_FILL), + gtk_widget_show (grab_frame); + gtk_table_attach (GTK_TABLE (options_table), grab_frame, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_tooltips_set_tip (tooltips, lock_button_eventbox, "Whether a password should be required to unblank the screen.", NULL); + gtk_container_set_border_width (GTK_CONTAINER (grab_frame), 10); - lock_button = gtk_check_button_new_with_label ("Require Password"); - gtk_widget_set_name (lock_button, "lock_button"); - gtk_widget_ref (lock_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "lock_button", lock_button, + grab_hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_set_name (grab_hbox, "grab_hbox"); + gtk_widget_ref (grab_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_hbox", grab_hbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (lock_button); - gtk_container_add (GTK_CONTAINER (lock_button_eventbox), lock_button); + gtk_widget_show (grab_hbox); + gtk_container_add (GTK_CONTAINER (grab_frame), grab_hbox); + gtk_container_set_border_width (GTK_CONTAINER (grab_hbox), 8); - blanking_hr = gtk_hseparator_new (); - gtk_widget_set_name (blanking_hr, "blanking_hr"); - gtk_widget_ref (blanking_hr); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "blanking_hr", blanking_hr, + img_logo = create_pixmap (xscreensaver_demo, "screensaver-snap.xpm"); + gtk_widget_set_name (img_logo, "img_logo"); + gtk_widget_ref (img_logo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "img_logo", img_logo, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (blanking_hr); - gtk_table_attach (GTK_TABLE (blanking_table), blanking_hr, 0, 3, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 2); + gtk_widget_show (img_logo); + gtk_box_pack_start (GTK_BOX (grab_hbox), img_logo, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (img_logo), 0.5, 0); - diag_frame = gtk_frame_new ("Diagnostics:"); - gtk_widget_set_name (diag_frame, "diag_frame"); - gtk_widget_ref (diag_frame); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "diag_frame", diag_frame, + grab_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (grab_vbox, "grab_vbox"); + gtk_widget_ref (grab_vbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_vbox", grab_vbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (diag_frame); - gtk_table_attach (GTK_TABLE (options_table_1), diag_frame, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 0, 0); - gtk_container_set_border_width (GTK_CONTAINER (diag_frame), 10); + gtk_widget_show (grab_vbox); + gtk_box_pack_start (GTK_BOX (grab_hbox), grab_vbox, TRUE, TRUE, 0); - diag_table = gtk_table_new (3, 1, FALSE); - gtk_widget_set_name (diag_table, "diag_table"); - gtk_widget_ref (diag_table); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "diag_table", diag_table, + grab_desk_eventbox = gtk_event_box_new (); + gtk_widget_set_name (grab_desk_eventbox, "grab_desk_eventbox"); + gtk_widget_ref (grab_desk_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_desk_eventbox", grab_desk_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (diag_table); - gtk_container_add (GTK_CONTAINER (diag_frame), diag_table); - gtk_container_set_border_width (GTK_CONTAINER (diag_table), 10); - gtk_table_set_row_spacings (GTK_TABLE (diag_table), 2); - gtk_table_set_col_spacings (GTK_TABLE (diag_table), 10); + gtk_widget_show (grab_desk_eventbox); + gtk_box_pack_start (GTK_BOX (grab_vbox), grab_desk_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, grab_desk_eventbox, "Whether the image-manipulating modes should be allowed to operate on an image of your desktop.", NULL); - splash_button_eventbox = gtk_event_box_new (); - gtk_widget_set_name (splash_button_eventbox, "splash_button_eventbox"); - gtk_widget_ref (splash_button_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "splash_button_eventbox", splash_button_eventbox, + grab_desk_button = gtk_check_button_new_with_label ("Grab Desktop Images"); + gtk_widget_set_name (grab_desk_button, "grab_desk_button"); + gtk_widget_ref (grab_desk_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_desk_button", grab_desk_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (splash_button_eventbox); - gtk_table_attach (GTK_TABLE (diag_table), splash_button_eventbox, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, splash_button_eventbox, "Whether the splash screen (with the version number and `Help' button) should be momentarily displayed when the daemon first starts up.", NULL); + gtk_widget_show (grab_desk_button); + gtk_container_add (GTK_CONTAINER (grab_desk_eventbox), grab_desk_button); - splash_button = gtk_check_button_new_with_label ("Display Splash Screen at Startup"); - gtk_widget_set_name (splash_button, "splash_button"); - gtk_widget_ref (splash_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "splash_button", splash_button, + grab_video_eventbox = gtk_event_box_new (); + gtk_widget_set_name (grab_video_eventbox, "grab_video_eventbox"); + gtk_widget_ref (grab_video_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_video_eventbox", grab_video_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (splash_button); - gtk_container_add (GTK_CONTAINER (splash_button_eventbox), splash_button); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (splash_button), TRUE); + gtk_widget_show (grab_video_eventbox); + gtk_box_pack_start (GTK_BOX (grab_vbox), grab_video_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, grab_video_eventbox, "Whether the image-manipulating modes should operate on images captured from the system's video input (if there is one).", NULL); - capture_button_eventbox = gtk_event_box_new (); - gtk_widget_set_name (capture_button_eventbox, "capture_button_eventbox"); - gtk_widget_ref (capture_button_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "capture_button_eventbox", capture_button_eventbox, + grab_video_button = gtk_check_button_new_with_label ("Grab Video Frames"); + gtk_widget_set_name (grab_video_button, "grab_video_button"); + gtk_widget_ref (grab_video_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_video_button", grab_video_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (capture_button_eventbox); - gtk_table_attach (GTK_TABLE (diag_table), capture_button_eventbox, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, capture_button_eventbox, "Whether the stdout and stderr streams of graphics demos should be displayed on the xscreensaver window.", NULL); + gtk_widget_show (grab_video_button); + gtk_container_add (GTK_CONTAINER (grab_video_eventbox), grab_video_button); - capture_button = gtk_check_button_new_with_label ("Display Subprocess Errors"); - gtk_widget_set_name (capture_button, "capture_button"); - gtk_widget_ref (capture_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "capture_button", capture_button, + grab_image_eventbox = gtk_event_box_new (); + gtk_widget_set_name (grab_image_eventbox, "grab_image_eventbox"); + gtk_widget_ref (grab_image_eventbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_image_eventbox", grab_image_eventbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (capture_button); - gtk_container_add (GTK_CONTAINER (capture_button_eventbox), capture_button); + gtk_widget_show (grab_image_eventbox); + gtk_box_pack_start (GTK_BOX (grab_vbox), grab_image_eventbox, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, grab_image_eventbox, "Whether the image-manipulating modes should operate on random images loaded from disk.", NULL); - verbose_button_eventbox = gtk_event_box_new (); - gtk_widget_set_name (verbose_button_eventbox, "verbose_button_eventbox"); - gtk_widget_ref (verbose_button_eventbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "verbose_button_eventbox", verbose_button_eventbox, + grab_image_button = gtk_check_button_new_with_label ("Choose Random Image:"); + gtk_widget_set_name (grab_image_button, "grab_image_button"); + gtk_widget_ref (grab_image_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_image_button", grab_image_button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (verbose_button_eventbox); - gtk_table_attach (GTK_TABLE (diag_table), verbose_button_eventbox, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, verbose_button_eventbox, "Whether the daemon should print lots of debugging information.", NULL); + gtk_widget_show (grab_image_button); + gtk_container_add (GTK_CONTAINER (grab_image_eventbox), grab_image_button); - verbose_button = gtk_check_button_new_with_label ("Verbose Diagnostics"); - gtk_widget_set_name (verbose_button, "verbose_button"); - gtk_widget_ref (verbose_button); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "verbose_button", verbose_button, + image_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (image_hbox, "image_hbox"); + gtk_widget_ref (image_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "image_hbox", image_hbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (verbose_button); - gtk_container_add (GTK_CONTAINER (verbose_button_eventbox), verbose_button); + gtk_widget_show (image_hbox); + gtk_box_pack_start (GTK_BOX (grab_vbox), image_hbox, FALSE, FALSE, 0); - options_tab = gtk_label_new ("Screensaver Options"); + grab_dummy = gtk_label_new (""); + gtk_widget_set_name (grab_dummy, "grab_dummy"); + gtk_widget_ref (grab_dummy); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "grab_dummy", grab_dummy, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (grab_dummy); + gtk_box_pack_start (GTK_BOX (image_hbox), grab_dummy, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (grab_dummy), GTK_JUSTIFY_LEFT); + gtk_misc_set_padding (GTK_MISC (grab_dummy), 8, 0); + + image_text = gtk_entry_new (); + gtk_widget_set_name (image_text, "image_text"); + gtk_widget_ref (image_text); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "image_text", image_text, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (image_text); + gtk_box_pack_start (GTK_BOX (image_hbox), image_text, TRUE, TRUE, 0); + gtk_tooltips_set_tip (tooltips, image_text, "The directory from which images will be randomly chosen.", NULL); + + image_browse_button = gtk_button_new_with_label ("Browse"); + gtk_widget_set_name (image_browse_button, "image_browse_button"); + gtk_widget_ref (image_browse_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "image_browse_button", image_browse_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (image_browse_button); + gtk_box_pack_start (GTK_BOX (image_hbox), image_browse_button, FALSE, FALSE, 4); + + options_tab = gtk_label_new ("Advanced"); gtk_widget_set_name (options_tab, "options_tab"); gtk_widget_ref (options_tab); gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "options_tab", options_tab, @@ -1229,15 +1260,6 @@ create_xscreensaver_demo (void) gtk_signal_connect (GTK_OBJECT (exit_menu), "activate", GTK_SIGNAL_FUNC (exit_menu_cb), NULL); - gtk_signal_connect (GTK_OBJECT (cut_menu), "activate", - GTK_SIGNAL_FUNC (cut_menu_cb), - NULL); - gtk_signal_connect (GTK_OBJECT (copy_menu), "activate", - GTK_SIGNAL_FUNC (copy_menu_cb), - NULL); - gtk_signal_connect (GTK_OBJECT (paste_menu), "activate", - GTK_SIGNAL_FUNC (paste_menu_cb), - NULL); gtk_signal_connect (GTK_OBJECT (about_menu), "activate", GTK_SIGNAL_FUNC (about_menu_cb), NULL); @@ -1245,48 +1267,57 @@ create_xscreensaver_demo (void) GTK_SIGNAL_FUNC (doc_menu_cb), NULL); gtk_signal_connect (GTK_OBJECT (notebook), "switch_page", - GTK_SIGNAL_FUNC (pref_changed_cb), - NULL); - gtk_signal_connect (GTK_OBJECT (next), "clicked", - GTK_SIGNAL_FUNC (run_next_cb), + GTK_SIGNAL_FUNC (switch_page_cb), NULL); - gtk_signal_connect (GTK_OBJECT (prev), "clicked", - GTK_SIGNAL_FUNC (run_prev_cb), + gtk_signal_connect (GTK_OBJECT (lock_button), "toggled", + GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (enabled), "toggled", - GTK_SIGNAL_FUNC (enabled_cb), + gtk_signal_connect (GTK_OBJECT (timeout_spinbutton), "activate", + GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (demo), "clicked", - GTK_SIGNAL_FUNC (run_this_cb), + gtk_signal_connect (GTK_OBJECT (timeout_spinbutton), "focus_out_event", + GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (manual), "clicked", - GTK_SIGNAL_FUNC (manual_cb), + gtk_signal_connect (GTK_OBJECT (timeout_spinbutton), "changed", + GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_off_text), "activate", + gtk_signal_connect (GTK_OBJECT (lock_spinbutton), "activate", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_off_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (lock_spinbutton), "focus_out_event", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_suspend_text), "activate", + gtk_signal_connect (GTK_OBJECT (lock_spinbutton), "changed", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_suspend_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (cycle_spinbutton), "activate", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_standby_text), "activate", + gtk_signal_connect (GTK_OBJECT (cycle_spinbutton), "focus_out_event", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_standby_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (cycle_spinbutton), "changed", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (dpms_button), "toggled", + gtk_signal_connect (GTK_OBJECT (demo), "clicked", + GTK_SIGNAL_FUNC (run_this_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (settings), "clicked", + GTK_SIGNAL_FUNC (settings_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (next), "clicked", + GTK_SIGNAL_FUNC (run_next_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (prev), "clicked", + GTK_SIGNAL_FUNC (run_prev_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (verbose_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (fade_text), "activate", + gtk_signal_connect (GTK_OBJECT (capture_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (fade_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (splash_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); gtk_signal_connect (GTK_OBJECT (install_button), "toggled", @@ -1298,54 +1329,63 @@ create_xscreensaver_demo (void) gtk_signal_connect (GTK_OBJECT (unfade_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (grab_image_button), "toggled", + gtk_signal_connect (GTK_OBJECT (fade_spinbutton), "activate", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (image_browse_button), "clicked", - GTK_SIGNAL_FUNC (browse_image_dir_cb), + gtk_signal_connect (GTK_OBJECT (fade_spinbutton), "focus_out_event", + GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (grab_video_button), "toggled", + gtk_signal_connect (GTK_OBJECT (fade_spinbutton), "changed", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (grab_desk_button), "toggled", + gtk_signal_connect (GTK_OBJECT (dpms_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (image_text), "activate", + gtk_signal_connect (GTK_OBJECT (dpms_standby_spinbutton), "activate", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (image_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (dpms_standby_spinbutton), "focus_out_event", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (lock_text), "activate", + gtk_signal_connect (GTK_OBJECT (dpms_standby_spinbutton), "changed", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (lock_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (dpms_suspend_spinbutton), "activate", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (cycle_text), "activate", + gtk_signal_connect (GTK_OBJECT (dpms_suspend_spinbutton), "focus_out_event", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (cycle_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (dpms_suspend_spinbutton), "changed", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (timeout_text), "activate", + gtk_signal_connect (GTK_OBJECT (dpms_off_spinbutton), "activate", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (timeout_text), "focus_out_event", + gtk_signal_connect (GTK_OBJECT (dpms_off_spinbutton), "focus_out_event", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (lock_button), "toggled", + gtk_signal_connect (GTK_OBJECT (dpms_off_spinbutton), "changed", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (splash_button), "toggled", + gtk_signal_connect (GTK_OBJECT (grab_desk_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (capture_button), "toggled", + gtk_signal_connect (GTK_OBJECT (grab_video_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (verbose_button), "toggled", + gtk_signal_connect (GTK_OBJECT (grab_image_button), "toggled", GTK_SIGNAL_FUNC (pref_changed_cb), NULL); + gtk_signal_connect (GTK_OBJECT (image_text), "activate", + GTK_SIGNAL_FUNC (pref_changed_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (image_text), "focus_out_event", + GTK_SIGNAL_FUNC (pref_changed_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (image_browse_button), "clicked", + GTK_SIGNAL_FUNC (browse_image_dir_cb), + NULL); gtk_widget_grab_default (next); gtk_object_set_data (GTK_OBJECT (xscreensaver_demo), "tooltips", tooltips); @@ -1355,3 +1395,350 @@ create_xscreensaver_demo (void) return xscreensaver_demo; } +GtkWidget* +create_xscreensaver_settings_dialog (void) +{ + GtkWidget *xscreensaver_settings_dialog; + GtkWidget *dialog_vbox; + GtkWidget *dialog_top_table; + GtkWidget *opt_frame; + GtkWidget *opt_notebook; + GtkWidget *settings_vbox; + GtkWidget *std_label; + GtkWidget *opt_table; + GtkWidget *cmd_logo; + GtkWidget *visual_hbox; + GtkWidget *visual; + GtkWidget *visual_combo; + GList *visual_combo_items = NULL; + GtkWidget *combo_entry1; + GtkWidget *cmd_label; + GtkWidget *cmd_text; + GtkWidget *adv_label; + GtkWidget *doc_frame; + GtkWidget *doc_vbox; + GtkWidget *doc; + GtkWidget *doc_hbuttonbox; + GtkWidget *manual; + GtkWidget *dialog_action_area; + GtkWidget *actionarea_hbox; + GtkWidget *dialog_hbuttonbox; + GtkWidget *adv_button; + GtkWidget *std_button; + GtkWidget *ok_cancel_hbuttonbox; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkTooltips *tooltips; + + tooltips = gtk_tooltips_new (); + + xscreensaver_settings_dialog = gtk_dialog_new (); + gtk_widget_set_name (xscreensaver_settings_dialog, "xscreensaver_settings_dialog"); + gtk_object_set_data (GTK_OBJECT (xscreensaver_settings_dialog), "xscreensaver_settings_dialog", xscreensaver_settings_dialog); + gtk_window_set_title (GTK_WINDOW (xscreensaver_settings_dialog), "XScreenSaver: Mode-Specific Settings"); + GTK_WINDOW (xscreensaver_settings_dialog)->type = GTK_WINDOW_DIALOG; + gtk_window_set_modal (GTK_WINDOW (xscreensaver_settings_dialog), TRUE); + gtk_window_set_policy (GTK_WINDOW (xscreensaver_settings_dialog), TRUE, TRUE, FALSE); + gtk_window_set_wmclass (GTK_WINDOW (xscreensaver_settings_dialog), "settings", "XScreenSaver"); + + dialog_vbox = GTK_DIALOG (xscreensaver_settings_dialog)->vbox; + gtk_widget_set_name (dialog_vbox, "dialog_vbox"); + gtk_object_set_data (GTK_OBJECT (xscreensaver_settings_dialog), "dialog_vbox", dialog_vbox); + gtk_widget_show (dialog_vbox); + + dialog_top_table = gtk_table_new (1, 2, FALSE); + gtk_widget_set_name (dialog_top_table, "dialog_top_table"); + gtk_widget_ref (dialog_top_table); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "dialog_top_table", dialog_top_table, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (dialog_top_table); + gtk_box_pack_start (GTK_BOX (dialog_vbox), dialog_top_table, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (dialog_top_table), 8); + gtk_table_set_row_spacings (GTK_TABLE (dialog_top_table), 8); + gtk_table_set_col_spacings (GTK_TABLE (dialog_top_table), 8); + + opt_frame = gtk_frame_new ("Settings"); + gtk_widget_set_name (opt_frame, "opt_frame"); + gtk_widget_ref (opt_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "opt_frame", opt_frame, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_frame); + gtk_table_attach (GTK_TABLE (dialog_top_table), opt_frame, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 4, 8); + + opt_notebook = gtk_notebook_new (); + gtk_widget_set_name (opt_notebook, "opt_notebook"); + gtk_widget_ref (opt_notebook); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "opt_notebook", opt_notebook, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_notebook); + gtk_container_add (GTK_CONTAINER (opt_frame), opt_notebook); + gtk_container_set_border_width (GTK_CONTAINER (opt_notebook), 12); + gtk_notebook_set_show_border (GTK_NOTEBOOK (opt_notebook), FALSE); + gtk_notebook_set_tab_pos (GTK_NOTEBOOK (opt_notebook), GTK_POS_BOTTOM); + + settings_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (settings_vbox, "settings_vbox"); + gtk_widget_ref (settings_vbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "settings_vbox", settings_vbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (settings_vbox); + gtk_container_add (GTK_CONTAINER (opt_notebook), settings_vbox); + + std_label = gtk_label_new ("Standard"); + gtk_widget_set_name (std_label, "std_label"); + gtk_widget_ref (std_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "std_label", std_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (std_label); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (opt_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (opt_notebook), 0), std_label); + + opt_table = gtk_table_new (4, 2, FALSE); + gtk_widget_set_name (opt_table, "opt_table"); + gtk_widget_ref (opt_table); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "opt_table", opt_table, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_table); + gtk_container_add (GTK_CONTAINER (opt_notebook), opt_table); + + cmd_logo = create_pixmap (xscreensaver_settings_dialog, "screensaver-cmndln.xpm"); + gtk_widget_set_name (cmd_logo, "cmd_logo"); + gtk_widget_ref (cmd_logo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "cmd_logo", cmd_logo, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cmd_logo); + gtk_table_attach (GTK_TABLE (opt_table), cmd_logo, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_misc_set_padding (GTK_MISC (cmd_logo), 4, 8); + + visual_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (visual_hbox, "visual_hbox"); + gtk_widget_ref (visual_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "visual_hbox", visual_hbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (visual_hbox); + gtk_table_attach (GTK_TABLE (opt_table), visual_hbox, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + visual = gtk_label_new ("Visual:"); + gtk_widget_set_name (visual, "visual"); + gtk_widget_ref (visual); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "visual", visual, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (visual); + gtk_box_pack_start (GTK_BOX (visual_hbox), visual, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (visual), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (visual), 1, 0.5); + gtk_misc_set_padding (GTK_MISC (visual), 4, 0); + + visual_combo = gtk_combo_new (); + gtk_widget_set_name (visual_combo, "visual_combo"); + gtk_widget_ref (visual_combo); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "visual_combo", visual_combo, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (visual_combo); + gtk_box_pack_start (GTK_BOX (visual_hbox), visual_combo, FALSE, FALSE, 0); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Any"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Best"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Default"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Default-N"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "GL"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "TrueColor"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "PseudoColor"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "StaticGray"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "GrayScale"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "DirectColor"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Color"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Gray"); + visual_combo_items = g_list_append (visual_combo_items, (gpointer) "Mono"); + gtk_combo_set_popdown_strings (GTK_COMBO (visual_combo), visual_combo_items); + g_list_free (visual_combo_items); + + combo_entry1 = GTK_COMBO (visual_combo)->entry; + gtk_widget_set_name (combo_entry1, "combo_entry1"); + gtk_widget_ref (combo_entry1); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "combo_entry1", combo_entry1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (combo_entry1); + gtk_tooltips_set_tip (tooltips, combo_entry1, "The X visual type that this demo will require. If that visual is available it will be used, otherwise, this demo will not be run.", NULL); + gtk_entry_set_text (GTK_ENTRY (combo_entry1), "Any"); + + cmd_label = gtk_label_new ("Command Line:"); + gtk_widget_set_name (cmd_label, "cmd_label"); + gtk_widget_ref (cmd_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "cmd_label", cmd_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cmd_label); + gtk_table_attach (GTK_TABLE (opt_table), cmd_label, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (cmd_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (cmd_label), 0, 1); + gtk_misc_set_padding (GTK_MISC (cmd_label), 0, 2); + + cmd_text = gtk_entry_new (); + gtk_widget_set_name (cmd_text, "cmd_text"); + gtk_widget_ref (cmd_text); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "cmd_text", cmd_text, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cmd_text); + gtk_table_attach (GTK_TABLE (opt_table), cmd_text, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (cmd_text, 80, -2); + + adv_label = gtk_label_new ("Advanced"); + gtk_widget_set_name (adv_label, "adv_label"); + gtk_widget_ref (adv_label); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "adv_label", adv_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (adv_label); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (opt_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (opt_notebook), 1), adv_label); + + doc_frame = gtk_frame_new ("Description"); + gtk_widget_set_name (doc_frame, "doc_frame"); + gtk_widget_ref (doc_frame); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "doc_frame", doc_frame, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (doc_frame); + gtk_table_attach (GTK_TABLE (dialog_top_table), doc_frame, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 4, 8); + + doc_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (doc_vbox, "doc_vbox"); + gtk_widget_ref (doc_vbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "doc_vbox", doc_vbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (doc_vbox); + gtk_container_add (GTK_CONTAINER (doc_frame), doc_vbox); + + doc = gtk_label_new (""); + gtk_widget_set_name (doc, "doc"); + gtk_widget_ref (doc); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "doc", doc, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (doc); + gtk_box_pack_start (GTK_BOX (doc_vbox), doc, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (doc), GTK_JUSTIFY_LEFT); + gtk_label_set_line_wrap (GTK_LABEL (doc), TRUE); + gtk_misc_set_alignment (GTK_MISC (doc), 0, 0); + gtk_misc_set_padding (GTK_MISC (doc), 10, 10); + + doc_hbuttonbox = gtk_hbutton_box_new (); + gtk_widget_set_name (doc_hbuttonbox, "doc_hbuttonbox"); + gtk_widget_ref (doc_hbuttonbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "doc_hbuttonbox", doc_hbuttonbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (doc_hbuttonbox); + gtk_box_pack_end (GTK_BOX (doc_vbox), doc_hbuttonbox, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (doc_hbuttonbox), 4); + gtk_button_box_set_layout (GTK_BUTTON_BOX (doc_hbuttonbox), GTK_BUTTONBOX_END); + + manual = gtk_button_new_with_label ("Documentation..."); + gtk_widget_set_name (manual, "manual"); + gtk_widget_ref (manual); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "manual", manual, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (manual); + gtk_container_add (GTK_CONTAINER (doc_hbuttonbox), manual); + GTK_WIDGET_SET_FLAGS (manual, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, manual, "Click here to read the manual for this display mode, if it has one.", NULL); + + dialog_action_area = GTK_DIALOG (xscreensaver_settings_dialog)->action_area; + gtk_widget_set_name (dialog_action_area, "dialog_action_area"); + gtk_object_set_data (GTK_OBJECT (xscreensaver_settings_dialog), "dialog_action_area", dialog_action_area); + gtk_widget_show (dialog_action_area); + gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area), 10); + + actionarea_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (actionarea_hbox, "actionarea_hbox"); + gtk_widget_ref (actionarea_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "actionarea_hbox", actionarea_hbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (actionarea_hbox); + gtk_box_pack_start (GTK_BOX (dialog_action_area), actionarea_hbox, TRUE, TRUE, 0); + + dialog_hbuttonbox = gtk_hbutton_box_new (); + gtk_widget_set_name (dialog_hbuttonbox, "dialog_hbuttonbox"); + gtk_widget_ref (dialog_hbuttonbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "dialog_hbuttonbox", dialog_hbuttonbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (dialog_hbuttonbox); + gtk_box_pack_start (GTK_BOX (actionarea_hbox), dialog_hbuttonbox, TRUE, TRUE, 0); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_hbuttonbox), GTK_BUTTONBOX_SPREAD); + + adv_button = gtk_button_new_with_label ("Advanced >>"); + gtk_widget_set_name (adv_button, "adv_button"); + gtk_widget_ref (adv_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "adv_button", adv_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (adv_button); + gtk_container_add (GTK_CONTAINER (dialog_hbuttonbox), adv_button); + GTK_WIDGET_SET_FLAGS (adv_button, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, adv_button, "Edit the command line directly.", NULL); + + std_button = gtk_button_new_with_label ("Standard <<"); + gtk_widget_set_name (std_button, "std_button"); + gtk_widget_ref (std_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "std_button", std_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (std_button); + gtk_container_add (GTK_CONTAINER (dialog_hbuttonbox), std_button); + GTK_WIDGET_SET_FLAGS (std_button, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, std_button, "Back to the graphical configuration options.", NULL); + + ok_cancel_hbuttonbox = gtk_hbutton_box_new (); + gtk_widget_set_name (ok_cancel_hbuttonbox, "ok_cancel_hbuttonbox"); + gtk_widget_ref (ok_cancel_hbuttonbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "ok_cancel_hbuttonbox", ok_cancel_hbuttonbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ok_cancel_hbuttonbox); + gtk_box_pack_start (GTK_BOX (actionarea_hbox), ok_cancel_hbuttonbox, TRUE, TRUE, 0); + gtk_button_box_set_layout (GTK_BUTTON_BOX (ok_cancel_hbuttonbox), GTK_BUTTONBOX_END); + + ok_button = gtk_button_new_with_label ("OK"); + gtk_widget_set_name (ok_button, "ok_button"); + gtk_widget_ref (ok_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "ok_button", ok_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ok_button); + gtk_container_add (GTK_CONTAINER (ok_cancel_hbuttonbox), ok_button); + GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT); + + cancel_button = gtk_button_new_with_label ("Cancel"); + gtk_widget_set_name (cancel_button, "cancel_button"); + gtk_widget_ref (cancel_button); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_settings_dialog), "cancel_button", cancel_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (cancel_button); + gtk_container_add (GTK_CONTAINER (ok_cancel_hbuttonbox), cancel_button); + GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT); + + gtk_signal_connect (GTK_OBJECT (opt_notebook), "switch_page", + GTK_SIGNAL_FUNC (settings_switch_page_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (manual), "clicked", + GTK_SIGNAL_FUNC (manual_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (adv_button), "clicked", + GTK_SIGNAL_FUNC (settings_adv_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (std_button), "clicked", + GTK_SIGNAL_FUNC (settings_std_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (ok_button), "clicked", + GTK_SIGNAL_FUNC (settings_ok_cb), + NULL); + gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked", + GTK_SIGNAL_FUNC (settings_cancel_cb), + NULL); + + gtk_object_set_data (GTK_OBJECT (xscreensaver_settings_dialog), "tooltips", tooltips); + + return xscreensaver_settings_dialog; +} + diff --git a/driver/demo-Gtk-widgets.h b/driver/demo-Gtk-widgets.h index 54ca500a..298c5171 100644 --- a/driver/demo-Gtk-widgets.h +++ b/driver/demo-Gtk-widgets.h @@ -3,3 +3,4 @@ */ GtkWidget* create_xscreensaver_demo (void); +GtkWidget* create_xscreensaver_settings_dialog (void); diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c index c11224d4..3c83e8ab 100644 --- a/driver/demo-Gtk.c +++ b/driver/demo-Gtk.c @@ -1,5 +1,5 @@ /* demo-Gtk.c --- implements the interactive demo-mode and options dialogs. - * xscreensaver, Copyright (c) 1993-2001 Jamie Zawinski + * xscreensaver, Copyright (c) 1993-2002 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -35,6 +35,14 @@ #include #include + +#include +#include +#ifdef HAVE_SYS_WAIT_H +# include /* for waitpid() and associated macros */ +#endif + + #include /* for CARD32 */ #include /* for XA_INTEGER */ #include @@ -75,6 +83,8 @@ #include "logo-180.xpm" #include "demo-Gtk-widgets.h" +#include "demo-Gtk-support.h" +#include "demo-Gtk-conf.h" #include #include @@ -88,19 +98,49 @@ char *progname = 0; char *progclass = "XScreenSaver"; XrmDatabase db; -static Bool crapplet_p = False; -static Bool initializing_p; -static GtkWidget *toplevel_widget; +/* The order of the items in the mode menu. */ +static int mode_menu_order[] = { + DONT_BLANK, BLANK_ONLY, ONE_HACK, RANDOM_HACKS }; + typedef struct { - saver_preferences *a, *b; -} prefs_pair; -static void *global_prefs_pair; /* I hate C so much... */ + char *short_version; /* version number of this xscreensaver build */ + + GtkWidget *toplevel_widget; /* the main window */ + GtkWidget *base_widget; /* root of our hierarchy (for name lookups) */ + GtkWidget *popup_widget; /* the "Settings" dialog */ + conf_data *cdata; /* private data for per-hack configuration */ + + Bool debug_p; /* whether to print diagnostics */ + Bool initializing_p; /* flag for breaking recursion loops */ + Bool saving_p; /* flag for breaking recursion loops */ + + char *desired_preview_cmd; /* subprocess we intend to run */ + char *running_preview_cmd; /* subprocess we are currently running */ + pid_t running_preview_pid; /* pid of forked subproc (might be dead) */ + Bool running_preview_error_p; /* whether the pid died abnormally */ -char *blurb (void) { return progname; } + Bool preview_suppressed_p; /* flag meaning "don't launch subproc" */ + int subproc_timer_id; /* timer to delay subproc launch */ + int subproc_check_timer_id; /* timer to check whether it started up */ + int subproc_check_countdown; /* how many more checks left */ + int preview_nice_level; -static char *short_version = 0; + int *list_elt_to_hack_number; /* table for sorting the hack list */ + int *hack_number_to_list_elt; /* the inverse table */ + + int _selected_list_element; /* don't use this: call + selected_list_element() instead */ + + saver_preferences prefs; + +} state; + + +/* Total fucking evilness due to the fact that it's rocket science to get + a closure object of our own down into the various widget callbacks. */ +static state *global_state_kludge; Atom XA_VROOT; Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION; @@ -108,21 +148,59 @@ Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO; Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT; -static void populate_demo_window (GtkWidget *toplevel, - int which, prefs_pair *pair); -static void populate_prefs_page (GtkWidget *top, prefs_pair *pair); -static int apply_changes_and_save (GtkWidget *widget); -static int maybe_reload_init_file (GtkWidget *widget, prefs_pair *pair); -static void await_xscreensaver (GtkWidget *widget); +static void populate_demo_window (state *, int list_elt); +static void populate_prefs_page (state *); +static void populate_popup_window (state *); + +static Bool flush_dialog_changes_and_save (state *); +static Bool flush_popup_changes_and_save (state *); + +static int maybe_reload_init_file (state *); +static void await_xscreensaver (state *); + +static void schedule_preview (state *, const char *cmd); +static void kill_preview_subproc (state *); +static void schedule_preview_check (state *); + /* Some random utility functions */ +const char * +blurb (void) +{ + time_t now = time ((time_t *) 0); + char *ct = (char *) ctime (&now); + static char buf[255]; + int n = strlen(progname); + if (n > 100) n = 99; + strncpy(buf, progname, n); + buf[n++] = ':'; + buf[n++] = ' '; + strncpy(buf+n, ct+11, 8); + strcpy(buf+n+9, ": "); + return buf; +} + + static GtkWidget * -name_to_widget (GtkWidget *widget, const char *name) +name_to_widget (state *s, const char *name) { - return (GtkWidget *) gtk_object_get_data (GTK_OBJECT(toplevel_widget), name); + GtkWidget *w; + if (!s) abort(); + if (!name) abort(); + if (!*name) abort(); + + w = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (s->base_widget), + name); + if (w) return w; + w = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (s->popup_widget), + name); + if (w) return w; + + fprintf (stderr, "%s: no widget \"%s\"\n", blurb(), name); + abort(); } @@ -139,7 +217,7 @@ ensure_selected_item_visible (GtkWidget *widget) GList *kids; int nkids = 0; GtkWidget *selected = 0; - int which = -1; + int list_elt = -1; GtkAdjustment *adj; gint parent_h, child_y, child_h, children_h, ignore; double ratio_t, ratio_b; @@ -170,7 +248,7 @@ ensure_selected_item_visible (GtkWidget *widget) if (!selected) return; - which = gtk_list_child_position (list_widget, GTK_WIDGET (selected)); + list_elt = gtk_list_child_position (list_widget, GTK_WIDGET (selected)); for (kids = gtk_container_children (GTK_CONTAINER (list_widget)); kids; kids = kids->next) @@ -249,11 +327,14 @@ warning_dialog (GtkWidget *parent, const char *message, GtkWidget *cancel = 0; int i = 0; - while (parent->parent) + while (parent && !parent->window) parent = parent->parent; if (!GTK_WIDGET (parent)->window) /* too early to pop up transient dialogs */ - return; + { + fprintf (stderr, "%s: too early for dialog?\n", progname); + return; + } head = msg; while (head) @@ -348,12 +429,12 @@ warning_dialog (GtkWidget *parent, const char *message, static void -run_cmd (GtkWidget *widget, Atom command, int arg) +run_cmd (state *s, Atom command, int arg) { char *err = 0; int status; - apply_changes_and_save (widget); + flush_dialog_changes_and_save (s); status = xscreensaver_command (GDK_DISPLAY(), command, arg, False, &err); if (status < 0) { @@ -362,23 +443,28 @@ run_cmd (GtkWidget *widget, Atom command, int arg) sprintf (buf, "Error:\n\n%s", err); else strcpy (buf, "Unknown error!"); - warning_dialog (widget, buf, False, 100); + warning_dialog (s->toplevel_widget, buf, False, 100); } if (err) free (err); } static void -run_hack (GtkWidget *widget, int which, Bool report_errors_p) +run_hack (state *s, int list_elt, Bool report_errors_p) { - if (which < 0) return; - apply_changes_and_save (widget); + int hack_number; + if (list_elt < 0) return; + hack_number = s->list_elt_to_hack_number[list_elt]; + + flush_dialog_changes_and_save (s); + schedule_preview (s, 0); if (report_errors_p) - run_cmd (widget, XA_DEMO, which + 1); + run_cmd (s, XA_DEMO, hack_number + 1); else { char *s = 0; - xscreensaver_command (GDK_DISPLAY(), XA_DEMO, which + 1, False, &s); + xscreensaver_command (GDK_DISPLAY(), XA_DEMO, hack_number + 1, + False, &s); if (s) free (s); } } @@ -391,48 +477,21 @@ run_hack (GtkWidget *widget, int which, Bool report_errors_p) void exit_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - apply_changes_and_save (GTK_WIDGET (menuitem)); + state *s = global_state_kludge; /* I hate C so much... */ + flush_dialog_changes_and_save (s); + kill_preview_subproc (s); gtk_main_quit (); } static void -wm_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +wm_toplevel_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) { - apply_changes_and_save (widget); + state *s = (state *) data; + flush_dialog_changes_and_save (s); gtk_main_quit (); } -void -cut_menu_cb (GtkMenuItem *menuitem, gpointer user_data) -{ - /* #### */ - warning_dialog (GTK_WIDGET (menuitem), - "Error:\n\n" - "cut unimplemented\n", False, 1); -} - - -void -copy_menu_cb (GtkMenuItem *menuitem, gpointer user_data) -{ - /* #### */ - warning_dialog (GTK_WIDGET (menuitem), - "Error:\n\n" - "copy unimplemented\n", False, 1); -} - - -void -paste_menu_cb (GtkMenuItem *menuitem, gpointer user_data) -{ - /* #### */ - warning_dialog (GTK_WIDGET (menuitem), - "Error:\n\n" - "paste unimplemented\n", False, 1); -} - - void about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { @@ -446,7 +505,7 @@ about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) *s = 0; s += 2; - sprintf(copy, "Copyright \251 1991-2001 %s", s); + sprintf(copy, "Copyright \251 1991-2002 %s", s); sprintf (msg, "%s\n\n%s", copy, desc); @@ -546,15 +605,13 @@ about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) void doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - - saver_preferences *p = pair->a; + state *s = global_state_kludge; /* I hate C so much... */ + saver_preferences *p = &s->prefs; char *help_command; if (!p->help_url || !*p->help_url) { - warning_dialog (GTK_WIDGET (menuitem), + warning_dialog (s->toplevel_widget, "Error:\n\n" "No Help URL has been specified.\n", False, 100); return; @@ -574,41 +631,41 @@ doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) void activate_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - run_cmd (GTK_WIDGET (menuitem), XA_ACTIVATE, 0); + state *s = global_state_kludge; /* I hate C so much... */ + run_cmd (s, XA_ACTIVATE, 0); } void lock_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - run_cmd (GTK_WIDGET (menuitem), XA_LOCK, 0); + state *s = global_state_kludge; /* I hate C so much... */ + run_cmd (s, XA_LOCK, 0); } void kill_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - run_cmd (GTK_WIDGET (menuitem), XA_EXIT, 0); + state *s = global_state_kludge; /* I hate C so much... */ + run_cmd (s, XA_EXIT, 0); } void restart_menu_cb (GtkWidget *widget, gpointer user_data) { -#if 0 - run_cmd (GTK_WIDGET (widget), XA_RESTART, 0); -#else - apply_changes_and_save (GTK_WIDGET (widget)); + state *s = global_state_kludge; /* I hate C so much... */ + flush_dialog_changes_and_save (s); xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL); sleep (1); system ("xscreensaver -nosplash &"); -#endif - await_xscreensaver (GTK_WIDGET (widget)); + await_xscreensaver (s); } static void -await_xscreensaver (GtkWidget *widget) +await_xscreensaver (state *s) { int countdown = 5; @@ -622,7 +679,8 @@ await_xscreensaver (GtkWidget *widget) server_xscreensaver_version (dpy, &rversion, 0, 0); /* If it's not there yet, wait a second... */ - sleep (1); + if (!rversion) + sleep (1); } /* if (dialog) gtk_widget_destroy (dialog);*/ @@ -664,48 +722,46 @@ await_xscreensaver (GtkWidget *widget) else strcat (buf, "Please check your $PATH and permissions."); - warning_dialog (widget, buf, False, 1); + warning_dialog (s->toplevel_widget, buf, False, 1); } } -static int _selected_hack_number = -1; - static int -selected_hack_number (GtkWidget *toplevel) +selected_list_element (state *s) { -#if 0 - GtkViewport *vp = GTK_VIEWPORT (name_to_widget (toplevel, "viewport")); - GtkList *list_widget = GTK_LIST (GTK_BIN(vp)->child); - GList *slist = list_widget->selection; - GtkWidget *selected = (slist ? GTK_WIDGET (slist->data) : 0); - int which = (selected - ? gtk_list_child_position (list_widget, GTK_WIDGET (selected)) - : -1); - return which; -#else - return _selected_hack_number; -#endif + return s->_selected_list_element; } static int -demo_write_init_file (GtkWidget *widget, saver_preferences *p) +demo_write_init_file (state *s, saver_preferences *p) { - if (!write_init_file (p, short_version, False)) - return 0; + +#if 0 + /* #### try to figure out why shit keeps getting reordered... */ + if (strcmp (s->prefs.screenhacks[0]->name, "DNA Lounge Slideshow")) + abort(); +#endif + + if (!write_init_file (p, s->short_version, False)) + { + if (s->debug_p) + fprintf (stderr, "%s: wrote %s\n", blurb(), init_file_name()); + return 0; + } else { const char *f = init_file_name(); if (!f || !*f) - warning_dialog (widget, + warning_dialog (s->toplevel_widget, "Error:\n\nCouldn't determine init file name!\n", False, 100); else { char *b = (char *) malloc (strlen(f) + 1024); sprintf (b, "Error:\n\nCouldn't write %s\n", f); - warning_dialog (widget, b, False, 100); + warning_dialog (s->toplevel_widget, b, False, 100); free (b); } return -1; @@ -713,132 +769,40 @@ demo_write_init_file (GtkWidget *widget, saver_preferences *p) } -static int -apply_changes_and_save_1 (GtkWidget *widget) -{ - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - saver_preferences *p = pair->a; - GtkList *list_widget = - GTK_LIST (name_to_widget (widget, "list")); - int which = selected_hack_number (widget); - - GtkEntry *cmd = GTK_ENTRY (name_to_widget (widget, "cmd_text")); - GtkToggleButton *enabled = - GTK_TOGGLE_BUTTON (name_to_widget (widget, "enabled")); - GtkCombo *vis = GTK_COMBO (name_to_widget (widget, "visual_combo")); - - Bool enabled_p = gtk_toggle_button_get_active (enabled); - const char *visual = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (vis)->entry)); - const char *command = gtk_entry_get_text (cmd); - - char c; - unsigned long id; - - if (which < 0) return -1; - - if (maybe_reload_init_file (widget, pair) != 0) - return 1; - - /* Sanity-check and canonicalize whatever the user typed into the combo box. - */ - if (!strcasecmp (visual, "")) visual = ""; - else if (!strcasecmp (visual, "any")) visual = ""; - else if (!strcasecmp (visual, "default")) visual = "Default"; - else if (!strcasecmp (visual, "default-n")) visual = "Default-N"; - else if (!strcasecmp (visual, "default-i")) visual = "Default-I"; - else if (!strcasecmp (visual, "best")) visual = "Best"; - else if (!strcasecmp (visual, "mono")) visual = "Mono"; - else if (!strcasecmp (visual, "monochrome")) visual = "Mono"; - else if (!strcasecmp (visual, "gray")) visual = "Gray"; - else if (!strcasecmp (visual, "grey")) visual = "Gray"; - else if (!strcasecmp (visual, "color")) visual = "Color"; - else if (!strcasecmp (visual, "gl")) visual = "GL"; - else if (!strcasecmp (visual, "staticgray")) visual = "StaticGray"; - else if (!strcasecmp (visual, "staticcolor")) visual = "StaticColor"; - else if (!strcasecmp (visual, "truecolor")) visual = "TrueColor"; - else if (!strcasecmp (visual, "grayscale")) visual = "GrayScale"; - else if (!strcasecmp (visual, "greyscale")) visual = "GrayScale"; - else if (!strcasecmp (visual, "pseudocolor")) visual = "PseudoColor"; - else if (!strcasecmp (visual, "directcolor")) visual = "DirectColor"; - else if (1 == sscanf (visual, " %ld %c", &id, &c)) ; - else if (1 == sscanf (visual, " 0x%lx %c", &id, &c)) ; - else - { - gdk_beep (); /* unparsable */ - visual = ""; - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), "Any"); - } - - ensure_selected_item_visible (GTK_WIDGET (list_widget)); - - if (!p->screenhacks[which]->visual) - p->screenhacks[which]->visual = strdup (""); - if (!p->screenhacks[which]->command) - p->screenhacks[which]->command = strdup (""); - - if (p->screenhacks[which]->enabled_p != enabled_p || - !!strcasecmp (p->screenhacks[which]->visual, visual) || - !!strcasecmp (p->screenhacks[which]->command, command)) - { - /* Something was changed -- store results into the struct, - and write the file. - */ - free (p->screenhacks[which]->visual); - free (p->screenhacks[which]->command); - p->screenhacks[which]->visual = strdup (visual); - p->screenhacks[which]->command = strdup (command); - p->screenhacks[which]->enabled_p = enabled_p; - - return demo_write_init_file (widget, p); - } - - /* No changes made */ - return 0; -} - -void prefs_ok_cb (GtkButton *button, gpointer user_data); - -static int -apply_changes_and_save (GtkWidget *widget) -{ - prefs_ok_cb ((GtkButton *) widget, 0); - return apply_changes_and_save_1 (widget); -} - - void run_this_cb (GtkButton *button, gpointer user_data) { - int which = selected_hack_number (GTK_WIDGET (button)); - if (which < 0) return; - if (0 == apply_changes_and_save (GTK_WIDGET (button))) - run_hack (GTK_WIDGET (button), which, True); + state *s = global_state_kludge; /* I hate C so much... */ + int list_elt = selected_list_element (s); + if (list_elt < 0) return; + if (!flush_dialog_changes_and_save (s)) + run_hack (s, list_elt, True); } void manual_cb (GtkButton *button, gpointer user_data) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - saver_preferences *p = pair->a; - GtkList *list_widget = - GTK_LIST (name_to_widget (GTK_WIDGET (button), "list")); - int which = selected_hack_number (GTK_WIDGET (button)); - char *name, *name2, *cmd, *s; - if (which < 0) return; - apply_changes_and_save (GTK_WIDGET (button)); + state *s = global_state_kludge; /* I hate C so much... */ + saver_preferences *p = &s->prefs; + GtkList *list_widget = GTK_LIST (name_to_widget (s, "list")); + int list_elt = selected_list_element (s); + int hack_number; + char *name, *name2, *cmd, *str; + if (list_elt < 0) return; + hack_number = s->list_elt_to_hack_number[list_elt]; + + flush_dialog_changes_and_save (s); ensure_selected_item_visible (GTK_WIDGET (list_widget)); - name = strdup (p->screenhacks[which]->command); + name = strdup (p->screenhacks[hack_number]->command); name2 = name; while (isspace (*name2)) name2++; - s = name2; - while (*s && !isspace (*s)) s++; - *s = 0; - s = strrchr (name2, '/'); - if (s) name = s+1; + str = name2; + while (*str && !isspace (*str)) str++; + *str = 0; + str = strrchr (name2, '/'); + if (str) name = str+1; cmd = get_string_resource ("manualCommand", "ManualCommand"); if (cmd) @@ -863,57 +827,140 @@ manual_cb (GtkButton *button, gpointer user_data) } +static void +force_list_select_item (state *s, GtkList *list, int list_elt, Bool scroll_p) +{ + GtkWidget *parent = name_to_widget (s, "scroller"); + Bool was = GTK_WIDGET_IS_SENSITIVE (parent); + + if (!was) gtk_widget_set_sensitive (parent, True); + gtk_list_select_item (GTK_LIST (list), list_elt); + if (scroll_p) ensure_selected_item_visible (GTK_WIDGET (list)); + if (!was) gtk_widget_set_sensitive (parent, False); +} + + void run_next_cb (GtkButton *button, gpointer user_data) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - saver_preferences *p = pair->a; + state *s = global_state_kludge; /* I hate C so much... */ + saver_preferences *p = &s->prefs; + Bool ops = s->preview_suppressed_p; GtkList *list_widget = - GTK_LIST (name_to_widget (GTK_WIDGET (button), "list")); - int which = selected_hack_number (GTK_WIDGET (button)); + GTK_LIST (name_to_widget (s, "list")); + int list_elt = selected_list_element (s); - if (which < 0) - which = 0; + if (list_elt < 0) + list_elt = 0; else - which++; + list_elt++; - if (which >= p->screenhacks_count) - which = 0; + if (list_elt >= p->screenhacks_count) + list_elt = 0; - apply_changes_and_save (GTK_WIDGET (button)); - gtk_list_select_item (GTK_LIST (list_widget), which); - ensure_selected_item_visible (GTK_WIDGET (list_widget)); - populate_demo_window (GTK_WIDGET (button), which, pair); - run_hack (GTK_WIDGET (button), which, False); + s->preview_suppressed_p = True; + + flush_dialog_changes_and_save (s); + force_list_select_item (s, GTK_LIST (list_widget), list_elt, True); + populate_demo_window (s, list_elt); + run_hack (s, list_elt, False); + + s->preview_suppressed_p = ops; } void run_prev_cb (GtkButton *button, gpointer user_data) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - saver_preferences *p = pair->a; + state *s = global_state_kludge; /* I hate C so much... */ + saver_preferences *p = &s->prefs; + Bool ops = s->preview_suppressed_p; GtkList *list_widget = - GTK_LIST (name_to_widget (GTK_WIDGET (button), "list")); - int which = selected_hack_number (GTK_WIDGET (button)); + GTK_LIST (name_to_widget (s, "list")); + int list_elt = selected_list_element (s); - if (which < 0) - which = p->screenhacks_count - 1; + if (list_elt < 0) + list_elt = p->screenhacks_count - 1; else - which--; + list_elt--; - if (which < 0) - which = p->screenhacks_count - 1; + if (list_elt < 0) + list_elt = p->screenhacks_count - 1; - apply_changes_and_save (GTK_WIDGET (button)); - gtk_list_select_item (GTK_LIST (list_widget), which); - ensure_selected_item_visible (GTK_WIDGET (list_widget)); - populate_demo_window (GTK_WIDGET (button), which, pair); - run_hack (GTK_WIDGET (button), which, False); + s->preview_suppressed_p = True; + + flush_dialog_changes_and_save (s); + force_list_select_item (s, GTK_LIST (list_widget), list_elt, True); + populate_demo_window (s, list_elt); + run_hack (s, list_elt, False); + + s->preview_suppressed_p = ops; +} + + +/* Writes the given settings into prefs. + Returns true if there was a change, False otherwise. + command and/or visual may be 0, or enabled_p may be -1, meaning "no change". + */ +static Bool +flush_changes (state *s, + int list_elt, + int enabled_p, + const char *command, + const char *visual) +{ + saver_preferences *p = &s->prefs; + Bool changed = False; + screenhack *hack; + int hack_number; + if (list_elt < 0 || list_elt >= p->screenhacks_count) + abort(); + + hack_number = s->list_elt_to_hack_number[list_elt]; + hack = p->screenhacks[hack_number]; + + if (enabled_p != -1 && + enabled_p != hack->enabled_p) + { + hack->enabled_p = enabled_p; + changed = True; + if (s->debug_p) + fprintf (stderr, "%s: \"%s\": enabled => %d\n", + blurb(), hack->name, enabled_p); + } + + if (command) + { + if (!hack->command || !!strcmp (command, hack->command)) + { + if (hack->command) free (hack->command); + hack->command = strdup (command); + changed = True; + if (s->debug_p) + fprintf (stderr, "%s: \"%s\": command => \"%s\"\n", + blurb(), hack->name, command); + } + } + + if (visual) + { + const char *ov = hack->visual; + if (!ov || !*ov) ov = "any"; + if (!*visual) visual = "any"; + if (!!strcasecmp (visual, ov)) + { + if (hack->visual) free (hack->visual); + hack->visual = strdup (visual); + changed = True; + if (s->debug_p) + fprintf (stderr, "%s: \"%s\": visual => \"%s\"\n", + blurb(), hack->name, visual); + } + } + + return changed; } @@ -921,12 +968,22 @@ run_prev_cb (GtkButton *button, gpointer user_data) this parses the text, and does error checking. */ static void -hack_time_text (GtkWidget *widget, const char *line, Time *store, Bool sec_p) +hack_time_text (state *s, const char *line, Time *store, Bool sec_p) { if (*line) { int value; - value = parse_time ((char *) line, sec_p, True); + if (!sec_p || strchr (line, ':')) + value = parse_time ((char *) line, sec_p, True); + else + { + char c; + if (sscanf (line, "%u%c", &value, &c) != 1) + value = -1; + if (!sec_p) + value *= 60; + } + value *= 1000; /* Time measures in microseconds */ if (value < 0) { @@ -935,7 +992,7 @@ hack_time_text (GtkWidget *widget, const char *line, Time *store, Bool sec_p) "Error:\n\n" "Unparsable time format: \"%s\"\n", line); - warning_dialog (widget, b, False, 100); + warning_dialog (s->toplevel_widget, b, False, 100); } else *store = value; @@ -996,81 +1053,79 @@ normalize_directory (const char *path) while (s[0] == '/' && s[1] == '/') strcpy (s, s+1); + /* and strip trailing whitespace for good measure. */ + L = strlen(p2); + while (isspace(p2[L-1])) + p2[--L] = 0; + return p2; } -void -prefs_ok_cb (GtkButton *button, gpointer user_data) +/* Flush out any changes made in the main dialog window (where changes + take place immediately: clicking on a checkbox causes the init file + to be written right away.) + */ +static Bool +flush_dialog_changes_and_save (state *s) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - - saver_preferences *p = pair->a; - saver_preferences *p2 = pair->b; + saver_preferences *p = &s->prefs; + saver_preferences P2, *p2 = &P2; + GtkList *list_widget = GTK_LIST (name_to_widget (s, "list")); + GList *kids = gtk_container_children (GTK_CONTAINER (list_widget)); Bool changed = False; + GtkWidget *w; + int i; + + if (s->saving_p) return False; + s->saving_p = True; + + *p2 = *p; + + /* Flush any checkbox changes in the list down into the prefs struct. + */ + for (i = 0; kids; kids = kids->next, i++) + { + GtkWidget *line = GTK_WIDGET (kids->data); + GtkWidget *line_hbox = GTK_WIDGET (GTK_BIN (line)->child); + GtkWidget *line_check = + GTK_WIDGET (gtk_container_children (GTK_CONTAINER (line_hbox))->data); + Bool checked = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (line_check)); + + if (flush_changes (s, i, (checked ? 1 : 0), 0, 0)) + changed = True; + } + + + /* Flush the non-hack-specific settings down into the prefs struct. + */ -# define SECONDS(field, name) \ - hack_time_text (GTK_WIDGET(button), gtk_entry_get_text (\ - GTK_ENTRY (name_to_widget (GTK_WIDGET(button), (name)))), \ - (field), \ - True) - -# define MINUTES(field, name) \ - hack_time_text (GTK_WIDGET(button), gtk_entry_get_text (\ - GTK_ENTRY (name_to_widget (GTK_WIDGET(button), (name)))), \ - (field), \ - False) - -# define INTEGER(field, name) do { \ - char *line = gtk_entry_get_text (\ - GTK_ENTRY (name_to_widget (GTK_WIDGET(button), (name)))); \ - unsigned int value; \ - char c; \ - if (! *line) \ - ; \ - else if (sscanf (line, "%u%c", &value, &c) != 1) \ - { \ - char b[255]; \ - sprintf (b, "Error:\n\n" "Not an integer: \"%s\"\n", line); \ - warning_dialog (GTK_WIDGET (button), b, False, 100); \ - } \ - else \ - *(field) = value; \ - } while(0) - -# define PATHNAME(field, name) do { \ - char *line = gtk_entry_get_text (\ - GTK_ENTRY (name_to_widget (GTK_WIDGET(button), (name)))); \ - if (! *line) \ - ; \ - else if (!directory_p (line)) \ - { \ - char b[255]; \ - sprintf (b, "Error:\n\n" "Directory does not exist: \"%s\"\n", line); \ - warning_dialog (GTK_WIDGET (button), b, False, 100); \ - if ((field)) free ((field)); \ - (field) = strdup(line); \ - } \ - else { \ - if ((field)) free ((field)); \ - (field) = strdup(line); \ - } \ - } while(0) - -# define CHECKBOX(field, name) \ - field = gtk_toggle_button_get_active (\ - GTK_TOGGLE_BUTTON (name_to_widget (GTK_WIDGET(button), (name)))) - - MINUTES (&p2->timeout, "timeout_text"); - MINUTES (&p2->cycle, "cycle_text"); +# define SECONDS(FIELD,NAME) \ + w = name_to_widget (s, (NAME)); \ + hack_time_text (s, gtk_entry_get_text (GTK_ENTRY (w)), (FIELD), True) + +# define MINUTES(FIELD,NAME) \ + w = name_to_widget (s, (NAME)); \ + hack_time_text (s, gtk_entry_get_text (GTK_ENTRY (w)), (FIELD), False) + +# define CHECKBOX(FIELD,NAME) \ + w = name_to_widget (s, (NAME)); \ + (FIELD) = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)) + +# define PATHNAME(FIELD,NAME) \ + w = name_to_widget (s, (NAME)); \ + (FIELD) = normalize_directory (gtk_entry_get_text (GTK_ENTRY (w))) + + MINUTES (&p2->timeout, "timeout_spinbutton"); + MINUTES (&p2->cycle, "cycle_spinbutton"); CHECKBOX (p2->lock_p, "lock_button"); - MINUTES (&p2->lock_timeout, "lock_text"); + MINUTES (&p2->lock_timeout, "lock_spinbutton"); - CHECKBOX (p2->dpms_enabled_p, "dpms_button"); - MINUTES (&p2->dpms_standby, "dpms_standby_text"); - MINUTES (&p2->dpms_suspend, "dpms_suspend_text"); - MINUTES (&p2->dpms_off, "dpms_off_text"); + CHECKBOX (p2->dpms_enabled_p, "dpms_button"); + MINUTES (&p2->dpms_standby, "dpms_standby_spinbutton"); + MINUTES (&p2->dpms_suspend, "dpms_suspend_spinbutton"); + MINUTES (&p2->dpms_off, "dpms_off_spinbutton"); CHECKBOX (p2->grab_desktop_p, "grab_desk_button"); CHECKBOX (p2->grab_video_p, "grab_video_button"); @@ -1084,203 +1139,362 @@ prefs_ok_cb (GtkButton *button, gpointer user_data) CHECKBOX (p2->install_cmap_p, "install_button"); CHECKBOX (p2->fade_p, "fade_button"); CHECKBOX (p2->unfade_p, "unfade_button"); - SECONDS (&p2->fade_seconds, "fade_text"); + SECONDS (&p2->fade_seconds, "fade_spinbutton"); # undef SECONDS # undef MINUTES -# undef INTEGER -# undef PATHNAME # undef CHECKBOX +# undef PATHNAME + + /* Warn if the image directory doesn't exist. + */ + if (p2->image_directory && + *p2->image_directory && + !directory_p (p2->image_directory)) + { + char b[255]; + sprintf (b, "Error:\n\n" "Directory does not exist: \"%s\"\n", + p2->image_directory); + warning_dialog (s->toplevel_widget, b, False, 100); + } + + + /* Map the mode menu to `saver_mode' enum values. */ + { + GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu")); + GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt)); + GtkWidget *selected = gtk_menu_get_active (menu); + GList *kids = gtk_container_children (GTK_CONTAINER (menu)); + int menu_elt = g_list_index (kids, (gpointer) selected); + if (menu_elt < 0 || menu_elt >= countof(mode_menu_order)) abort(); + p2->mode = mode_menu_order[menu_elt]; + } + + if (p2->mode == ONE_HACK) + { + int list_elt = selected_list_element (s); + p2->selected_hack = (list_elt >= 0 + ? s->list_elt_to_hack_number[list_elt] + : -1); + } -# define COPY(field) \ - if (p->field != p2->field) changed = True; \ +# define COPY(field, name) \ + if (p->field != p2->field) { \ + changed = True; \ + if (s->debug_p) \ + fprintf (stderr, "%s: %s => %d\n", blurb(), name, p2->field); \ + } \ p->field = p2->field - COPY(timeout); - COPY(cycle); - COPY(lock_p); - COPY(lock_timeout); + COPY(mode, "mode"); + COPY(selected_hack, "selected_hack"); + + COPY(timeout, "timeout"); + COPY(cycle, "cycle"); + COPY(lock_p, "lock_p"); + COPY(lock_timeout, "lock_timeout"); + + COPY(dpms_enabled_p, "dpms_enabled_p"); + COPY(dpms_standby, "dpms_standby"); + COPY(dpms_suspend, "dpms_suspend"); + COPY(dpms_off, "dpms_off"); - COPY(dpms_enabled_p); - COPY(dpms_standby); - COPY(dpms_suspend); - COPY(dpms_off); + COPY(verbose_p, "verbose_p"); + COPY(capture_stderr_p, "capture_stderr_p"); + COPY(splash_p, "splash_p"); - COPY (grab_desktop_p); - COPY (grab_video_p); - COPY (random_image_p); + COPY(install_cmap_p, "install_cmap_p"); + COPY(fade_p, "fade_p"); + COPY(unfade_p, "unfade_p"); + COPY(fade_seconds, "fade_seconds"); + + COPY(grab_desktop_p, "grab_desktop_p"); + COPY(grab_video_p, "grab_video_p"); + COPY(random_image_p, "random_image_p"); + +# undef COPY if (!p->image_directory || !p2->image_directory || strcmp(p->image_directory, p2->image_directory)) - changed = True; + { + changed = True; + if (s->debug_p) + fprintf (stderr, "%s: image_directory => \"%s\"\n", + blurb(), p2->image_directory); + } if (p->image_directory && p->image_directory != p2->image_directory) free (p->image_directory); - p->image_directory = normalize_directory (p2->image_directory); - if (p2->image_directory) free (p2->image_directory); + p->image_directory = p2->image_directory; p2->image_directory = 0; - COPY(verbose_p); - COPY(capture_stderr_p); - COPY(splash_p); - - COPY(install_cmap_p); - COPY(fade_p); - COPY(unfade_p); - COPY(fade_seconds); -# undef COPY - - populate_prefs_page (GTK_WIDGET (button), pair); + populate_prefs_page (s); if (changed) { Display *dpy = GDK_DISPLAY(); - sync_server_dpms_settings (dpy, p->dpms_enabled_p, + Bool enabled_p = (p->dpms_enabled_p && p->mode != DONT_BLANK); + sync_server_dpms_settings (dpy, enabled_p, p->dpms_standby / 1000, p->dpms_suspend / 1000, p->dpms_off / 1000, False); - demo_write_init_file (GTK_WIDGET (button), p); - } -} - - -void -prefs_cancel_cb (GtkButton *button, gpointer user_data) -{ - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - - *pair->b = *pair->a; - populate_prefs_page (GTK_WIDGET (button), pair); -} - - -void -pref_changed_cb (GtkButton *button, gpointer user_data) -{ - if (! initializing_p) - apply_changes_and_save (GTK_WIDGET (button)); -} - - -static gint -list_doubleclick_cb (GtkWidget *button, GdkEventButton *event, - gpointer client_data) -{ - if (event->type == GDK_2BUTTON_PRESS) - { - GtkList *list = GTK_LIST (name_to_widget (button, "list")); - int which = gtk_list_child_position (list, GTK_WIDGET (button)); - - if (which >= 0) - run_hack (GTK_WIDGET (button), which, True); + changed = demo_write_init_file (s, p); } - return FALSE; + s->saving_p = False; + return changed; } -static void -list_select_cb (GtkList *list, GtkWidget *child) +/* Flush out any changes made in the popup dialog box (where changes + take place only when the OK button is clicked.) + */ +static Bool +flush_popup_changes_and_save (state *s) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ + Bool changed = False; + saver_preferences *p = &s->prefs; + int list_elt = selected_list_element (s); - int which = gtk_list_child_position (list, GTK_WIDGET (child)); - apply_changes_and_save (GTK_WIDGET (list)); - populate_demo_window (GTK_WIDGET (list), which, pair); -} + GtkEntry *cmd = GTK_ENTRY (name_to_widget (s, "cmd_text")); + GtkCombo *vis = GTK_COMBO (name_to_widget (s, "visual_combo")); -static void -list_unselect_cb (GtkList *list, GtkWidget *child) -{ - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ + const char *visual = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (vis)->entry)); + const char *command = gtk_entry_get_text (cmd); - apply_changes_and_save (GTK_WIDGET (list)); - populate_demo_window (GTK_WIDGET (list), -1, pair); -} + char c; + unsigned long id; + if (s->saving_p) return False; + s->saving_p = True; -static int updating_enabled_cb = 0; /* kludge to make sure that enabled_cb - is only run by user action, not by - program action. */ + if (list_elt < 0) + goto DONE; -/* Called when the checkboxes that are in the left column of the - scrolling list are clicked. This both populates the right pane - (just as clicking on the label (really, listitem) does) and - also syncs this checkbox with the right pane Enabled checkbox. - */ -static void -list_checkbox_cb (GtkWidget *cb, gpointer client_data) -{ - prefs_pair *pair = (prefs_pair *) client_data; + if (maybe_reload_init_file (s) != 0) + { + changed = True; + goto DONE; + } - GtkWidget *line_hbox = GTK_WIDGET (cb)->parent; - GtkWidget *line = GTK_WIDGET (line_hbox)->parent; + /* Sanity-check and canonicalize whatever the user typed into the combo box. + */ + if (!strcasecmp (visual, "")) visual = ""; + else if (!strcasecmp (visual, "any")) visual = ""; + else if (!strcasecmp (visual, "default")) visual = "Default"; + else if (!strcasecmp (visual, "default-n")) visual = "Default-N"; + else if (!strcasecmp (visual, "default-i")) visual = "Default-I"; + else if (!strcasecmp (visual, "best")) visual = "Best"; + else if (!strcasecmp (visual, "mono")) visual = "Mono"; + else if (!strcasecmp (visual, "monochrome")) visual = "Mono"; + else if (!strcasecmp (visual, "gray")) visual = "Gray"; + else if (!strcasecmp (visual, "grey")) visual = "Gray"; + else if (!strcasecmp (visual, "color")) visual = "Color"; + else if (!strcasecmp (visual, "gl")) visual = "GL"; + else if (!strcasecmp (visual, "staticgray")) visual = "StaticGray"; + else if (!strcasecmp (visual, "staticcolor")) visual = "StaticColor"; + else if (!strcasecmp (visual, "truecolor")) visual = "TrueColor"; + else if (!strcasecmp (visual, "grayscale")) visual = "GrayScale"; + else if (!strcasecmp (visual, "greyscale")) visual = "GrayScale"; + else if (!strcasecmp (visual, "pseudocolor")) visual = "PseudoColor"; + else if (!strcasecmp (visual, "directcolor")) visual = "DirectColor"; + else if (1 == sscanf (visual, " %ld %c", &id, &c)) ; + else if (1 == sscanf (visual, " 0x%lx %c", &id, &c)) ; + else + { + gdk_beep (); /* unparsable */ + visual = ""; + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), "Any"); + } - GtkList *list = GTK_LIST (GTK_WIDGET (line)->parent); - GtkViewport *vp = GTK_VIEWPORT (GTK_WIDGET (list)->parent); - GtkScrolledWindow *scroller = GTK_SCROLLED_WINDOW (GTK_WIDGET (vp)->parent); - GtkAdjustment *adj; - double scroll_top; + changed = flush_changes (s, list_elt, -1, command, visual); + if (changed) + { + changed = demo_write_init_file (s, p); - GtkToggleButton *enabled = - GTK_TOGGLE_BUTTON (name_to_widget (cb, "enabled")); + /* Do this to re-launch the hack if (and only if) the command line + has changed. */ + populate_demo_window (s, selected_list_element (s)); + } - int which = gtk_list_child_position (list, line); + DONE: + s->saving_p = False; + return changed; +} - /* remember previous scroll position of the top of the list */ - adj = gtk_scrolled_window_get_vadjustment (scroller); - scroll_top = adj->value; - apply_changes_and_save (GTK_WIDGET (list)); - gtk_list_select_item (list, which); - /* ensure_selected_item_visible (GTK_WIDGET (list)); */ - populate_demo_window (GTK_WIDGET (list), which, pair); - - updating_enabled_cb++; - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enabled), - GTK_TOGGLE_BUTTON (cb)->active); - updating_enabled_cb--; - /* restore the previous scroll position of the top of the list. - this is weak, but I don't really know why it's moving... */ - gtk_adjustment_set_value (adj, scroll_top); + +void +pref_changed_cb (GtkWidget *widget, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + if (! s->initializing_p) + { + s->initializing_p = True; + flush_dialog_changes_and_save (s); + s->initializing_p = False; + } } -/* Called when the right pane Enabled checkbox is clicked. This syncs - the corresponding checkbox inside the scrolling list to the state - of this checkbox. +/* Callback on menu items in the "mode" options menu. */ void -enabled_cb (GtkWidget *cb, gpointer client_data) +mode_menu_item_cb (GtkWidget *widget, gpointer user_data) { - int which = selected_hack_number (cb); - - if (updating_enabled_cb) return; + state *s = (state *) user_data; + saver_preferences *p = &s->prefs; + GtkList *list = GTK_LIST (name_to_widget (s, "list")); + int list_elt; - if (which != -1) + GList *menu_items = gtk_container_children (GTK_CONTAINER (widget->parent)); + int menu_index = 0; + saver_mode new_mode; + int old_selected = p->selected_hack; + + while (menu_items) { - GtkList *list = GTK_LIST (name_to_widget (cb, "list")); - GList *kids = GTK_LIST (list)->children; - GtkWidget *line = GTK_WIDGET (g_list_nth_data (kids, which)); - GtkWidget *line_hbox = GTK_WIDGET (GTK_BIN (line)->child); - GtkWidget *line_check = - GTK_WIDGET (gtk_container_children (GTK_CONTAINER (line_hbox))->data); + if (menu_items->data == widget) + break; + menu_index++; + menu_items = menu_items->next; + } + if (!menu_items) abort(); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (line_check), - GTK_TOGGLE_BUTTON (cb)->active); + new_mode = mode_menu_order[menu_index]; + + /* Keep the same list element displayed as before; except if we're + switching *to* "one screensaver" mode from any other mode, scroll + to and select "the one". + */ + list_elt = -1; + if (new_mode == ONE_HACK) + list_elt = (p->selected_hack >= 0 + ? s->hack_number_to_list_elt[p->selected_hack] + : -1); + + if (list_elt < 0) + list_elt = selected_list_element (s); + + { + saver_mode old_mode = p->mode; + p->mode = new_mode; + populate_demo_window (s, list_elt); + force_list_select_item (s, list, list_elt, True); + p->mode = old_mode; /* put it back, so the init file gets written */ + } + + pref_changed_cb (widget, user_data); + + if (old_selected != p->selected_hack) + abort(); /* dammit, not again... */ +} + + +void +switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page, + gint page_num, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + pref_changed_cb (GTK_WIDGET (notebook), user_data); + + /* If we're switching to page 0, schedule the current hack to be run. + Otherwise, schedule it to stop. */ + if (page_num == 0) + populate_demo_window (s, selected_list_element (s)); + else + schedule_preview (s, 0); +} + + +static time_t last_doubleclick_time = 0; /* FMH! This is to suppress the + list_select_cb that comes in + *after* we've double-clicked. + */ + +static gint +list_doubleclick_cb (GtkWidget *button, GdkEventButton *event, + gpointer data) +{ + state *s = (state *) data; + if (event->type == GDK_2BUTTON_PRESS) + { + GtkList *list = GTK_LIST (name_to_widget (s, "list")); + int list_elt = gtk_list_child_position (list, GTK_WIDGET (button)); + + last_doubleclick_time = time ((time_t *) 0); + + if (list_elt >= 0) + run_hack (s, list_elt, True); + } + + return FALSE; +} + + +static void +list_select_cb (GtkList *list, GtkWidget *child, gpointer data) +{ + state *s = (state *) data; + time_t now = time ((time_t *) 0); + + if (now >= last_doubleclick_time + 2) + { + int list_elt = gtk_list_child_position (list, GTK_WIDGET (child)); + populate_demo_window (s, list_elt); + flush_dialog_changes_and_save (s); } } +static void +list_unselect_cb (GtkList *list, GtkWidget *child, gpointer data) +{ + state *s = (state *) data; + populate_demo_window (s, -1); + flush_dialog_changes_and_save (s); +} + + +/* Called when the checkboxes that are in the left column of the + scrolling list are clicked. This both populates the right pane + (just as clicking on the label (really, listitem) does) and + also syncs this checkbox with the right pane Enabled checkbox. + */ +static void +list_checkbox_cb (GtkWidget *cb, gpointer data) +{ + state *s = (state *) data; + + GtkWidget *line_hbox = GTK_WIDGET (cb)->parent; + GtkWidget *line = GTK_WIDGET (line_hbox)->parent; + + GtkList *list = GTK_LIST (GTK_WIDGET (line)->parent); + GtkViewport *vp = GTK_VIEWPORT (GTK_WIDGET (list)->parent); + GtkScrolledWindow *scroller = GTK_SCROLLED_WINDOW (GTK_WIDGET (vp)->parent); + GtkAdjustment *adj; + double scroll_top; + + int list_elt = gtk_list_child_position (list, line); + + /* remember previous scroll position of the top of the list */ + adj = gtk_scrolled_window_get_vadjustment (scroller); + scroll_top = adj->value; + + flush_dialog_changes_and_save (s); + force_list_select_item (s, list, list_elt, False); + populate_demo_window (s, list_elt); + + /* restore the previous scroll position of the top of the list. + this is weak, but I don't really know why it's moving... */ + gtk_adjustment_set_value (adj, scroll_top); +} typedef struct { - prefs_pair *pair; + state *state; GtkFileSelection *widget; } file_selection_data; @@ -1290,10 +1504,10 @@ static void store_image_directory (GtkWidget *button, gpointer user_data) { file_selection_data *fsd = (file_selection_data *) user_data; - prefs_pair *pair = fsd->pair; + state *s = fsd->state; GtkFileSelection *selector = fsd->widget; - GtkWidget *top = toplevel_widget; - saver_preferences *p = pair->a; + GtkWidget *top = s->toplevel_widget; + saver_preferences *p = &s->prefs; char *path = gtk_file_selection_get_filename (selector); if (p->image_directory && !strcmp(p->image_directory, path)) @@ -1310,9 +1524,9 @@ store_image_directory (GtkWidget *button, gpointer user_data) if (p->image_directory) free (p->image_directory); p->image_directory = normalize_directory (path); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "image_text")), + gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "image_text")), (p->image_directory ? p->image_directory : "")); - demo_write_init_file (GTK_WIDGET (top), p); + demo_write_init_file (s, p); } @@ -1340,9 +1554,8 @@ browse_image_dir_close (GtkWidget *widget, GdkEvent *event, gpointer user_data) void browse_image_dir_cb (GtkButton *button, gpointer user_data) { - /* prefs_pair *pair = (prefs_pair *) client_data; */ - prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - saver_preferences *p = pair->a; + state *s = global_state_kludge; /* I hate C so much... */ + saver_preferences *p = &s->prefs; static file_selection_data *fsd = 0; GtkFileSelection *selector = GTK_FILE_SELECTION( @@ -1352,7 +1565,7 @@ browse_image_dir_cb (GtkButton *button, gpointer user_data) fsd = (file_selection_data *) malloc (sizeof (*fsd)); fsd->widget = selector; - fsd->pair = pair; + fsd->state = s; if (p->image_directory && *p->image_directory) gtk_file_selection_set_filename (selector, p->image_directory); @@ -1374,46 +1587,125 @@ browse_image_dir_cb (GtkButton *button, gpointer user_data) } - -/* Populating the various widgets - */ +void +settings_cb (GtkButton *button, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + int list_elt = selected_list_element (s); + populate_demo_window (s, list_elt); /* reset the widget */ + populate_popup_window (s); /* create UI on popup window */ + gtk_widget_show (s->popup_widget); +} -/* Formats a `Time' into "H:MM:SS". (Time is microseconds.) - */ static void -format_time (char *buf, Time time) +settings_sync_cmd_text (state *s) +{ +# ifdef HAVE_XML + GtkWidget *cmd = GTK_WIDGET (name_to_widget (s, "cmd_text")); + char *cmd_line = get_configurator_command_line (s->cdata); + gtk_entry_set_text (GTK_ENTRY (cmd), cmd_line); + gtk_entry_set_position (GTK_ENTRY (cmd), strlen (cmd_line)); + free (cmd_line); +# endif /* HAVE_XML */ +} + +void +settings_adv_cb (GtkButton *button, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + GtkNotebook *notebook = + GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); + + settings_sync_cmd_text (s); + gtk_notebook_set_page (notebook, 1); +} + +void +settings_std_cb (GtkButton *button, gpointer user_data) { - int s = time / 1000; - unsigned int h = 0, m = 0; - if (s >= 60) + state *s = global_state_kludge; /* I hate C so much... */ + GtkNotebook *notebook = + GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); + + /* Re-create UI to reflect the in-progress command-line settings. */ + populate_popup_window (s); + + gtk_notebook_set_page (notebook, 0); +} + +void +settings_switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page, + gint page_num, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + GtkWidget *adv = name_to_widget (s, "adv_button"); + GtkWidget *std = name_to_widget (s, "std_button"); + + if (page_num == 0) { - m += (s / 60); - s %= 60; + gtk_widget_show (adv); + gtk_widget_hide (std); } - if (m >= 60) + else if (page_num == 1) { - h += (m / 60); - m %= 60; + gtk_widget_hide (adv); + gtk_widget_show (std); } - sprintf (buf, "%u:%02u:%02u", h, m, s); + else + abort(); } -/* Finds the number of the last hack to run, and makes that item be - selected by default. - */ + +void +settings_cancel_cb (GtkButton *button, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + gtk_widget_hide (s->popup_widget); +} + +void +settings_ok_cb (GtkButton *button, gpointer user_data) +{ + state *s = global_state_kludge; /* I hate C so much... */ + GtkNotebook *notebook = GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); + int page = gtk_notebook_get_current_page (notebook); + + if (page == 0) + /* Regenerate the command-line from the widget contents before saving. + But don't do this if we're looking at the command-line page already, + or we will blow away what they typed... */ + settings_sync_cmd_text (s); + + flush_popup_changes_and_save (s); + gtk_widget_hide (s->popup_widget); +} + static void -scroll_to_current_hack (GtkWidget *toplevel, prefs_pair *pair) +wm_popup_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + state *s = (state *) data; + settings_cancel_cb (0, (gpointer) s); +} + + + +/* Populating the various widgets + */ + + +/* Returns the number of the last hack run by the server. + */ +static int +server_current_hack (void) { - saver_preferences *p = pair->a; Atom type; int format; unsigned long nitems, bytesafter; CARD32 *data = 0; Display *dpy = GDK_DISPLAY(); - int which = 0; - GtkList *list; + int hack_number = -1; if (XGetWindowProperty (dpy, RootWindow (dpy, 0), /* always screen #0 */ XA_SCREENSAVER_STATUS, @@ -1424,35 +1716,48 @@ scroll_to_current_hack (GtkWidget *toplevel, prefs_pair *pair) && type == XA_INTEGER && nitems >= 3 && data) - which = (int) data[2] - 1; + hack_number = (int) data[2] - 1; if (data) free (data); - if (which < 0) - return; + return hack_number; +} + + +/* Finds the number of the last hack to run, and makes that item be + selected by default. + */ +static void +scroll_to_current_hack (state *s) +{ + saver_preferences *p = &s->prefs; + int hack_number; - list = GTK_LIST (name_to_widget (toplevel, "list")); - apply_changes_and_save (toplevel); - if (which < p->screenhacks_count) + if (p->mode == ONE_HACK) + hack_number = p->selected_hack; + else + hack_number = server_current_hack (); + + if (hack_number >= 0 && hack_number < p->screenhacks_count) { - gtk_list_select_item (list, which); - ensure_selected_item_visible (GTK_WIDGET (list)); - populate_demo_window (toplevel, which, pair); + int list_elt = s->hack_number_to_list_elt[hack_number]; + GtkList *list = GTK_LIST (name_to_widget (s, "list")); + force_list_select_item (s, list, list_elt, True); + populate_demo_window (s, list_elt); } } - static void -populate_hack_list (GtkWidget *toplevel, prefs_pair *pair) +populate_hack_list (state *s) { - saver_preferences *p = pair->a; - GtkList *list = GTK_LIST (name_to_widget (toplevel, "list")); - screenhack **hacks = p->screenhacks; - screenhack **h; - - for (h = hacks; h && *h; h++) + saver_preferences *p = &s->prefs; + GtkList *list = GTK_LIST (name_to_widget (s, "list")); + int i; + for (i = 0; i < p->screenhacks_count; i++) { + screenhack *hack = p->screenhacks[s->list_elt_to_hack_number[i]]; + /* A GtkList must contain only GtkListItems, but those can contain an arbitrary widget. We add an Hbox, and inside that, a Checkbox and a Label. We handle single and double click events on the @@ -1464,9 +1769,9 @@ populate_hack_list (GtkWidget *toplevel, prefs_pair *pair) GtkWidget *line_check; GtkWidget *line_label; - char *pretty_name = (h[0]->name - ? strdup (h[0]->name) - : make_hack_name (h[0]->command)); + char *pretty_name = (hack->name + ? strdup (hack->name) + : make_hack_name (hack->command)); line = gtk_list_item_new (); line_hbox = gtk_hbox_new (FALSE, 0); @@ -1478,7 +1783,7 @@ populate_hack_list (GtkWidget *toplevel, prefs_pair *pair) gtk_box_pack_start (GTK_BOX (line_hbox), line_label, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (line_check), - h[0]->enabled_p); + hack->enabled_p); gtk_label_set_justify (GTK_LABEL (line_label), GTK_JUSTIFY_LEFT); gtk_widget_show (line_check); @@ -1491,11 +1796,11 @@ populate_hack_list (GtkWidget *toplevel, prefs_pair *pair) gtk_container_add (GTK_CONTAINER (list), line); gtk_signal_connect (GTK_OBJECT (line), "button_press_event", GTK_SIGNAL_FUNC (list_doubleclick_cb), - (gpointer) pair); + (gpointer) s); gtk_signal_connect (GTK_OBJECT (line_check), "toggled", GTK_SIGNAL_FUNC (list_checkbox_cb), - (gpointer) pair); + (gpointer) s); #if 0 /* #### */ GTK_WIDGET (GTK_BIN(line)->child)->style = @@ -1506,80 +1811,119 @@ populate_hack_list (GtkWidget *toplevel, prefs_pair *pair) gtk_signal_connect (GTK_OBJECT (list), "select_child", GTK_SIGNAL_FUNC (list_select_cb), - (gpointer) pair); + (gpointer) s); gtk_signal_connect (GTK_OBJECT (list), "unselect_child", GTK_SIGNAL_FUNC (list_unselect_cb), - (gpointer) pair); + (gpointer) s); +} + + +static void +update_list_sensitivity (state *s) +{ + saver_preferences *p = &s->prefs; + Bool sensitive = (p->mode == RANDOM_HACKS || p->mode == ONE_HACK); + Bool checkable = (p->mode == RANDOM_HACKS); + Bool blankable = (p->mode != DONT_BLANK); + + GtkWidget *head = name_to_widget (s, "col_head_hbox"); + GtkWidget *use = name_to_widget (s, "use_col_frame"); + GtkWidget *scroller = name_to_widget (s, "scroller"); + GtkWidget *buttons = name_to_widget (s, "next_prev_hbox"); + GtkWidget *blanker = name_to_widget (s, "blanking_table"); + + GtkList *list = GTK_LIST (name_to_widget (s, "list")); + GList *kids = gtk_container_children (GTK_CONTAINER (list)); + + gtk_widget_set_sensitive (GTK_WIDGET (head), sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (scroller), sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (buttons), sensitive); + + gtk_widget_set_sensitive (GTK_WIDGET (blanker), blankable); + + if (checkable) + gtk_widget_show (use); /* the "Use" column header */ + else + gtk_widget_hide (use); + + while (kids) + { + GtkBin *line = GTK_BIN (kids->data); + GtkContainer *line_hbox = GTK_CONTAINER (line->child); + GtkWidget *line_check = + GTK_WIDGET (gtk_container_children (line_hbox)->data); + + if (checkable) + gtk_widget_show (line_check); + else + gtk_widget_hide (line_check); + + kids = kids->next; + } } static void -populate_prefs_page (GtkWidget *top, prefs_pair *pair) -{ - saver_preferences *p = pair->a; - char s[100]; - - format_time (s, p->timeout); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "timeout_text")), s); - format_time (s, p->cycle); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "cycle_text")), s); - format_time (s, p->lock_timeout); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "lock_text")), s); - - format_time (s, p->dpms_standby); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "dpms_standby_text")),s); - format_time (s, p->dpms_suspend); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "dpms_suspend_text")),s); - format_time (s, p->dpms_off); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "dpms_off_text")), s); - - format_time (s, p->fade_seconds); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "fade_text")), s); - - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "lock_button")), - p->lock_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "verbose_button")), - p->verbose_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "capture_button")), - p->capture_stderr_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "splash_button")), - p->splash_p); - - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "dpms_button")), - p->dpms_enabled_p); - - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top,"grab_desk_button")), - p->grab_desktop_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget(top,"grab_video_button")), - p->grab_video_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget(top,"grab_image_button")), - p->random_image_p); - gtk_entry_set_text (GTK_ENTRY (name_to_widget (top, "image_text")), +populate_prefs_page (state *s) +{ + saver_preferences *p = &s->prefs; + char str[100]; + +# define FMT_MINUTES(NAME,N) \ + sprintf (str, "%d", ((N) + 59) / (60 * 1000)); \ + gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, (NAME))), str) + +# define FMT_SECONDS(NAME,N) \ + sprintf (str, "%d", ((N) / 1000)); \ + gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, (NAME))), str) + + FMT_MINUTES ("timeout_spinbutton", p->timeout); + FMT_MINUTES ("cycle_spinbutton", p->cycle); + FMT_MINUTES ("lock_spinbutton", p->lock_timeout); + FMT_MINUTES ("dpms_standby_spinbutton", p->dpms_standby); + FMT_MINUTES ("dpms_suspend_spinbutton", p->dpms_suspend); + FMT_MINUTES ("dpms_off_spinbutton", p->dpms_off); + FMT_SECONDS ("fade_spinbutton", p->fade_seconds); + +# undef FMT_MINUTES +# undef FMT_SECONDS + +# define TOGGLE_ACTIVE(NAME,ACTIVEP) \ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (name_to_widget (s,(NAME))),\ + (ACTIVEP)) + + TOGGLE_ACTIVE ("lock_button", p->lock_p); + TOGGLE_ACTIVE ("verbose_button", p->verbose_p); + TOGGLE_ACTIVE ("capture_button", p->capture_stderr_p); + TOGGLE_ACTIVE ("splash_button", p->splash_p); + TOGGLE_ACTIVE ("dpms_button", p->dpms_enabled_p); + TOGGLE_ACTIVE ("grab_desk_button", p->grab_desktop_p); + TOGGLE_ACTIVE ("grab_video_button", p->grab_video_p); + TOGGLE_ACTIVE ("grab_image_button", p->random_image_p); + TOGGLE_ACTIVE ("install_button", p->install_cmap_p); + TOGGLE_ACTIVE ("fade_button", p->fade_p); + TOGGLE_ACTIVE ("unfade_button", p->unfade_p); + +# undef TOGGLE_ACTIVE + + gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "image_text")), (p->image_directory ? p->image_directory : "")); - gtk_widget_set_sensitive (GTK_WIDGET (name_to_widget (top, "image_text")), + gtk_widget_set_sensitive (name_to_widget (s, "image_text"), p->random_image_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top,"image_browse_button")), + gtk_widget_set_sensitive (name_to_widget (s, "image_browse_button"), p->random_image_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "install_button")), - p->install_cmap_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "fade_button")), - p->fade_p); - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (name_to_widget (top, "unfade_button")), - p->unfade_p); + /* Map the `saver_mode' enum to mode menu to values. */ + { + GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu")); + int i; + for (i = 0; i < countof(mode_menu_order); i++) + if (mode_menu_order[i] == p->mode) + break; + gtk_option_menu_set_history (opt, i); + update_list_sensitivity (s); + } { Bool found_any_writable_cells = False; @@ -1611,92 +1955,104 @@ populate_prefs_page (GtkWidget *top, prefs_pair *pair) #endif /* HAVE_DPMS_EXTENSION */ +# define SENSITIZE(NAME,SENSITIVEP) \ + gtk_widget_set_sensitive (name_to_widget (s, (NAME)), (SENSITIVEP)) + /* Blanking and Locking */ - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "lock_label")), - p->lock_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "lock_text")), - p->lock_p); + SENSITIZE ("lock_spinbutton", p->lock_p); + SENSITIZE ("lock_mlabel", p->lock_p); /* DPMS */ - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_frame")), - dpms_supported); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_button")), - dpms_supported); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_standby_label")), - dpms_supported && p->dpms_enabled_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_standby_text")), - dpms_supported && p->dpms_enabled_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_suspend_label")), - dpms_supported && p->dpms_enabled_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_suspend_text")), - dpms_supported && p->dpms_enabled_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_off_label")), - dpms_supported && p->dpms_enabled_p); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "dpms_off_text")), - dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_frame", dpms_supported); + SENSITIZE ("dpms_button", dpms_supported); + SENSITIZE ("dpms_standby_label", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_standby_mlabel", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_standby_spinbutton", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_suspend_label", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_suspend_mlabel", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_suspend_spinbutton", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_off_label", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_off_mlabel", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_off_spinbutton", dpms_supported && p->dpms_enabled_p); /* Colormaps */ - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "cmap_frame")), - found_any_writable_cells); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "install_button")), - found_any_writable_cells); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "fade_button")), - found_any_writable_cells); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "unfade_button")), - found_any_writable_cells); - - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "fade_label")), - (found_any_writable_cells && - (p->fade_p || p->unfade_p))); - gtk_widget_set_sensitive ( - GTK_WIDGET (name_to_widget (top, "fade_text")), - (found_any_writable_cells && - (p->fade_p || p->unfade_p))); + SENSITIZE ("cmap_frame", found_any_writable_cells); + SENSITIZE ("install_button", found_any_writable_cells); + SENSITIZE ("fade_button", found_any_writable_cells); + SENSITIZE ("unfade_button", found_any_writable_cells); + + SENSITIZE ("fade_label", (found_any_writable_cells && + (p->fade_p || p->unfade_p))); + SENSITIZE ("fade_spinbutton", (found_any_writable_cells && + (p->fade_p || p->unfade_p))); + +# undef SENSITIZE } +} + + +static void +populate_popup_window (state *s) +{ + saver_preferences *p = &s->prefs; + GtkWidget *parent = name_to_widget (s, "settings_vbox"); + GtkLabel *doc = GTK_LABEL (name_to_widget (s, "doc")); + int list_elt = selected_list_element (s); + int hack_number = (list_elt >= 0 && list_elt < p->screenhacks_count + ? s->list_elt_to_hack_number[list_elt] + : -1); + screenhack *hack = (hack_number >= 0 ? p->screenhacks[hack_number] : 0); + char *doc_string = 0; + +# ifdef HAVE_XML + if (s->cdata) + { + free_conf_data (s->cdata); + s->cdata = 0; + } + + if (hack) + { + GtkWidget *cmd = GTK_WIDGET (name_to_widget (s, "cmd_text")); + const char *cmd_line = gtk_entry_get_text (GTK_ENTRY (cmd)); + s->cdata = load_configurator (cmd_line, s->debug_p); + if (s->cdata && s->cdata->widget) + gtk_box_pack_start (GTK_BOX (parent), s->cdata->widget, TRUE, TRUE, 0); + } + + doc_string = (s->cdata + ? s->cdata->description + : 0); +# else /* !HAVE_XML */ + doc_string = "Descriptions not available: no XML support compiled in."; +# endif /* !HAVE_XML */ + gtk_label_set_text (doc, (doc_string + ? doc_string + : "No description available.")); } static void -sensitize_demo_widgets (GtkWidget *toplevel, Bool sensitive_p) +sensitize_demo_widgets (state *s, Bool sensitive_p) { - const char *names[] = { "cmd_label", "cmd_text", "enabled", - "visual", "visual_combo", - "demo", "manual" }; + const char *names1[] = { "demo", "settings" }; + const char *names2[] = { "cmd_label", "cmd_text", "manual", + "visual", "visual_combo" }; int i; - for (i = 0; i < countof(names); i++) + for (i = 0; i < countof(names1); i++) { - GtkWidget *w = name_to_widget (toplevel, names[i]); + GtkWidget *w = name_to_widget (s, names1[i]); + gtk_widget_set_sensitive (GTK_WIDGET(w), sensitive_p); + } + for (i = 0; i < countof(names2); i++) + { + GtkWidget *w = name_to_widget (s, names2[i]); gtk_widget_set_sensitive (GTK_WIDGET(w), sensitive_p); } - - /* I don't know how to handle these yet... */ - { - const char *names2[] = { "cut_menu", "copy_menu", "paste_menu" }; - for (i = 0; i < countof(names2); i++) - { - GtkWidget *w = name_to_widget (toplevel, names2[i]); - gtk_widget_set_sensitive (GTK_WIDGET(w), False); - } - } } @@ -1705,43 +2061,61 @@ sensitize_demo_widgets (GtkWidget *toplevel, Bool sensitive_p) a string in their font, and resize them to just fit that. */ static void -fix_text_entry_sizes (GtkWidget *toplevel) +fix_text_entry_sizes (state *s) { - const char *names[] = { "timeout_text", "cycle_text", "lock_text", - "dpms_standby_text", "dpms_suspend_text", - "dpms_off_text", "fade_text" }; + const char * const spinbuttons[] = { + "timeout_spinbutton", "cycle_spinbutton", "lock_spinbutton", + "dpms_standby_spinbutton", "dpms_suspend_spinbutton", + "dpms_off_spinbutton", + "-fade_spinbutton" }; int i; int width = 0; GtkWidget *w; - for (i = 0; i < countof(names); i++) + for (i = 0; i < countof(spinbuttons); i++) { - w = GTK_WIDGET (name_to_widget (toplevel, names[i])); - if (width == 0) - width = gdk_text_width (w->style->font, "00:00:00_", 9); + const char *n = spinbuttons[i]; + int cols = 4; + while (*n == '-') n++, cols--; + w = GTK_WIDGET (name_to_widget (s, n)); + width = gdk_text_width (w->style->font, "MMMMMMMM", cols); gtk_widget_set_usize (w, width, -2); } - /* Now fix the size of the combo box. + /* Now fix the width of the combo box. */ - w = GTK_WIDGET (name_to_widget (GTK_WIDGET (toplevel), "visual_combo")); + w = GTK_WIDGET (name_to_widget (s, "visual_combo")); w = GTK_COMBO (w)->entry; - width = gdk_text_width (w->style->font, "PseudoColor___", 14); + width = gdk_string_width (w->style->font, "PseudoColor___"); gtk_widget_set_usize (w, width, -2); - /* Now fix the size of the file entry text. + /* Now fix the width of the file entry text. */ - w = GTK_WIDGET (name_to_widget (GTK_WIDGET (toplevel), "image_text")); - width = gdk_text_width (w->style->font, "MMMMMMMMMMMMMM", 14); + w = GTK_WIDGET (name_to_widget (s, "image_text")); + width = gdk_string_width (w->style->font, "mmmmmmmmmmmmmm"); gtk_widget_set_usize (w, width, -2); -#if 0 - /* Now fix the size of the list. + /* Now fix the width of the command line text. */ - w = GTK_WIDGET (name_to_widget (GTK_WIDGET (toplevel), "list")); - width = gdk_text_width (w->style->font, "nnnnnnnnnnnnnnnnnnnnnn", 22); + w = GTK_WIDGET (name_to_widget (s, "cmd_text")); + width = gdk_string_width (w->style->font, "mmmmmmmmmmmmmmmmmmmm"); gtk_widget_set_usize (w, width, -2); -#endif + + /* Now fix the height of the list. + */ + { + int lines = 10; + int height; + int leading = 3; /* approximate is ok... */ + int border = 2; + w = GTK_WIDGET (name_to_widget (s, "list")); + height = w->style->font->ascent + w->style->font->descent; + height += leading; + height *= lines; + height += border * 2; + w = GTK_WIDGET (name_to_widget (s, "scroller")); + gtk_widget_set_usize (w, -2, height); + } } @@ -1809,7 +2183,7 @@ static char *down_arrow_xpm[] = { }; static void -pixmapify_button (GtkWidget *toplevel, int down_p) +pixmapify_button (state *s, int down_p) { GdkPixmap *pixmap; GdkBitmap *mask; @@ -1817,8 +2191,7 @@ pixmapify_button (GtkWidget *toplevel, int down_p) GtkStyle *style; GtkWidget *w; - w = GTK_WIDGET (name_to_widget (GTK_WIDGET (toplevel), - (down_p ? "next" : "prev"))); + w = GTK_WIDGET (name_to_widget (s, (down_p ? "next" : "prev"))); style = gtk_widget_get_style (w); mask = 0; pixmap = gdk_pixmap_create_from_xpm_d (w->window, &mask, @@ -1835,13 +2208,15 @@ pixmapify_button (GtkWidget *toplevel, int down_p) static void map_next_button_cb (GtkWidget *w, gpointer user_data) { - pixmapify_button (w, 1); + state *s = (state *) user_data; + pixmapify_button (s, 1); } static void map_prev_button_cb (GtkWidget *w, gpointer user_data) { - pixmapify_button (w, 0); + state *s = (state *) user_data; + pixmapify_button (s, 0); } @@ -1850,253 +2225,902 @@ map_prev_button_cb (GtkWidget *w, gpointer user_data) */ static void -you_are_not_a_unique_or_beautiful_snowflake (GtkWidget *label, - GtkAllocation *allocation, - void *foo) +you_are_not_a_unique_or_beautiful_snowflake (GtkWidget *label, + GtkAllocation *allocation, + void *foo) +{ + GtkRequisition req; + GtkWidgetAuxInfo *aux_info; + + aux_info = gtk_object_get_data (GTK_OBJECT (label), "gtk-aux-info"); + + aux_info->width = allocation->width; + aux_info->height = -2; + aux_info->x = -1; + aux_info->y = -1; + + gtk_widget_size_request (label, &req); +} + + +/* Feel the love. Thanks to Nat Friedman for finding this workaround. + */ +static void +eschew_gtk_lossage (GtkLabel *label) +{ + GtkWidgetAuxInfo *aux_info = g_new0 (GtkWidgetAuxInfo, 1); + aux_info->width = GTK_WIDGET (label)->allocation.width; + aux_info->height = -2; + aux_info->x = -1; + aux_info->y = -1; + + gtk_object_set_data (GTK_OBJECT (label), "gtk-aux-info", aux_info); + + gtk_signal_connect (GTK_OBJECT (label), "size_allocate", + you_are_not_a_unique_or_beautiful_snowflake, + 0); + + gtk_widget_set_usize (GTK_WIDGET (label), -2, -2); + + gtk_widget_queue_resize (GTK_WIDGET (label)); +} + + +static void +populate_demo_window (state *s, int list_elt) +{ + saver_preferences *p = &s->prefs; + screenhack *hack; + char *pretty_name; + GtkFrame *frame1 = GTK_FRAME (name_to_widget (s, "preview_frame")); + GtkFrame *frame2 = GTK_FRAME (name_to_widget (s, "doc_frame")); + GtkEntry *cmd = GTK_ENTRY (name_to_widget (s, "cmd_text")); + GtkCombo *vis = GTK_COMBO (name_to_widget (s, "visual_combo")); + GtkWidget *list = GTK_WIDGET (name_to_widget (s, "list")); + + if (p->mode == BLANK_ONLY) + { + hack = 0; + pretty_name = strdup ("Blank Screen"); + schedule_preview (s, 0); + } + else if (p->mode == DONT_BLANK) + { + hack = 0; + pretty_name = strdup ("Screen Saver Disabled"); + schedule_preview (s, 0); + } + else + { + int hack_number = (list_elt >= 0 && list_elt < p->screenhacks_count + ? s->list_elt_to_hack_number[list_elt] + : -1); + hack = (hack_number >= 0 ? p->screenhacks[hack_number] : 0); + + pretty_name = (hack + ? (hack->name + ? strdup (hack->name) + : make_hack_name (hack->command)) + : 0); + + if (hack) + schedule_preview (s, hack->command); + else + schedule_preview (s, 0); + } + + if (!pretty_name) + pretty_name = strdup ("Preview"); + + gtk_frame_set_label (frame1, pretty_name); + gtk_frame_set_label (frame2, pretty_name); + + gtk_entry_set_text (cmd, (hack ? hack->command : "")); + gtk_entry_set_position (cmd, 0); + + { + char title[255]; + sprintf (title, "%s: %.100s Settings", + progclass, (pretty_name ? pretty_name : "???")); + gtk_window_set_title (GTK_WINDOW (s->popup_widget), title); + } + + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), + (hack + ? (hack->visual && *hack->visual + ? hack->visual + : "Any") + : "")); + + sensitize_demo_widgets (s, (hack ? True : False)); + + if (pretty_name) free (pretty_name); + + ensure_selected_item_visible (list); + + s->_selected_list_element = list_elt; +} + + +static void +widget_deleter (GtkWidget *widget, gpointer data) +{ + /* #### Well, I want to destroy these widgets, but if I do that, they get + referenced again, and eventually I get a SEGV. So instead of + destroying them, I'll just hide them, and leak a bunch of memory + every time the disk file changes. Go go go Gtk! + + #### Ok, that's a lie, I get a crash even if I just hide the widget + and don't ever delete it. Fuck! + */ +#if 0 + gtk_widget_destroy (widget); +#else + gtk_widget_hide (widget); +#endif +} + + +static char **sort_hack_cmp_names_kludge; +static int +sort_hack_cmp (const void *a, const void *b) +{ + if (a == b) + return 0; + else + return strcmp (sort_hack_cmp_names_kludge[*(int *) a], + sort_hack_cmp_names_kludge[*(int *) b]); +} + + +static void +initialize_sort_map (state *s) +{ + saver_preferences *p = &s->prefs; + int i; + + if (s->list_elt_to_hack_number) free (s->list_elt_to_hack_number); + if (s->hack_number_to_list_elt) free (s->hack_number_to_list_elt); + + s->list_elt_to_hack_number = (int *) + calloc (sizeof(int), p->screenhacks_count + 1); + s->hack_number_to_list_elt = (int *) + calloc (sizeof(int), p->screenhacks_count + 1); + + /* Initialize table to 1:1 mapping */ + for (i = 0; i < p->screenhacks_count; i++) + s->list_elt_to_hack_number[i] = i; + + /* Generate list of names (once) + */ + sort_hack_cmp_names_kludge = (char **) + calloc (sizeof(char *), p->screenhacks_count); + for (i = 0; i < p->screenhacks_count; i++) + { + screenhack *hack = p->screenhacks[i]; + char *name = (hack->name && *hack->name + ? strdup (hack->name) + : make_hack_name (hack->command)); + char *str; + for (str = name; *str; str++) + *str = tolower(*str); + sort_hack_cmp_names_kludge[i] = name; + } + + /* Sort alphabetically + */ + qsort (s->list_elt_to_hack_number, + p->screenhacks_count, + sizeof(*s->list_elt_to_hack_number), + sort_hack_cmp); + + /* Free names + */ + for (i = 0; i < p->screenhacks_count; i++) + free (sort_hack_cmp_names_kludge[i]); + free (sort_hack_cmp_names_kludge); + sort_hack_cmp_names_kludge = 0; + + /* Build inverse table */ + for (i = 0; i < p->screenhacks_count; i++) + s->hack_number_to_list_elt[s->list_elt_to_hack_number[i]] = i; +} + + +static int +maybe_reload_init_file (state *s) +{ + saver_preferences *p = &s->prefs; + int status = 0; + + static Bool reentrant_lock = False; + if (reentrant_lock) return 0; + reentrant_lock = True; + + if (init_file_changed_p (p)) + { + const char *f = init_file_name(); + char *b; + int list_elt; + GtkList *list; + + if (!f || !*f) return 0; + b = (char *) malloc (strlen(f) + 1024); + sprintf (b, + "Warning:\n\n" + "file \"%s\" has changed, reloading.\n", + f); + warning_dialog (s->toplevel_widget, b, False, 100); + free (b); + + load_init_file (p); + initialize_sort_map (s); + + list_elt = selected_list_element (s); + list = GTK_LIST (name_to_widget (s, "list")); + gtk_container_foreach (GTK_CONTAINER (list), widget_deleter, NULL); + populate_hack_list (s); + force_list_select_item (s, list, list_elt, True); + populate_prefs_page (s); + populate_demo_window (s, list_elt); + ensure_selected_item_visible (GTK_WIDGET (list)); + + status = 1; + } + + reentrant_lock = False; + return status; +} + + + +/* Making the preview window have the right X visual (so that GL works.) + */ + +static Visual *get_best_gl_visual (state *); + +static GdkVisual * +x_visual_to_gdk_visual (Visual *xv) +{ + GList *gvs = gdk_list_visuals(); + if (!xv) return gdk_visual_get_system(); + for (; gvs; gvs = gvs->next) + { + GdkVisual *gv = (GdkVisual *) gvs->data; + if (xv == GDK_VISUAL_XVISUAL (gv)) + return gv; + } + fprintf (stderr, "%s: couldn't convert X Visual 0x%lx to a GdkVisual\n", + blurb(), (unsigned long) xv->visualid); + abort(); +} + +static void +clear_preview_window (state *s) +{ + GtkWidget *p; + GdkWindow *window; + + if (!s->toplevel_widget) return; /* very early */ + p = name_to_widget (s, "preview"); + window = p->window; + + if (!window) return; + + /* Flush the widget background down into the window, in case a subproc + has changed it. */ + gdk_window_set_background (window, &p->style->bg[GTK_STATE_NORMAL]); + gdk_window_clear (window); + + if (s->running_preview_error_p) + { + const char * const lines[] = { "No Preview", "Available" }; + int lh = p->style->font->ascent + p->style->font->descent; + int y, i; + gint w, h; + gdk_window_get_size (window, &w, &h); + y = (h - (lh * countof(lines))) / 2; + y += p->style->font->ascent; + for (i = 0; i < countof(lines); i++) + { + int sw = gdk_string_width (p->style->font, lines[i]); + int x = (w - sw) / 2; + gdk_draw_string (window, p->style->font, + p->style->fg_gc[GTK_STATE_NORMAL], + x, y, lines[i]); + y += lh; + } + } + + gdk_flush (); + + /* Is there a GDK way of doing this? */ + XSync (GDK_DISPLAY(), False); +} + + +static void +fix_preview_visual (state *s) +{ + GtkWidget *widget = name_to_widget (s, "preview"); + Visual *xvisual = get_best_gl_visual (s); + GdkVisual *visual = x_visual_to_gdk_visual (xvisual); + GdkVisual *dvisual = gdk_visual_get_system(); + GdkColormap *cmap = (visual == dvisual + ? gdk_colormap_get_system () + : gdk_colormap_new (visual, False)); + + if (s->debug_p) + fprintf (stderr, "%s: using %s visual 0x%lx\n", blurb(), + (visual == dvisual ? "default" : "non-default"), + (xvisual ? (unsigned long) xvisual->visualid : 0L)); + + if (!GTK_WIDGET_REALIZED (widget) || + gtk_widget_get_visual (widget) != visual) + { + gtk_widget_unrealize (widget); + gtk_widget_set_visual (widget, visual); + gtk_widget_set_colormap (widget, cmap); + gtk_widget_realize (widget); + } + + /* Set the Widget colors to be white-on-black. */ + { + GdkWindow *window = widget->window; + GtkStyle *style = gtk_style_copy (widget->style); + GdkColormap *cmap = gtk_widget_get_colormap (widget); + GdkColor *fg = &style->fg[GTK_STATE_NORMAL]; + GdkColor *bg = &style->bg[GTK_STATE_NORMAL]; + GdkGC *fgc = gdk_gc_new(window); + GdkGC *bgc = gdk_gc_new(window); + if (!gdk_color_white (cmap, fg)) abort(); + if (!gdk_color_black (cmap, bg)) abort(); + gdk_gc_set_foreground (fgc, fg); + gdk_gc_set_background (fgc, bg); + gdk_gc_set_foreground (bgc, bg); + gdk_gc_set_background (bgc, fg); + style->fg_gc[GTK_STATE_NORMAL] = fgc; + style->bg_gc[GTK_STATE_NORMAL] = fgc; + gtk_widget_set_style (widget, style); + } + + gtk_widget_show (widget); +} + + +/* Subprocesses + */ + +static char * +subproc_pretty_name (state *s) +{ + if (s->running_preview_cmd) + { + char *ps = strdup (s->running_preview_cmd); + char *ss = strchr (ps, ' '); + if (ss) *ss = 0; + ss = strrchr (ps, '/'); + if (ss) *ss = 0; + else ss = ps; + return ss; + } + else + return strdup ("???"); +} + + +static void +reap_zombies (state *s) +{ + int wait_status = 0; + pid_t pid; + while ((pid = waitpid (-1, &wait_status, WNOHANG|WUNTRACED)) > 0) + { + if (s->debug_p) + { + if (pid == s->running_preview_pid) + { + char *ss = subproc_pretty_name (s); + fprintf (stderr, "%s: pid %lu (%s) died\n", blurb(), pid, ss); + free (ss); + } + else + fprintf (stderr, "%s: pid %lu died\n", blurb(), pid); + } + } +} + + +/* Mostly lifted from driver/subprocs.c */ +static Visual * +get_best_gl_visual (state *s) +{ + Display *dpy = GDK_DISPLAY(); + pid_t forked; + int fds [2]; + int in, out; + char buf[1024]; + + char *av[10]; + int ac = 0; + + av[ac++] = "xscreensaver-gl-helper"; + av[ac] = 0; + + if (pipe (fds)) + { + perror ("error creating pipe:"); + return 0; + } + + in = fds [0]; + out = fds [1]; + + switch ((int) (forked = fork ())) + { + case -1: + { + sprintf (buf, "%s: couldn't fork", blurb()); + perror (buf); + exit (1); + } + case 0: + { + int stdout_fd = 1; + + close (in); /* don't need this one */ + close (ConnectionNumber (dpy)); /* close display fd */ + + if (dup2 (out, stdout_fd) < 0) /* pipe stdout */ + { + perror ("could not dup() a new stdout:"); + return 0; + } + + execvp (av[0], av); /* shouldn't return. */ + + if (errno != ENOENT) + { + /* Ignore "no such file or directory" errors, unless verbose. + Issue all other exec errors, though. */ + sprintf (buf, "%s: running %s", blurb(), av[0]); + perror (buf); + } + exit (1); /* exits fork */ + break; + } + default: + { + int result = 0; + int wait_status = 0; + + FILE *f = fdopen (in, "r"); + unsigned long v = 0; + char c; + + close (out); /* don't need this one */ + + *buf = 0; + fgets (buf, sizeof(buf)-1, f); + fclose (f); + + /* Wait for the child to die. */ + waitpid (-1, &wait_status, 0); + + if (1 == sscanf (buf, "0x%x %c", &v, &c)) + result = (int) v; + + if (result == 0) + { + if (s->debug_p) + fprintf (stderr, "%s: %s did not report a GL visual!\n", + blurb(), av[0]); + return 0; + } + else + { + Visual *v = id_to_visual (DefaultScreenOfDisplay (dpy), result); + if (s->debug_p) + fprintf (stderr, "%s: %s says the GL visual is 0x%X.\n", + blurb(), av[0], result); + if (!v) abort(); + return v; + } + } + } + + abort(); +} + + +static void +kill_preview_subproc (state *s) { - GtkRequisition req; - GtkWidgetAuxInfo *aux_info; + s->running_preview_error_p = False; - aux_info = gtk_object_get_data (GTK_OBJECT (label), "gtk-aux-info"); + reap_zombies (s); + clear_preview_window (s); - aux_info->width = allocation->width; - aux_info->height = -2; - aux_info->x = -1; - aux_info->y = -1; + if (s->subproc_check_timer_id) + { + gtk_timeout_remove (s->subproc_check_timer_id); + s->subproc_check_timer_id = 0; + s->subproc_check_countdown = 0; + } - gtk_widget_size_request (label, &req); + if (s->running_preview_pid) + { + int status = kill (s->running_preview_pid, SIGTERM); + char *ss = subproc_pretty_name (s); + + if (status < 0) + { + if (errno == ESRCH) + { + if (s->debug_p) + fprintf (stderr, "%s: pid %lu (%s) was already dead.\n", + blurb(), s->running_preview_pid, ss); + } + else + { + char buf [1024]; + sprintf (buf, "%s: couldn't kill pid %lu (%s)", + blurb(), s->running_preview_pid, ss); + perror (buf); + } + } + else if (s->debug_p) + fprintf (stderr, "%s: killed pid %lu (%s)\n", blurb(), + s->running_preview_pid, ss); + + free (ss); + s->running_preview_pid = 0; + if (s->running_preview_cmd) free (s->running_preview_cmd); + s->running_preview_cmd = 0; + } + + reap_zombies (s); } -/* Feel the love. Thanks to Nat Friedman for finding this workaround. - */ static void -eschew_gtk_lossage (GtkWidget *toplevel) +exec_program (const char *cmd, int nice_level) { - GtkWidgetAuxInfo *aux_info; - GtkWidget *label = GTK_WIDGET (name_to_widget (toplevel, "doc")); + char *av[1024]; + int ac = 0; + char *token = strtok (strdup(cmd), " \t"); + while (token) + { + av[ac++] = token; + token = strtok(0, " \t"); + } + av[ac] = 0; - aux_info = g_new0 (GtkWidgetAuxInfo, 1); - aux_info->width = label->allocation.width; - aux_info->height = -2; - aux_info->x = -1; - aux_info->y = -1; + nice (nice_level - nice (0)); - gtk_object_set_data (GTK_OBJECT (label), "gtk-aux-info", aux_info); + usleep (250000); /* pause for 1/4th second before launching, to give the + previous program time to die and flush its X buffer, + so we don't get leftover turds on the window. */ - gtk_signal_connect (GTK_OBJECT (label), "size_allocate", - you_are_not_a_unique_or_beautiful_snowflake, NULL); + execvp (av[0], av); /* shouldn't return. */ - gtk_widget_queue_resize (label); + { + char buf [512]; + sprintf (buf, "%s: could not execute \"%s\"", blurb(), av[0]); + perror (buf); + } + fflush(stderr); + fflush(stdout); + exit (1); /* Note that this only exits a child fork. */ } -char * -get_hack_blurb (screenhack *hack) +/* Immediately and unconditionally launches the given process, + after appending the -window-id option; sets running_preview_pid. + */ +static void +launch_preview_subproc (state *s) { - char *doc_string; - char *prog_name = strdup (hack->command); - char *pretty_name = (hack->name - ? strdup (hack->name) - : make_hack_name (hack->command)); - char doc_name[255], doc_class[255]; - char *s, *s2; + saver_preferences *p = &s->prefs; + Window id; + Bool hairy_p; + char *new_cmd; + pid_t forked; + int nice_level = nice (0) - p->nice_inferior; + const char *cmd = s->desired_preview_cmd; - for (s = prog_name; *s && !isspace(*s); s++) - ; - *s = 0; - s = strrchr (prog_name, '/'); - if (s) strcpy (prog_name, s+1); + GtkWidget *pr = name_to_widget (s, "preview"); + GdkWindow *window = pr->window; - sprintf (doc_name, "hacks.%s.documentation", pretty_name); - sprintf (doc_class, "hacks.%s.documentation", prog_name); - free (prog_name); - free (pretty_name); + s->running_preview_error_p = False; - doc_string = get_string_resource (doc_name, doc_class); - if (doc_string) + if (s->preview_suppressed_p) { - for (s = doc_string; *s; s++) - { - if (*s == '\n') - { - /* skip over whitespace at beginning of line */ - s++; - while (*s && (*s == ' ' || *s == '\t')) - s++; - } - else if (*s == ' ' || *s == '\t') - { - /* compress all other horizontal whitespace. */ - *s = ' '; - s++; - for (s2 = s; *s2 && (*s2 == ' ' || *s2 == '\t'); s2++) - ; - if (s2 > s) strcpy (s, s2); - s--; - } - } + kill_preview_subproc (s); + return; + } - while (*s && isspace (*s)) /* Strip trailing whitespace */ - *(--s) = 0; + new_cmd = malloc (strlen (cmd) + 40); - /* Delete whitespace at end of each line. */ - for (; s > doc_string; s--) - if (*s == '\n' && (s[-1] == ' ' || s[-1] == '\t')) - { - for (s2 = s-1; - s2 > doc_string && (*s2 == ' ' || *s2 == '\t'); - s2--) - ; - s2++; - if (s2 < s) strcpy (s2, s); - s = s2; - } - - /* Delete leading blank lines. */ - for (s = doc_string; *s == '\n'; s++) - ; - if (s > doc_string) strcpy (doc_string, s); + id = (window ? GDK_WINDOW_XWINDOW (window) : 0); + if (id == 0) + { + /* No window id? No command to run. */ + free (new_cmd); + new_cmd = 0; } else { - static int doc_installed = 0; - if (doc_installed == 0) - { - if (get_boolean_resource ("hacks.documentation.isInstalled", - "hacks.documentation.isInstalled")) - doc_installed = 1; - else - doc_installed = -1; - } + strcpy (new_cmd, cmd); + sprintf (new_cmd + strlen (new_cmd), " -window-id 0x%X", id); + } - if (doc_installed < 0) - doc_string = - strdup ("Error:\n\n" - "The documentation strings do not appear to be " - "installed. This is probably because there is " - "an \"XScreenSaver\" app-defaults file installed " - "that is from an older version of the program. " - "To fix this problem, delete that file, or " - "install a current version (either will work.)"); - else - doc_string = strdup (""); + hairy_p = (new_cmd && !!strpbrk (new_cmd, "*?$&!<>[];`'\\\"=")); + if (hairy_p) + { + /* Command requires a full shell? Forget it. */ + free (new_cmd); + new_cmd = 0; + if (s->debug_p) + fprintf (stderr, "%s: command is hairy: not previewing\n", blurb()); + } + + kill_preview_subproc (s); + if (! new_cmd) + { + s->running_preview_error_p = True; + clear_preview_window (s); + return; } - return doc_string; + switch ((int) (forked = fork ())) + { + case -1: + { + char buf[255]; + sprintf (buf, "%s: couldn't fork", blurb()); + perror (buf); + s->running_preview_error_p = True; + return; + } + case 0: + { + close (ConnectionNumber (GDK_DISPLAY())); + exec_program (new_cmd, nice_level); + abort(); + break; + + default: + + if (s->running_preview_cmd) free (s->running_preview_cmd); + s->running_preview_cmd = strdup (s->desired_preview_cmd); + s->running_preview_pid = forked; + + if (s->debug_p) + { + char *ss = subproc_pretty_name (s); + fprintf (stderr, "%s: forked %lu (%s)\n", blurb(), forked, ss); + free (ss); + } + break; + } + } + + schedule_preview_check (s); } +/* Modify $DISPLAY and $PATH for the benefit of subprocesses. + */ static void -populate_demo_window (GtkWidget *toplevel, int which, prefs_pair *pair) -{ - saver_preferences *p = pair->a; - screenhack *hack = (which >= 0 && which < p->screenhacks_count - ? p->screenhacks[which] : 0); - GtkFrame *frame = GTK_FRAME (name_to_widget (toplevel, "frame")); - GtkLabel *doc = GTK_LABEL (name_to_widget (toplevel, "doc")); - GtkEntry *cmd = GTK_ENTRY (name_to_widget (toplevel, "cmd_text")); - GtkToggleButton *enabled = - GTK_TOGGLE_BUTTON (name_to_widget (toplevel, "enabled")); - GtkCombo *vis = GTK_COMBO (name_to_widget (toplevel, "visual_combo")); - - char *pretty_name = (hack - ? (hack->name - ? strdup (hack->name) - : make_hack_name (hack->command)) - : 0); - char *doc_string = hack ? get_hack_blurb (hack) : 0; - - gtk_frame_set_label (frame, (pretty_name ? pretty_name : "")); - gtk_label_set_text (doc, (doc_string ? doc_string : "")); - gtk_entry_set_text (cmd, (hack ? hack->command : "")); - gtk_entry_set_position (cmd, 0); +hack_environment (state *s) +{ + static const char *def_path = +# ifdef DEFAULT_PATH_PREFIX + DEFAULT_PATH_PREFIX; +# else + ""; +# endif - updating_enabled_cb++; - gtk_toggle_button_set_active (enabled, (hack ? hack->enabled_p : False)); - updating_enabled_cb--; + Display *dpy = GDK_DISPLAY(); + const char *odpy = DisplayString (dpy); + char *ndpy = (char *) malloc(strlen(odpy) + 20); + strcpy (ndpy, "DISPLAY="); + strcat (ndpy, odpy); + if (putenv (ndpy)) + abort (); - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), - (hack - ? (hack->visual && *hack->visual - ? hack->visual - : "Any") - : "")); + if (s->debug_p) + fprintf (stderr, "%s: %s\n", blurb(), ndpy); - gtk_container_resize_children (GTK_CONTAINER (GTK_WIDGET (doc)->parent)); + if (def_path && *def_path) + { + const char *opath = getenv("PATH"); + char *npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); + strcpy (npath, "PATH="); + strcat (npath, def_path); + strcat (npath, ":"); + strcat (npath, opath); + + if (putenv (npath)) + abort (); + + if (s->debug_p) + fprintf (stderr, "%s: added \"%s\" to $PATH\n", blurb(), def_path); + } +} - sensitize_demo_widgets (toplevel, (hack ? True : False)); - if (pretty_name) free (pretty_name); - if (doc_string) free (doc_string); +/* Called from a timer: + Launches the currently-chosen subprocess, if it's not already running. + If there's a different process running, kills it. + */ +static int +update_subproc_timer (gpointer data) +{ + state *s = (state *) data; + if (! s->desired_preview_cmd) + kill_preview_subproc (s); + else if (!s->running_preview_cmd || + !!strcmp (s->desired_preview_cmd, s->running_preview_cmd)) + launch_preview_subproc (s); - _selected_hack_number = which; + s->subproc_timer_id = 0; + return FALSE; /* do not re-execute timer */ } +/* Call this when you think you might want a preview process running. + It will set a timer that will actually launch that program a second + from now, if you haven't changed your mind (to avoid double-click + spazzing, etc.) `cmd' may be null meaning "no process". + */ static void -widget_deleter (GtkWidget *widget, gpointer data) +schedule_preview (state *s, const char *cmd) { - /* #### Well, I want to destroy these widgets, but if I do that, they get - referenced again, and eventually I get a SEGV. So instead of - destroying them, I'll just hide them, and leak a bunch of memory - every time the disk file changes. Go go go Gtk! + int delay = 1000 * 0.5; /* 1/2 second hysteresis */ - #### Ok, that's a lie, I get a crash even if I just hide the widget - and don't ever delete it. Fuck! - */ -#if 0 - gtk_widget_destroy (widget); -#else - gtk_widget_hide (widget); -#endif + if (s->debug_p) + { + if (cmd) + fprintf (stderr, "%s: scheduling preview \"%s\"\n", blurb(), cmd); + else + fprintf (stderr, "%s: scheduling preview death\n", blurb()); + } + + if (s->desired_preview_cmd) free (s->desired_preview_cmd); + s->desired_preview_cmd = (cmd ? strdup (cmd) : 0); + + if (s->subproc_timer_id) + gtk_timeout_remove (s->subproc_timer_id); + s->subproc_timer_id = gtk_timeout_add (delay, update_subproc_timer, s); } +/* Called from a timer: + Checks to see if the subproc that should be running, actually is. + */ static int -maybe_reload_init_file (GtkWidget *widget, prefs_pair *pair) +check_subproc_timer (gpointer data) { - int status = 0; - saver_preferences *p = pair->a; - - static Bool reentrant_lock = False; - if (reentrant_lock) return 0; - reentrant_lock = True; + state *s = (state *) data; + Bool again_p = True; - if (init_file_changed_p (p)) + if (s->running_preview_error_p || /* already dead */ + s->running_preview_pid <= 0) { - const char *f = init_file_name(); - char *b; - int which; - GtkList *list; + again_p = False; + } + else + { + int status; + reap_zombies (s); + status = kill (s->running_preview_pid, 0); + if (status < 0 && errno == ESRCH) + s->running_preview_error_p = True; - if (!f || !*f) return 0; - b = (char *) malloc (strlen(f) + 1024); - sprintf (b, - "Warning:\n\n" - "file \"%s\" has changed, reloading.\n", - f); - warning_dialog (widget, b, False, 100); - free (b); + if (s->debug_p) + { + char *ss = subproc_pretty_name (s); + fprintf (stderr, "%s: timer: pid %lu (%s) is %s\n", blurb(), + s->running_preview_pid, ss, + (s->running_preview_error_p ? "dead" : "alive")); + free (ss); + } - load_init_file (p); + if (s->running_preview_error_p) + { + clear_preview_window (s); + again_p = False; + } + } - which = selected_hack_number (widget); - list = GTK_LIST (name_to_widget (widget, "list")); - gtk_container_foreach (GTK_CONTAINER (list), widget_deleter, NULL); - populate_hack_list (widget, pair); - gtk_list_select_item (list, which); - populate_prefs_page (widget, pair); - populate_demo_window (widget, which, pair); - ensure_selected_item_visible (GTK_WIDGET (list)); + /* Otherwise, it's currently alive. We might be checking again, or we + might be satisfied. */ - status = 1; + if (--s->subproc_check_countdown <= 0) + again_p = False; + + if (again_p) + return TRUE; /* re-execute timer */ + else + { + s->subproc_check_timer_id = 0; + s->subproc_check_countdown = 0; + return FALSE; /* do not re-execute timer */ } +} - reentrant_lock = False; - return status; + +/* Call this just after launching a subprocess. + This sets a timer that will, five times a second for two seconds, + check whether the program is still running. The assumption here + is that if the process didn't stay up for more than a couple of + seconds, then either the program doesn't exist, or it doesn't + take a -window-id argument. + */ +static void +schedule_preview_check (state *s) +{ + int seconds = 2; + int ticks = 5; + + if (s->debug_p) + fprintf (stderr, "%s: scheduling check\n", blurb()); + + if (s->subproc_check_timer_id) + gtk_timeout_remove (s->subproc_check_timer_id); + s->subproc_check_timer_id = + gtk_timeout_add (1000 / ticks, + check_subproc_timer, (gpointer) s); + s->subproc_check_countdown = ticks * seconds; +} + + +static Bool +screen_blanked_p (void) +{ + Atom type; + int format; + unsigned long nitems, bytesafter; + CARD32 *data = 0; + Display *dpy = GDK_DISPLAY(); + Bool blanked_p = False; + + if (XGetWindowProperty (dpy, RootWindow (dpy, 0), /* always screen #0 */ + XA_SCREENSAVER_STATUS, + 0, 3, False, XA_INTEGER, + &type, &format, &nitems, &bytesafter, + (unsigned char **) &data) + == Success + && type == XA_INTEGER + && nitems >= 3 + && data) + blanked_p = (data[0] == XA_BLANK || data[0] == XA_LOCK); + + if (data) free (data); + + return blanked_p; } +/* Wake up every now and then and see if the screen is blanked. + If it is, kill off the small-window demo -- no point in wasting + cycles by running two screensavers at once... + */ +static int +check_blanked_timer (gpointer data) +{ + state *s = (state *) data; + Bool blanked_p = screen_blanked_p (); + if (blanked_p && s->running_preview_pid) + { + if (s->debug_p) + fprintf (stderr, "%s: screen is blanked: killing preview\n", blurb()); + kill_preview_subproc (s); + } + + return True; /* re-execute timer */ +} /* Setting window manager icon @@ -2143,7 +3167,7 @@ mapper (XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, static void -the_network_is_not_the_computer (GtkWidget *parent) +the_network_is_not_the_computer (state *s) { Display *dpy = GDK_DISPLAY(); char *rversion, *ruser, *rhost; @@ -2208,11 +3232,11 @@ the_network_is_not_the_computer (GtkWidget *parent) "xscreensaver as \"%s\".\n" "\n" "Restart the xscreensaver daemon now?\n", - progname, luser, lhost, + blurb(), luser, lhost, d, (ruser ? ruser : "???"), (rhost ? rhost : "???"), - progname, - progname, (ruser ? ruser : "???"), + blurb(), + blurb(), (ruser ? ruser : "???"), luser); } else if (rhost && *rhost && !!strcmp (rhost, lhost)) @@ -2230,14 +3254,14 @@ the_network_is_not_the_computer (GtkWidget *parent) "%s won't work right.\n" "\n" "Restart the daemon on \"%s\" as \"%s\" now?\n", - progname, luser, lhost, + blurb(), luser, lhost, d, (ruser ? ruser : "???"), (rhost ? rhost : "???"), luser, - progname, + blurb(), lhost, luser); } - else if (!!strcmp (rversion, short_version)) + else if (!!strcmp (rversion, s->short_version)) { /* Warn that the version numbers don't match. */ @@ -2248,14 +3272,14 @@ the_network_is_not_the_computer (GtkWidget *parent) "is version %s. This could cause problems.\n" "\n" "Restart the xscreensaver daemon now?\n", - progname, short_version, + blurb(), s->short_version, d, rversion); } if (*msg) - warning_dialog (parent, msg, True, 1); + warning_dialog (s->toplevel_widget, msg, True, 1); free (msg); } @@ -2267,9 +3291,13 @@ the_network_is_not_the_computer (GtkWidget *parent) static int demo_ehandler (Display *dpy, XErrorEvent *error) { - fprintf (stderr, "\nX error in %s:\n", progname); + state *s = global_state_kludge; /* I hate C so much... */ + fprintf (stderr, "\nX error in %s:\n", blurb()); if (XmuPrintDefaultErrorMessage (dpy, error, stderr)) - exit (-1); + { + kill_preview_subproc (s); + exit (-1); + } else fprintf (stderr, " (nonfatal.)\n"); return 0; @@ -2293,7 +3321,8 @@ g_log_handler (const gchar *log_domain, GLogLevelFlags log_level, if (strstr (message, "unknown window")) return; - fprintf (stderr, "%s: %s-%s: %s%s", blurb(), log_domain, + fprintf (stderr, "%s: %s-%s: %s%s", blurb(), + (log_domain ? log_domain : progclass), (log_level == G_LOG_LEVEL_ERROR ? "error" : log_level == G_LOG_LEVEL_CRITICAL ? "critical" : log_level == G_LOG_LEVEL_WARNING ? "warning" : @@ -2319,19 +3348,65 @@ static struct poptOption crapplet_options[] = { #endif /* HAVE_CRAPPLET */ #endif /* 0 */ -#define USAGE() \ - fprintf (stderr, "usage: %s [ -display dpy-string ] [ -prefs ]\n", \ - real_progname) +const char *usage = "[--display dpy] [--prefs]" +# ifdef HAVE_CRAPPLET + " [--crapplet]" +# endif + " [--debug]"; + + +static void +map_popup_window_cb (GtkWidget *w, gpointer user_data) +{ + state *s = (state *) user_data; + Boolean oi = s->initializing_p; + GtkLabel *label = GTK_LABEL (name_to_widget (s, "doc")); + s->initializing_p = True; + eschew_gtk_lossage (label); + s->initializing_p = oi; +} +#if 0 static void -map_window_cb (GtkWidget *w, gpointer user_data) +print_widget_tree (GtkWidget *w, int depth) +{ + int i; + for (i = 0; i < depth; i++) + fprintf (stderr, " "); + fprintf (stderr, "%s\n", gtk_widget_get_name (w)); + + if (GTK_IS_LIST (w)) + { + for (i = 0; i < depth+1; i++) + fprintf (stderr, " "); + fprintf (stderr, "...list kids...\n"); + } + else if (GTK_IS_CONTAINER (w)) + { + GList *kids = gtk_container_children (GTK_CONTAINER (w)); + while (kids) + { + print_widget_tree (GTK_WIDGET (kids->data), depth+1); + kids = kids->next; + } + } +} +#endif /* 0 */ + +static int +delayed_scroll_kludge (gpointer data) { - Boolean oi = initializing_p; - initializing_p = True; - eschew_gtk_lossage (w); - ensure_selected_item_visible (GTK_WIDGET(name_to_widget(w, "list"))); - initializing_p = oi; + state *s = (state *) data; + GtkWidget *w = GTK_WIDGET (name_to_widget (s, "list")); + ensure_selected_item_visible (w); + + /* Oh, this is just fucking lovely, too. */ + w = GTK_WIDGET (name_to_widget (s, "preview")); + gtk_widget_hide (w); + gtk_widget_show (w); + + return FALSE; /* do not re-execute timer */ } @@ -2339,36 +3414,32 @@ int main (int argc, char **argv) { XtAppContext app; - prefs_pair Pair, *pair; - saver_preferences P, P2, *p, *p2; + state S, *s; + saver_preferences *p; Bool prefs = False; int i; Display *dpy; Widget toplevel_shell; - GtkWidget *gtk_window; char *real_progname = argv[0]; - char *s; - - initializing_p = True; + char window_title[255]; + Bool crapplet_p = False; + char *str; - s = strrchr (real_progname, '/'); - if (s) real_progname = s+1; + str = strrchr (real_progname, '/'); + if (str) real_progname = str+1; - p = &P; - p2 = &P2; - pair = &Pair; - pair->a = p; - pair->b = p2; - memset (p, 0, sizeof (*p)); - memset (p2, 0, sizeof (*p2)); + s = &S; + memset (s, 0, sizeof(*s)); + s->initializing_p = True; + p = &s->prefs; - global_prefs_pair = pair; /* I hate C so much... */ + global_state_kludge = s; /* I hate C so much... */ progname = real_progname; - short_version = (char *) malloc (5); - memcpy (short_version, screensaver_id + 17, 4); - short_version [4] = 0; + s->short_version = (char *) malloc (5); + memcpy (s->short_version, screensaver_id + 17, 4); + s->short_version [4] = 0; /* Register our error message logger for every ``log domain'' known. @@ -2376,12 +3447,17 @@ main (int argc, char **argv) for all of the domains that seem to be in use. */ { - const char * const domains[] = { "Gtk", "Gdk", "GLib", "GModule", - "GThread", "Gnome", "GnomeUI", 0 }; - for (i = 0; domains[i]; i++) + const char * const domains[] = { 0, + "Gtk", "Gdk", "GLib", "GModule", + "GThread", "Gnome", "GnomeUI" }; + for (i = 0; i < countof(domains); i++) g_log_set_handler (domains[i], G_LOG_LEVEL_MASK, g_log_handler, 0); } +#ifdef DEFAULT_ICONDIR /* from -D on compile line */ + add_pixmap_directory (DEFAULT_ICONDIR); +#endif + /* This is gross, but Gtk understands --display and not -display... */ for (i = 1; i < argc; i++) @@ -2406,10 +3482,21 @@ main (int argc, char **argv) # else /* !HAVE_CRAPPLET */ fprintf (stderr, "%s: not compiled with --crapplet support\n", real_progname); - USAGE (); + fprintf (stderr, "%s: %s\n", real_progname, usage); exit (1); # endif /* !HAVE_CRAPPLET */ } + else if (argv[i] && + (!strcmp(argv[i], "--debug") || + !strcmp(argv[i], "-debug") || + !strcmp(argv[i], "-d"))) + { + int j; + s->debug_p = True; + for (j = i; j < argc; j++) /* remove it from the list */ + argv[j] = argv[j+1]; + argc--; + } /* Let Gtk open the X connection, then initialize Xt to use that same connection. Doctor Frankenstein would be proud. @@ -2421,7 +3508,7 @@ main (int argc, char **argv) GnomeClientFlags flags = 0; int init_results = gnome_capplet_init ("screensaver-properties", - short_version, + s->short_version, argc, argv, NULL, 0, NULL); /* init_results is: 0 upon successful initialization; @@ -2514,16 +3601,18 @@ main (int argc, char **argv) XtGetApplicationNameAndClass (dpy, &progname, &progclass); XSetErrorHandler (demo_ehandler); + /* Let's just ignore these. They seem to confuse Irix Gtk... */ + signal (SIGPIPE, SIG_IGN); /* After doing Xt-style command-line processing, complain about any unrecognized command-line arguments. */ for (i = 1; i < argc; i++) { - char *s = argv[i]; - if (s[0] == '-' && s[1] == '-') - s++; - if (!strcmp (s, "-prefs")) + char *str = argv[i]; + if (str[0] == '-' && str[1] == '-') + str++; + if (!strcmp (str, "-prefs")) prefs = True; else if (crapplet_p) /* There are lots of random args that we don't care about when we're @@ -2532,7 +3621,7 @@ main (int argc, char **argv) else { fprintf (stderr, "%s: unknown option: %s\n", real_progname, argv[i]); - USAGE (); + fprintf (stderr, "%s: %s\n", real_progname, usage); exit (1); } } @@ -2544,7 +3633,7 @@ main (int argc, char **argv) */ p->db = db; load_init_file (p); - *p2 = *p; + initialize_sort_map (s); /* Now that Xt has been initialized, and the resources have been read, we can set our `progname' variable to something more in line with @@ -2584,12 +3673,13 @@ main (int argc, char **argv) /* Create the window and all its widgets. */ - gtk_window = create_xscreensaver_demo (); - toplevel_widget = gtk_window; + s->base_widget = create_xscreensaver_demo (); + s->popup_widget = create_xscreensaver_settings_dialog (); + s->toplevel_widget = s->base_widget; + - /* Set the window's title. */ + /* Set the main window's title. */ { - char title[255]; char *v = (char *) strdup(strchr(screensaver_id, ' ')); char *s1, *s2, *s3, *s4; s1 = (char *) strchr(v, ' '); s1++; @@ -2598,38 +3688,77 @@ main (int argc, char **argv) s4 = (char *) strchr(s3, ')'); *s2 = 0; *s4 = 0; - sprintf (title, "%.50s %.50s, %.50s", progclass, s1, s3); - gtk_window_set_title (GTK_WINDOW (gtk_window), title); + sprintf (window_title, "%.50s %.50s, %.50s", progclass, s1, s3); + gtk_window_set_title (GTK_WINDOW (s->toplevel_widget), window_title); + gtk_window_set_title (GTK_WINDOW (s->popup_widget), window_title); free (v); } + /* Adjust the (invisible) notebooks on the popup dialog... */ + { + GtkNotebook *notebook = + GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); + GtkWidget *std = GTK_WIDGET (name_to_widget (s, "std_button")); + int page = 0; + +# ifdef HAVE_XML + gtk_widget_hide (std); +# else /* !HAVE_XML */ + /* Make the advanced page be the only one available. */ + gtk_widget_set_sensitive (std, False); + std = GTK_WIDGET (name_to_widget (s, "adv_button")); + gtk_widget_hide (std); + page = 1; +# endif /* !HAVE_XML */ + + gtk_notebook_set_page (notebook, page); + gtk_notebook_set_show_tabs (notebook, False); + } + /* Various other widget initializations... */ - gtk_signal_connect (GTK_OBJECT (gtk_window), "delete_event", - GTK_SIGNAL_FUNC (wm_close_cb), NULL); - - populate_hack_list (gtk_window, pair); - populate_prefs_page (gtk_window, pair); - sensitize_demo_widgets (gtk_window, False); - fix_text_entry_sizes (gtk_window); - scroll_to_current_hack (gtk_window, pair); - - gtk_signal_connect ( - GTK_OBJECT (name_to_widget (GTK_WIDGET (gtk_window), "list")), - "map", GTK_SIGNAL_FUNC(map_window_cb), 0); - gtk_signal_connect ( - GTK_OBJECT (name_to_widget (GTK_WIDGET (gtk_window), "prev")), - "map", GTK_SIGNAL_FUNC(map_prev_button_cb), 0); - gtk_signal_connect ( - GTK_OBJECT (name_to_widget (GTK_WIDGET (gtk_window), "next")), - "map", GTK_SIGNAL_FUNC(map_next_button_cb), 0); + gtk_signal_connect (GTK_OBJECT (s->toplevel_widget), "delete_event", + GTK_SIGNAL_FUNC (wm_toplevel_close_cb), + (gpointer) s); + gtk_signal_connect (GTK_OBJECT (s->popup_widget), "delete_event", + GTK_SIGNAL_FUNC (wm_popup_close_cb), + (gpointer) s); + + populate_hack_list (s); + populate_prefs_page (s); + sensitize_demo_widgets (s, False); + fix_text_entry_sizes (s); + scroll_to_current_hack (s); + + gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "cancel_button")), + "map", GTK_SIGNAL_FUNC(map_popup_window_cb), + (gpointer) s); + + gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "prev")), + "map", GTK_SIGNAL_FUNC(map_prev_button_cb), + (gpointer) s); + gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "next")), + "map", GTK_SIGNAL_FUNC(map_next_button_cb), + (gpointer) s); + + + /* Hook up callbacks to the items on the mode menu. */ + { + GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu")); + GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt)); + GList *kids = gtk_container_children (GTK_CONTAINER (menu)); + for (; kids; kids = kids->next) + gtk_signal_connect (GTK_OBJECT (kids->data), "activate", + GTK_SIGNAL_FUNC (mode_menu_item_cb), + (gpointer) s); + } /* Handle the -prefs command-line argument. */ if (prefs) { GtkNotebook *notebook = - GTK_NOTEBOOK (name_to_widget (gtk_window, "notebook")); + GTK_NOTEBOOK (name_to_widget (s, "notebook")); gtk_notebook_set_page (notebook, 1); } @@ -2637,39 +3766,71 @@ main (int argc, char **argv) if (crapplet_p) { GtkWidget *capplet; - GtkWidget *top_vbox; + GtkWidget *outer_vbox; - capplet = capplet_widget_new (); - - top_vbox = GTK_BIN (gtk_window)->child; + gtk_widget_hide (s->toplevel_widget); - gtk_widget_ref (top_vbox); - gtk_container_remove (GTK_CONTAINER (gtk_window), top_vbox); - GTK_OBJECT_SET_FLAGS (top_vbox, GTK_FLOATING); + capplet = capplet_widget_new (); - /* In crapplet-mode, take off the menubar. */ - gtk_widget_hide (name_to_widget (gtk_window, "menubar")); + /* Make there be a "Close" button instead of "OK" and "Cancel" */ + capplet_widget_changes_are_immediate (CAPPLET_WIDGET (capplet)); - gtk_container_add (GTK_CONTAINER (capplet), top_vbox); - gtk_widget_show (capplet); - gtk_widget_hide (gtk_window); +# if 1 + /* In crapplet-mode, take off the menubar. */ + gtk_widget_hide (name_to_widget (s, "menubar")); +# endif - /* Hook up the Control Center's redundant Help button, too. */ - gtk_signal_connect (GTK_OBJECT (capplet), "help", - GTK_SIGNAL_FUNC (doc_menu_cb), 0); + /* Reparent our top-level container to be a child of the capplet + window. + */ + outer_vbox = GTK_BIN (s->toplevel_widget)->child; + gtk_widget_ref (outer_vbox); + gtk_container_remove (GTK_CONTAINER (s->toplevel_widget), + outer_vbox); + GTK_OBJECT_SET_FLAGS (outer_vbox, GTK_FLOATING); + gtk_container_add (GTK_CONTAINER (capplet), outer_vbox); + + /* Find the window above us, and set the title and close handler. */ + { + GtkWidget *window = capplet; + while (window && !GTK_IS_WINDOW (window)) + window = window->parent; + if (window) + { + gtk_window_set_title (GTK_WINDOW (window), window_title); + gtk_signal_connect (GTK_OBJECT (window), "delete_event", + GTK_SIGNAL_FUNC (wm_toplevel_close_cb), + (gpointer) s); + } + } - /* Issue any warnings about the running xscreensaver daemon. */ - the_network_is_not_the_computer (top_vbox); + s->toplevel_widget = capplet; } - else # endif /* HAVE_CRAPPLET */ - { - gtk_widget_show (gtk_window); - init_icon (GTK_WIDGET(gtk_window)->window); - /* Issue any warnings about the running xscreensaver daemon. */ - the_network_is_not_the_computer (gtk_window); - } + + gtk_widget_show (s->toplevel_widget); + init_icon (GTK_WIDGET (s->toplevel_widget)->window); /* after `show' */ + hack_environment (s); + fix_preview_visual (s); + + /* Realize page zero, so that we can diddle the scrollbar when the + user tabs back to it -- otherwise, the current hack isn't scrolled + to the first time they tab back there, when started with "-prefs". + (Though it is if they then tab away, and back again.) + + #### Bah! This doesn't work. Gtk eats my ass! Someone who + #### understands this crap, explain to me how to make this work. + */ + gtk_widget_realize (name_to_widget (s, "demos_table")); + + + gtk_timeout_add (60 * 1000, check_blanked_timer, s); + + + /* Issue any warnings about the running xscreensaver daemon. */ + the_network_is_not_the_computer (s); + /* Run the Gtk event loop, and not the Xt event loop. This means that if there were Xt timers or fds registered, they would never get serviced, @@ -2678,7 +3839,27 @@ main (int argc, char **argv) Xt so that we could process the command line and use the X resource manager. */ - initializing_p = False; + s->initializing_p = False; + + /* This totally sucks -- set a timer that whacks the scrollbar 0.5 seconds + after we start up. Otherwise, it always appears scrolled to the top + when in crapplet-mode. */ + gtk_timeout_add (500, delayed_scroll_kludge, s); + + +#if 0 + /* Load every configurator in turn, to scan them for errors all at once. */ + { + int i; + for (i = 0; i < p->screenhacks_count; i++) + { + screenhack *hack = p->screenhacks[s->hack_number_to_list_elt[i]]; + conf_data *d = load_configurator (hack->command, False); + if (d) free_conf_data (d); + } + } +#endif + # ifdef HAVE_CRAPPLET if (crapplet_p) @@ -2687,6 +3868,7 @@ main (int argc, char **argv) # endif /* HAVE_CRAPPLET */ gtk_main (); + kill_preview_subproc (s); exit (0); } diff --git a/driver/demo-Xm-widgets.c b/driver/demo-Xm-widgets.c index 80094ca5..09199d9f 100644 --- a/driver/demo-Xm-widgets.c +++ b/driver/demo-Xm-widgets.c @@ -46,6 +46,7 @@ #endif /* HAVE_XMCOMBOBOX */ #include +#include @@ -457,6 +458,111 @@ create_demos_page (Widget parent) static Widget create_options_page (Widget parent) { + /* This is what the layout is today: + + Form (horizontal) + Label ("Saver Timeout") + Label ("Cycle Timeout") + Label ("Fade Duration") + Label ("Fade Ticks") + Label ("Lock Timeout") + Label ("Password Timeout") + + Text (timeout) + Text (cycle) + Text (fade seconds) + Text (fade ticks) + Text (lock) + Text (passwd) + + Toggle ("Verbose") + Toggle ("Install Colormap") + Toggle ("Fade Colormap") + Toggle ("Unfade Colormap") + Toggle ("Require Password") + + HR + Button ("OK") + Button ("Cancel") + */ + + /* This is what it should be: + + Form (horizontal) + Form (vertical) ("column1") + Frame + Label ("Blanking and Locking") + Form + Label ("Blank After") + Label ("Cycle After") + Text ("Blank After") + Text ("Cycle After") + HR + Checkbox ("Require Password") + Label ("Lock After") + Text ("Lock After") + Frame + Label ("Image Manipulation") + Form + Checkbox ("Grab Desktop Images") + Checkbox ("Grab Video Frames") + Checkbox ("Choose Random Image") + Text (pathname) + Button ("Browse") + Frame + Label ("Diagnostics") + Form + Checkbox ("Verbose Diagnostics") + Checkbox ("Display Subprocess Errors") + Checkbox ("Display Splash Screen at Startup") + Form (vertical) ("column2") + Frame + Label ("Display Power Management") + Form + Checkbox ("Power Management Enabled") + Label ("Standby After") + Label ("Suspend After") + Label ("Off After") + Text ("Standby After") + Text ("Suspend After") + Text ("Off After") + Frame + Label ("Colormaps") + Form + Checkbox ("Install Colormap") + HR + Checkbox ("Fade To Black When Blanking") + Checkbox ("Fade From Black When Unblanking") + Label ("Fade Duration") + Text ("Fade Duration") + + timeoutLabel + cycleLabel + fadeSecondsLabel + fadeTicksLabel + lockLabel + passwdLabel + + timeoutText + cycleText + fadeSecondsText + fadeTicksText + lockText + passwdText + + verboseToggle + cmapToggle + fadeToggle + unfadeToggle + lockToggle + + separator + OK + Cancel + */ + + + Arg av[64]; int ac = 0; Widget children[100]; diff --git a/driver/lock.c b/driver/lock.c index 0e8e5dff..aad2cc6f 100644 --- a/driver/lock.c +++ b/driver/lock.c @@ -75,6 +75,9 @@ enum passwd_state { pw_read, pw_ok, pw_null, pw_fail, pw_cancel, pw_time }; struct passwd_dialog_data { + saver_screen_info *prompt_screen; + int previous_mouse_x, previous_mouse_y; + enum passwd_state state; char typed_passwd [80]; XtIntervalId timer; @@ -141,11 +144,19 @@ make_passwd_window (saver_info *si) struct passwd *p = getpwuid (getuid ()); XSetWindowAttributes attrs; unsigned long attrmask = 0; - Screen *screen = si->default_screen->screen; passwd_dialog_data *pw = (passwd_dialog_data *) calloc (1, sizeof(*pw)); - Colormap cmap = DefaultColormapOfScreen (screen); + Screen *screen; + Colormap cmap; char *f; + pw->prompt_screen = &si->screens [mouse_screen (si)]; + if (si->prefs.verbose_p) + fprintf (stderr, "%s: %d: creating password dialog.\n", + blurb(), pw->prompt_screen->number); + + screen = pw->prompt_screen->screen; + cmap = DefaultColormapOfScreen (screen); + pw->ratio = 1.0; pw->heading_label = get_string_resource ("passwd.heading.label", @@ -335,9 +346,40 @@ make_passwd_window (saver_info *si) attrmask |= CWOverrideRedirect; attrs.override_redirect = True; attrmask |= CWEventMask; attrs.event_mask = ExposureMask|KeyPressMask; + /* We need to remember the mouse position and restore it afterward, or + sometimes (perhaps only with Xinerama?) the mouse gets warped to + inside the bounds of the lock dialog window. + */ + { + Window pointer_root, pointer_child; + int root_x, root_y, win_x, win_y; + unsigned int mask; + pw->previous_mouse_x = 0; + pw->previous_mouse_y = 0; + if (XQueryPointer (si->dpy, RootWindowOfScreen (pw->prompt_screen->screen), + &pointer_root, &pointer_child, + &root_x, &root_y, &win_x, &win_y, &mask)) + { + pw->previous_mouse_x = root_x; + pw->previous_mouse_y = root_y; + if (si->prefs.verbose_p) + fprintf (stderr, "%s: %d: mouse is at %d,%d.\n", + blurb(), pw->prompt_screen->number, + pw->previous_mouse_x, pw->previous_mouse_y); + } + else if (si->prefs.verbose_p) + fprintf (stderr, "%s: %d: unable to determine mouse position?\n", + blurb(), pw->prompt_screen->number); + } + + /* Figure out where on the desktop to place the window so that it will + actually be visible; this takes into account virtual viewports as + well as Xinerama. */ { int x, y, w, h; - get_screen_viewport (si->default_screen, &x, &y, &w, &h, False); + get_screen_viewport (pw->prompt_screen, &x, &y, &w, &h, + pw->previous_mouse_x, pw->previous_mouse_y, + si->prefs.verbose_p); if (si->prefs.debug_p) w /= 2; pw->x = x + ((w + pw->width) / 2) - pw->width; pw->y = y + ((h + pw->height) / 2) - pw->height; @@ -371,13 +413,13 @@ make_passwd_window (saver_info *si) XGCValues gcv; GC gc; pw->save_under = XCreatePixmap (si->dpy, - si->default_screen->screensaver_window, + pw->prompt_screen->screensaver_window, pw->width + (pw->border_width*2) + 1, pw->height + (pw->border_width*2) + 1, - si->default_screen->current_depth); + pw->prompt_screen->current_depth); gcv.function = GXcopy; gc = XCreateGC (si->dpy, pw->save_under, GCFunction, &gcv); - XCopyArea (si->dpy, si->default_screen->screensaver_window, + XCopyArea (si->dpy, pw->prompt_screen->screensaver_window, pw->save_under, gc, pw->x - pw->border_width, pw->y - pw->border_width, pw->width + (pw->border_width*2) + 1, @@ -389,11 +431,15 @@ make_passwd_window (saver_info *si) XMapRaised (si->dpy, si->passwd_dialog); XSync (si->dpy, False); - move_mouse_grab (si, si->passwd_dialog, si->screens[0].cursor); + move_mouse_grab (si, si->passwd_dialog, + pw->prompt_screen->cursor, + pw->prompt_screen->number); undo_vp_motion (si); si->pw_data = pw; + if (cmap) + XInstallColormap (si->dpy, cmap); draw_passwd_window (si); XSync (si->dpy, False); } @@ -546,10 +592,10 @@ draw_passwd_window (saver_info *si) /* The logo */ - x1 = pw->shadow_width * 3; - y1 = pw->shadow_width * 3; - x2 = pw->logo_width - (pw->shadow_width * 6); - y2 = pw->logo_height - (pw->shadow_width * 6); + x1 = pw->shadow_width * 6; + y1 = pw->shadow_width * 6; + x2 = pw->logo_width - (pw->shadow_width * 12); + y2 = pw->logo_height - (pw->shadow_width * 12); if (pw->logo_pixmap) { @@ -578,20 +624,22 @@ draw_passwd_window (saver_info *si) XSetForeground (si->dpy, gc2, pw->thermo_background); pw->thermo_field_x = pw->logo_width + pw->shadow_width; - pw->thermo_field_y = pw->shadow_width * 3; - pw->thermo_field_height = pw->height - (pw->shadow_width * 6); + pw->thermo_field_y = pw->shadow_width * 5; + pw->thermo_field_height = pw->height - (pw->shadow_width * 10); +#if 0 /* Solid border inside the logo box. */ XSetForeground (si->dpy, gc1, pw->foreground); XDrawRectangle (si->dpy, si->passwd_dialog, gc1, x1, y1, x2-1, y2-1); +#endif /* The shadow around the logo */ draw_shaded_rectangle (si->dpy, si->passwd_dialog, - pw->shadow_width * 2, - pw->shadow_width * 2, - pw->logo_width - (pw->shadow_width * 4), - pw->logo_height - (pw->shadow_width * 4), + pw->shadow_width * 4, + pw->shadow_width * 4, + pw->logo_width - (pw->shadow_width * 8), + pw->logo_height - (pw->shadow_width * 8), pw->shadow_width, pw->shadow_bottom, pw->shadow_top); @@ -599,19 +647,19 @@ draw_passwd_window (saver_info *si) */ draw_shaded_rectangle (si->dpy, si->passwd_dialog, pw->logo_width, - pw->shadow_width * 2, + pw->shadow_width * 4, pw->thermo_width + (pw->shadow_width * 2), - pw->height - (pw->shadow_width * 4), + pw->height - (pw->shadow_width * 8), pw->shadow_width, pw->shadow_bottom, pw->shadow_top); +#if 1 /* Solid border inside the thermometer. */ XSetForeground (si->dpy, gc1, pw->foreground); XDrawRectangle (si->dpy, si->passwd_dialog, gc1, - pw->logo_width + pw->shadow_width, - pw->shadow_width * 3, - pw->thermo_width - 1, - pw->height - (pw->shadow_width * 6) - 1); + pw->thermo_field_x, pw->thermo_field_y, + pw->thermo_width - 1, pw->thermo_field_height - 1); +#endif /* The shadow around the whole window */ @@ -688,7 +736,7 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio) /* the thermometer */ - y = pw->thermo_field_height * (1.0 - pw->ratio); + y = (pw->thermo_field_height - 2) * (1.0 - pw->ratio); if (y > 0) { XFillRectangle (si->dpy, si->passwd_dialog, gc2, @@ -713,17 +761,33 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio) static void destroy_passwd_window (saver_info *si) { + saver_preferences *p = &si->prefs; passwd_dialog_data *pw = si->pw_data; - Screen *screen = si->default_screen->screen; - Colormap cmap = DefaultColormapOfScreen (screen); - Pixel black = BlackPixelOfScreen (screen); - Pixel white = WhitePixelOfScreen (screen); + saver_screen_info *ssi = pw->prompt_screen; + Colormap cmap = DefaultColormapOfScreen (ssi->screen); + Pixel black = BlackPixelOfScreen (ssi->screen); + Pixel white = WhitePixelOfScreen (ssi->screen); + XEvent event; if (pw->timer) XtRemoveTimeOut (pw->timer); - move_mouse_grab (si, RootWindowOfScreen(si->screens[0].screen), - si->screens[0].cursor); + move_mouse_grab (si, RootWindowOfScreen (ssi->screen), + ssi->cursor, ssi->number); + + if (p->verbose_p) + fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n", + blurb(), ssi->number, + pw->previous_mouse_x, pw->previous_mouse_y); + + XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen), + 0, 0, 0, 0, + pw->previous_mouse_x, pw->previous_mouse_y); + + XSync (si->dpy, False); + while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event)) + if (p->verbose_p) + fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb()); if (si->passwd_dialog) { @@ -736,10 +800,9 @@ destroy_passwd_window (saver_info *si) XGCValues gcv; GC gc; gcv.function = GXcopy; - gc = XCreateGC (si->dpy, si->default_screen->screensaver_window, - GCFunction, &gcv); + gc = XCreateGC (si->dpy, ssi->screensaver_window, GCFunction, &gcv); XCopyArea (si->dpy, pw->save_under, - si->default_screen->screensaver_window, gc, + ssi->screensaver_window, gc, 0, 0, pw->width + (pw->border_width*2) + 1, pw->height + (pw->border_width*2) + 1, @@ -786,6 +849,9 @@ destroy_passwd_window (saver_info *si) memset (pw, 0, sizeof(*pw)); free (pw); + if (cmap) + XInstallColormap (si->dpy, cmap); + si->pw_data = 0; } @@ -893,37 +959,40 @@ static Bool vp_got_error = False; static void xfree_lock_mode_switch (saver_info *si, Bool lock_p) { - static Bool mode_locked_p = False; + static Bool any_mode_locked_p = False; saver_preferences *p = &si->prefs; - int screen = 0; /* always screen 0 */ + int screen; int event, error; Bool status; XErrorHandler old_handler; - if (mode_locked_p == lock_p) + if (any_mode_locked_p == lock_p) return; if (!XF86VidModeQueryExtension (si->dpy, &event, &error)) return; - XSync (si->dpy, False); - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - status = XF86VidModeLockModeSwitch (si->dpy, screen, lock_p); - XSync (si->dpy, False); - XSetErrorHandler (old_handler); - if (vp_got_error) status = False; - - if (status) - mode_locked_p = lock_p; - - if (!status && (p->verbose_p || !lock_p)) - /* Only print this when verbose, or when we locked but can't unlock. - I tried printing this message whenever it comes up, but - mode-locking always fails if DontZoom is set in XF86Config. */ - fprintf (stderr, "%s: unable to %s mode switching!\n", - blurb(), (lock_p ? "lock" : "unlock")); - else if (p->verbose_p) - fprintf (stderr, "%s: %s mode switching.\n", - blurb(), (lock_p ? "locked" : "unlocked")); + for (screen = 0; screen < si->nscreens; screen++) + { + XSync (si->dpy, False); + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); + status = XF86VidModeLockModeSwitch (si->dpy, screen, lock_p); + XSync (si->dpy, False); + XSetErrorHandler (old_handler); + if (vp_got_error) status = False; + + if (status) + any_mode_locked_p = lock_p; + + if (!status && (p->verbose_p || !lock_p)) + /* Only print this when verbose, or when we locked but can't unlock. + I tried printing this message whenever it comes up, but + mode-locking always fails if DontZoom is set in XF86Config. */ + fprintf (stderr, "%s: %d: unable to %s mode switching!\n", + blurb(), screen, (lock_p ? "lock" : "unlock")); + else if (p->verbose_p) + fprintf (stderr, "%s: %d: %s mode switching.\n", + blurb(), screen, (lock_p ? "locked" : "unlocked")); + } } static int @@ -945,40 +1014,47 @@ undo_vp_motion (saver_info *si) { #ifdef HAVE_XF86VMODE saver_preferences *p = &si->prefs; - int screen = 0; /* always screen 0 */ - saver_screen_info *ssi = &si->screens[screen]; - int event, error, x, y; - Bool status; + int screen; + int event, error; - if (ssi->blank_vp_x == -1 && ssi->blank_vp_y == -1) - return; if (!XF86VidModeQueryExtension (si->dpy, &event, &error)) return; - if (!XF86VidModeGetViewPort (si->dpy, 0, &x, &y)) - return; - if (ssi->blank_vp_x == x && ssi->blank_vp_y == y) - return; - - /* We're going to move the viewport. The mouse has just been grabbed on - (and constrained to, thus warped to) the password window, so it is no - longer near the edge of the screen. However, wait a bit anyway, just - to make sure the server drains its last motion event, so that the - screen doesn't continue to scroll after we've reset the viewport. - */ - XSync (si->dpy, False); - usleep (250000); /* 1/4 second */ - XSync (si->dpy, False); - - status = XF86VidModeSetViewPort (si->dpy, screen, - ssi->blank_vp_x, ssi->blank_vp_y); - if (!status) - fprintf (stderr, "%s: unable to move vp from (%d,%d) back to (%d,%d)!\n", - blurb(), x, y, ssi->blank_vp_x, ssi->blank_vp_y); - else if (p->verbose_p) - fprintf (stderr, "%s: vp moved to (%d,%d); moved it back to (%d,%d).\n", - blurb(), x, y, ssi->blank_vp_x, ssi->blank_vp_y); + for (screen = 0; screen < si->nscreens; screen++) + { + saver_screen_info *ssi = &si->screens[screen]; + int x, y; + Bool status; + + if (ssi->blank_vp_x == -1 && ssi->blank_vp_y == -1) + break; + if (!XF86VidModeGetViewPort (si->dpy, screen, &x, &y)) + return; + if (ssi->blank_vp_x == x && ssi->blank_vp_y == y) + return; + + /* We're going to move the viewport. The mouse has just been grabbed on + (and constrained to, thus warped to) the password window, so it is no + longer near the edge of the screen. However, wait a bit anyway, just + to make sure the server drains its last motion event, so that the + screen doesn't continue to scroll after we've reset the viewport. + */ + XSync (si->dpy, False); + usleep (250000); /* 1/4 second */ + XSync (si->dpy, False); + status = XF86VidModeSetViewPort (si->dpy, screen, + ssi->blank_vp_x, ssi->blank_vp_y); + + if (!status) + fprintf (stderr, + "%s: %d: unable to move vp from (%d,%d) back to (%d,%d)!\n", + blurb(), screen, x, y, ssi->blank_vp_x, ssi->blank_vp_y); + else if (p->verbose_p) + fprintf (stderr, + "%s: %d: vp moved to (%d,%d); moved it back to (%d,%d).\n", + blurb(), screen, x, y, ssi->blank_vp_x, ssi->blank_vp_y); + } #endif /* HAVE_XF86VMODE */ } @@ -1225,8 +1301,6 @@ Bool unlock_p (saver_info *si) { saver_preferences *p = &si->prefs; - Screen *screen = si->default_screen->screen; - Colormap cmap = DefaultColormapOfScreen (screen); Bool status; raise_window (si, True, True, True); @@ -1238,7 +1312,6 @@ unlock_p (saver_info *si) destroy_passwd_window (si); make_passwd_window (si); - if (cmap) XInstallColormap (si->dpy, cmap); compose_status = calloc (1, sizeof (*compose_status)); @@ -1251,9 +1324,6 @@ unlock_p (saver_info *si) free (compose_status); compose_status = 0; - cmap = si->default_screen->cmap; - if (cmap) XInstallColormap (si->dpy, cmap); - return status; } diff --git a/driver/prefs.c b/driver/prefs.c index c074d1f4..7dcb768a 100644 --- a/driver/prefs.c +++ b/driver/prefs.c @@ -261,6 +261,8 @@ static const char * const prefs[] = { "grabVideoFrames", "chooseRandomImages", "imageDirectory", + "mode", + "selected", "", "programs", "", @@ -778,6 +780,13 @@ write_init_file (saver_preferences *p, const char *version_string, CHECK("chooseRandomImages")type =pref_bool, b = p->random_image_p; CHECK("imageDirectory") type =pref_str, s = p->image_directory; + CHECK("mode") type = pref_str, + s = (p->mode == ONE_HACK ? "one" : + p->mode == BLANK_ONLY ? "blank" : + p->mode == DONT_BLANK ? "off" : + "random"); + CHECK("selected") type = pref_int, i = p->selected_hack; + CHECK("programs") type = pref_str, s = programs; CHECK("pointerPollTime") type = pref_time, t = p->pointer_timeout; CHECK("windowCreationTimeout")type=pref_time,t= p->notice_events_timeout; @@ -838,6 +847,9 @@ write_init_file (saver_preferences *p, const char *version_string, abort(); break; } + + if (pr && !strcmp(pr, "mode")) fprintf(out, "\n"); + write_entry (out, pr, s); } @@ -1069,6 +1081,18 @@ load_init_file (saver_preferences *p) get_screenhacks (p); + p->selected_hack = get_integer_resource ("selected", "Integer"); + if (p->selected_hack < 0 || p->selected_hack >= p->screenhacks_count) + p->selected_hack = -1; + + { + char *s = get_string_resource ("mode", "Mode"); + if (s && !strcasecmp (s, "one")) p->mode = ONE_HACK; + else if (s && !strcasecmp (s, "blank")) p->mode = BLANK_ONLY; + else if (s && !strcasecmp (s, "off")) p->mode = DONT_BLANK; + else p->mode = RANDOM_HACKS; + } + if (system_default_screenhack_count) /* note: first_time is also true */ { merge_system_screenhacks (p, system_default_screenhacks, diff --git a/driver/prefs.h b/driver/prefs.h index fb4cd1bd..6640492b 100644 --- a/driver/prefs.h +++ b/driver/prefs.h @@ -20,6 +20,8 @@ struct screenhack { char *command; }; +typedef enum { RANDOM_HACKS, ONE_HACK, BLANK_ONLY, DONT_BLANK } saver_mode; + typedef struct saver_preferences saver_preferences; @@ -57,6 +59,9 @@ struct saver_preferences { screenhack **screenhacks; /* the programs to run */ int screenhacks_count; + saver_mode mode; /* hack-selection mode */ + int selected_hack; /* in one_hack mode, this is the one */ + int nice_inferior; /* nice value for subprocs */ int inferior_memory_limit; /* setrlimit(LIMIT_AS) value for subprocs */ diff --git a/driver/splash.c b/driver/splash.c index 33d255eb..0ae76a4a 100644 --- a/driver/splash.c +++ b/driver/splash.c @@ -100,11 +100,15 @@ static void destroy_splash_window (saver_info *si); static void unsplash_timer (XtPointer closure, XtIntervalId *id); static void do_demo (saver_info *si); +#ifdef PREFS_BUTTON static void do_prefs (saver_info *si); +#endif /* PREFS_BUTTON */ static void do_help (saver_info *si); struct splash_dialog_data { + + saver_screen_info *prompt_screen; XtIntervalId timer; Dimension width; @@ -114,7 +118,9 @@ struct splash_dialog_data { char *body_label; char *body2_label; char *demo_label; +#ifdef PREFS_BUTTON char *prefs_label; +#endif /* PREFS_BUTTON */ char *help_label; XFontStruct *heading_font; @@ -135,7 +141,9 @@ struct splash_dialog_data { Dimension button_width, button_height; Dimension demo_button_x, demo_button_y; +#ifdef PREFS_BUTTON Dimension prefs_button_x, prefs_button_y; +#endif /* PREFS_BUTTON */ Dimension help_button_x, help_button_y; Pixmap logo_pixmap; @@ -153,8 +161,8 @@ make_splash_dialog (saver_info *si) XSetWindowAttributes attrs; unsigned long attrmask = 0; splash_dialog_data *sp; - Screen *screen = si->default_screen->screen; - Colormap cmap = DefaultColormapOfScreen (screen); + saver_screen_info *ssi; + Colormap cmap; char *f; if (si->sp_data) @@ -163,7 +171,11 @@ make_splash_dialog (saver_info *si) si->prefs.splash_duration <= 0) return; + ssi = &si->screens[mouse_screen (si)]; + cmap = DefaultColormapOfScreen (ssi->screen); + sp = (splash_dialog_data *) calloc (1, sizeof(*sp)); + sp->prompt_screen = ssi; sp->heading_label = get_string_resource ("splash.heading.label", "Dialog.Label.Label"); @@ -173,8 +185,10 @@ make_splash_dialog (saver_info *si) "Dialog.Label.Label"); sp->demo_label = get_string_resource ("splash.demo.label", "Dialog.Button.Label"); +#ifdef PREFS_BUTTON sp->prefs_label = get_string_resource ("splash.prefs.label", "Dialog.Button.Label"); +#endif /* PREFS_BUTTON */ sp->help_label = get_string_resource ("splash.help.label", "Dialog.Button.Label"); @@ -185,7 +199,9 @@ make_splash_dialog (saver_info *si) if (!sp->body2_label) sp->body2_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); if (!sp->demo_label) sp->demo_label = strdup("ERROR"); +#ifdef PREFS_BUTTON if (!sp->prefs_label) sp->prefs_label = strdup("ERROR"); +#endif /* PREFS_BUTTON */ if (!sp->help_label) sp->help_label = strdup("ERROR"); /* Put the version number in the label. */ @@ -221,8 +237,8 @@ make_splash_dialog (saver_info *si) if (sp->foreground == sp->background) { /* Make sure the error messages show up. */ - sp->foreground = BlackPixelOfScreen (screen); - sp->background = WhitePixelOfScreen (screen); + sp->foreground = BlackPixelOfScreen (ssi->screen); + sp->background = WhitePixelOfScreen (ssi->screen); } sp->button_foreground = get_pixel_resource ("splash.Button.foreground", @@ -291,12 +307,17 @@ make_splash_dialog (saver_info *si) w2 = overall.width; h2 = ascent + descent; +#ifdef PREFS_BUTTON /* Measure the Prefs button. */ XTextExtents (sp->button_font, sp->prefs_label, strlen(sp->prefs_label), &direction, &ascent, &descent, &overall); w3 = overall.width; h3 = ascent + descent; +#else /* !PREFS_BUTTON */ + w3 = 0; + h3 = 0; +#endif /* !PREFS_BUTTON */ /* Measure the Help button. */ XTextExtents (sp->button_font, @@ -308,13 +329,20 @@ make_splash_dialog (saver_info *si) w2 = MAX(w2, w3); w2 = MAX(w2, w4); h2 = MAX(h2, h3); h2 = MAX(h2, h4); + /* Add some horizontal padding inside the buttons. */ + w2 += ascent; + w2 += ((ascent + descent) / 2) + (sp->shadow_width * 2); h2 += ((ascent + descent) / 2) + (sp->shadow_width * 2); sp->button_width = w2; sp->button_height = h2; +#ifdef PREFS_BUTTON w2 *= 3; +#else /* !PREFS_BUTTON */ + w2 *= 2; +#endif /* !PREFS_BUTTON */ w2 += ((ascent + descent) * 2); /* for space between buttons */ @@ -341,7 +369,23 @@ make_splash_dialog (saver_info *si) { int sx, sy, w, h; - get_screen_viewport (si->default_screen, &sx, &sy, &w, &h, False); + int mouse_x = 0, mouse_y = 0; + + { + Window pointer_root, pointer_child; + int root_x, root_y, win_x, win_y; + unsigned int mask; + if (XQueryPointer (si->dpy, + RootWindowOfScreen (ssi->screen), + &pointer_root, &pointer_child, + &root_x, &root_y, &win_x, &win_y, &mask)) + { + mouse_x = root_x; + mouse_y = root_y; + } + } + + get_screen_viewport (ssi, &sx, &sy, &w, &h, mouse_x, mouse_y, False); if (si->prefs.debug_p) w /= 2; x = sx + (((w + sp->width) / 2) - sp->width); y = sy + (((h + sp->height) / 2) - sp->height); @@ -353,10 +397,10 @@ make_splash_dialog (saver_info *si) si->splash_dialog = XCreateWindow (si->dpy, - RootWindowOfScreen(screen), + RootWindowOfScreen(ssi->screen), x, y, sp->width, sp->height, bw, - DefaultDepthOfScreen (screen), InputOutput, - DefaultVisualOfScreen(screen), + DefaultDepthOfScreen (ssi->screen), InputOutput, + DefaultVisualOfScreen(ssi->screen), attrmask, &attrs); XSetWindowBackground (si->dpy, si->splash_dialog, sp->background); @@ -388,6 +432,12 @@ draw_splash_window (saver_info *si) int x1, x2, x3, y1, y2; int sw; +#ifdef PREFS_BUTTON + int nbuttons = 3; +#else /* !PREFS_BUTTON */ + int nbuttons = 2; +#endif /* !PREFS_BUTTON */ + height = (sp->heading_font->ascent + sp->heading_font->descent + sp->body_font->ascent + sp->body_font->descent + sp->body_font->ascent + sp->body_font->descent + @@ -448,7 +498,7 @@ draw_splash_window (saver_info *si) / 2) + sp->button_font->ascent); hspacing = ((sp->width - x1 - (sp->shadow_width * 2) - - sp->internal_border - (sp->button_width * 3)) + sp->internal_border - (sp->button_width * nbuttons)) / 2); x2 = x1 + ((sp->button_width - string_width(sp->button_font, sp->demo_label)) @@ -460,6 +510,7 @@ draw_splash_window (saver_info *si) sp->demo_button_x = x1; sp->demo_button_y = y1; +#ifdef PREFS_BUTTON x1 += hspacing + sp->button_width; x2 = x1 + ((sp->button_width - string_width(sp->button_font,sp->prefs_label)) / 2); @@ -469,8 +520,15 @@ draw_splash_window (saver_info *si) sp->prefs_label, strlen(sp->prefs_label)); sp->prefs_button_x = x1; sp->prefs_button_y = y1; +#endif /* PREFS_BUTTON */ +#ifdef PREFS_BUTTON x1 += hspacing + sp->button_width; +#else /* !PREFS_BUTTON */ + x1 = (sp->width - sp->button_width - + sp->internal_border - (sp->shadow_width * 2)); +#endif /* !PREFS_BUTTON */ + x2 = x1 + ((sp->button_width - string_width(sp->button_font,sp->help_label)) / 2); XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, @@ -483,10 +541,10 @@ draw_splash_window (saver_info *si) /* The logo */ - x1 = sp->shadow_width * 3; - y1 = sp->shadow_width * 3; - x2 = sp->logo_width - (sp->shadow_width * 6); - y2 = sp->logo_height - (sp->shadow_width * 6); + x1 = sp->shadow_width * 6; + y1 = sp->shadow_width * 6; + x2 = sp->logo_width - (sp->shadow_width * 12); + y2 = sp->logo_height - (sp->shadow_width * 12); if (sp->logo_pixmap) { @@ -510,16 +568,18 @@ draw_splash_window (saver_info *si) } /* Solid border inside the logo box. */ +#if 0 XSetForeground (si->dpy, gc1, sp->foreground); XDrawRectangle (si->dpy, si->splash_dialog, gc1, x1, y1, x2-1, y2-1); +#endif /* The shadow around the logo */ draw_shaded_rectangle (si->dpy, si->splash_dialog, - sp->shadow_width * 2, - sp->shadow_width * 2, - sp->logo_width - (sp->shadow_width * 4), - sp->logo_height - (sp->shadow_width * 4), + sp->shadow_width * 4, + sp->shadow_width * 4, + sp->logo_width - (sp->shadow_width * 8), + sp->logo_height - (sp->shadow_width * 8), sp->shadow_width, sp->shadow_bottom, sp->shadow_top); @@ -551,11 +611,13 @@ update_splash_window (saver_info *si) sp->button_width, sp->button_height, sp->shadow_width, (pressed == 1 ? sp->shadow_bottom : sp->shadow_top), (pressed == 1 ? sp->shadow_top : sp->shadow_bottom)); +#ifdef PREFS_BUTTON draw_shaded_rectangle (si->dpy, si->splash_dialog, sp->prefs_button_x, sp->prefs_button_y, sp->button_width, sp->button_height, sp->shadow_width, (pressed == 2 ? sp->shadow_bottom : sp->shadow_top), (pressed == 2 ? sp->shadow_top : sp->shadow_bottom)); +#endif /* PREFS_BUTTON */ draw_shaded_rectangle (si->dpy, si->splash_dialog, sp->help_button_x, sp->help_button_y, sp->button_width, sp->button_height, sp->shadow_width, @@ -567,10 +629,10 @@ static void destroy_splash_window (saver_info *si) { splash_dialog_data *sp = si->sp_data; - Screen *screen = si->default_screen->screen; - Colormap cmap = DefaultColormapOfScreen (screen); - Pixel black = BlackPixelOfScreen (screen); - Pixel white = WhitePixelOfScreen (screen); + saver_screen_info *ssi = sp->prompt_screen; + Colormap cmap = DefaultColormapOfScreen (ssi->screen); + Pixel black = BlackPixelOfScreen (ssi->screen); + Pixel white = WhitePixelOfScreen (ssi->screen); if (sp->timer) XtRemoveTimeOut (sp->timer); @@ -584,7 +646,9 @@ destroy_splash_window (saver_info *si) if (sp->heading_label) free (sp->heading_label); if (sp->body_label) free (sp->body_label); if (sp->demo_label) free (sp->demo_label); +#ifdef PREFS_BUTTON if (sp->prefs_label) free (sp->prefs_label); +#endif /* PREFS_BUTTON */ if (sp->help_label) free (sp->help_label); if (sp->heading_font) XFreeFont (si->dpy, sp->heading_font); @@ -638,11 +702,13 @@ handle_splash_event (saver_info *si, XEvent *event) event->xbutton.y < sp->demo_button_y + sp->button_height) which = 1; +#ifdef PREFS_BUTTON else if (event->xbutton.x >= sp->prefs_button_x && event->xbutton.x < sp->prefs_button_x + sp->button_width && event->xbutton.y >= sp->prefs_button_y && event->xbutton.y < sp->prefs_button_y + sp->button_height) which = 2; +#endif /* PREFS_BUTTON */ else if (event->xbutton.x >= sp->help_button_x && event->xbutton.x < sp->help_button_x + sp->button_width && @@ -665,11 +731,19 @@ handle_splash_event (saver_info *si, XEvent *event) switch (which) { case 1: do_demo (si); break; +#ifdef PREFS_BUTTON case 2: do_prefs (si); break; +#endif /* PREFS_BUTTON */ case 3: do_help (si); break; default: abort(); } } + else if (which == 0 && sp->pressed == 0) + { + /* click and release on the window but not in a button: + treat that as "dismiss the splash dialog." */ + destroy_splash_window (si); + } sp->pressed = 0; update_splash_window (si); } @@ -751,12 +825,14 @@ do_demo (saver_info *si) fork_and_exec (si, p->demo_command, "demo-mode"); } +#ifdef PREFS_BUTTON static void do_prefs (saver_info *si) { saver_preferences *p = &si->prefs; fork_and_exec (si, p->prefs_command, "preferences"); } +#endif /* PREFS_BUTTON */ static void do_help (saver_info *si) diff --git a/driver/subprocs.c b/driver/subprocs.c index e34f8968..e97fc928 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -305,7 +305,7 @@ exec_vms_command (const char *command) static void -exec_screenhack (saver_info *si, const char *command) +exec_screenhack (saver_screen_info *ssi, const char *command) { /* I don't believe what a sorry excuse for an operating system UNIX is! @@ -341,6 +341,7 @@ exec_screenhack (saver_info *si, const char *command) what I've seen in Emacs, dealing with process groups isn't especially portable.) */ + saver_info *si = ssi->global; saver_preferences *p = &si->prefs; #ifndef VMS @@ -359,8 +360,9 @@ exec_screenhack (saver_info *si, const char *command) } if (p->verbose_p) - fprintf (stderr, "%s: spawning \"%s\" in pid %lu%s.\n", - blurb(), command, (unsigned long) getpid (), + fprintf (stderr, "%s: %d: spawning \"%s\" in pid %lu%s.\n", + blurb(), ssi->number, command, + (unsigned long) getpid (), (hairy_p ? " (via shell)" : "")); if (hairy_p) @@ -373,8 +375,8 @@ exec_screenhack (saver_info *si, const char *command) #else /* VMS */ if (p->verbose_p) - fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n", - blurb(), command, getpid()); + fprintf (stderr, "%s: %d: spawning \"%s\" in pid %lu.\n", + blurb(), ssi->number, command, getpid()); exec_vms_command (command); #endif /* VMS */ @@ -399,6 +401,7 @@ enum job_status { struct screenhack_job { char *name; pid_t pid; + int screen; enum job_status status; struct screenhack_job *next; }; @@ -412,8 +415,9 @@ show_job_list (void) struct screenhack_job *job; fprintf(stderr, "%s: job list:\n", blurb()); for (job = jobs; job; job = job->next) - fprintf (stderr, " %5ld: (%s) %s\n", + fprintf (stderr, " %5ld: %2d: (%s) %s\n", (long) job->pid, + job->screen, (job->status == job_running ? "running" : job->status == job_stopped ? "stopped" : job->status == job_killed ? " killed" : @@ -426,7 +430,7 @@ show_job_list (void) static void clean_job_list (void); static struct screenhack_job * -make_job (pid_t pid, const char *cmd) +make_job (pid_t pid, int screen, const char *cmd) { struct screenhack_job *job = (struct screenhack_job *) malloc (sizeof(*job)); @@ -458,6 +462,7 @@ make_job (pid_t pid, const char *cmd) job->name = strdup(name); job->pid = pid; + job->screen = screen; job->status = job_running; job->next = jobs; jobs = job; @@ -596,31 +601,27 @@ kill_job (saver_info *si, pid_t pid, int signal) default: abort(); } -#ifdef SIGSTOP if (p->verbose_p) - fprintf (stderr, "%s: %s pid %lu.\n", blurb(), - (signal == SIGTERM ? "killing" : - signal == SIGSTOP ? "suspending" : - signal == SIGCONT ? "resuming" : "signalling"), - (unsigned long) job->pid); -#else /* !SIGSTOP */ - if (p->verbose_p) - fprintf (stderr, "%s: %s pid %lu.\n", blurb(), "killing", - (unsigned long) job->pid); -#endif /* !SIGSTOP */ + fprintf (stderr, "%s: %d: %s pid %lu (%s)\n", + blurb(), job->screen, + (job->status == job_killed ? "killing" : + job->status == job_stopped ? "suspending" : "resuming"), + (unsigned long) job->pid, + job->name); status = kill (job->pid, signal); if (p->verbose_p && status < 0) { if (errno == ESRCH) - fprintf (stderr, "%s: child process %lu (%s) was already dead.\n", - blurb(), job->pid, job->name); + fprintf (stderr, + "%s: %d: child process %lu (%s) was already dead.\n", + blurb(), job->screen, job->pid, job->name); else { char buf [1024]; - sprintf (buf, "%s: couldn't kill child process %lu (%s)", - blurb(), job->pid, job->name); + sprintf (buf, "%s: %d: couldn't kill child process %lu (%s)", + blurb(), job->screen, job->pid, job->name); perror (buf); } } @@ -702,6 +703,7 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status) saver_preferences *p = &si->prefs; struct screenhack_job *job = find_job (kid); const char *name = job ? job->name : ""; + int screen_no = job ? job->screen : 0; if (WIFEXITED (wait_status)) { @@ -720,11 +722,11 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status) (exit_status != 0 && (p->verbose_p || job->status != job_killed))) fprintf (stderr, - "%s: child pid %lu (%s) exited abnormally (code %d).\n", - blurb(), (unsigned long) kid, name, exit_status); + "%s: %d: child pid %lu (%s) exited abnormally (code %d).\n", + blurb(), screen_no, (unsigned long) kid, name, exit_status); else if (p->verbose_p) - fprintf (stderr, "%s: child pid %lu (%s) exited normally.\n", - blurb(), (unsigned long) kid, name); + fprintf (stderr, "%s: %d: child pid %lu (%s) exited normally.\n", + blurb(), screen_no, (unsigned long) kid, name); if (job) job->status = job_dead; @@ -735,8 +737,8 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status) !job || job->status != job_killed || WTERMSIG (wait_status) != SIGTERM) - fprintf (stderr, "%s: child pid %lu (%s) terminated with %s.\n", - blurb(), (unsigned long) kid, name, + fprintf (stderr, "%s: %d: child pid %lu (%s) terminated with %s.\n", + blurb(), screen_no, (unsigned long) kid, name, signal_name (WTERMSIG(wait_status))); if (job) @@ -861,26 +863,43 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p) AGAIN: - if (p->screenhacks_count == 1) - /* If there is only one hack in the list, there is no choice. */ - new_hack = 0; - + if (p->screenhacks_count < 1) + { + /* No hacks at all */ + new_hack = -1; + } else if (si->selection_mode == -1) - /* Select the next hack, wrapping. */ - new_hack = (ssi->current_hack + 1) % p->screenhacks_count; - + { + /* Select the next hack, wrapping. */ + new_hack = (ssi->current_hack + 1) % p->screenhacks_count; + } else if (si->selection_mode == -2) - /* Select the previous hack, wrapping. */ - new_hack = ((ssi->current_hack + p->screenhacks_count - 1) - % p->screenhacks_count); - + { + /* Select the previous hack, wrapping. */ + if (ssi->current_hack < 0) + new_hack = p->screenhacks_count - 1; + else + new_hack = ((ssi->current_hack + p->screenhacks_count - 1) + % p->screenhacks_count); + } else if (si->selection_mode > 0) - /* Select a specific hack, by number. No negotiation. */ { + /* Select a specific hack, by number (via the ACTIVATE command.) */ new_hack = ((si->selection_mode - 1) % p->screenhacks_count); force = True; } - else + else if (p->mode == ONE_HACK && + p->selected_hack >= 0) + { + /* Select a specific hack, by number (via "One Saver" mode.) */ + new_hack = p->selected_hack; + force = True; + } + else if (p->mode == BLANK_ONLY || p->mode == DONT_BLANK) + { + new_hack = -1; + } + else /* (p->mode == RANDOM_HACKS) */ { /* Select a random hack (but not the one we just ran.) */ while ((new_hack = random () % p->screenhacks_count) @@ -888,6 +907,14 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p) ; } + if (new_hack < 0) /* don't run a hack */ + { + ssi->current_hack = -1; + if (si->selection_mode < 0) + si->selection_mode = 0; + return; + } + ssi->current_hack = new_hack; hack = p->screenhacks[ssi->current_hack]; @@ -939,13 +966,13 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p) nice_subproc (p->nice_inferior); /* change process priority */ limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); hack_subproc_environment (ssi); /* set $DISPLAY */ - exec_screenhack (si, hack->command); /* this does not return */ + exec_screenhack (ssi, hack->command); /* this does not return */ abort(); break; default: ssi->pid = forked; - (void) make_job (forked, hack->command); + (void) make_job (forked, ssi->number, hack->command); break; } } @@ -1078,13 +1105,8 @@ hack_subproc_environment (saver_screen_info *ssi) saver_info *si = ssi->global; const char *odpy = DisplayString (si->dpy); char *ndpy = (char *) malloc(strlen(odpy) + 20); - int screen_number; char *s; - for (screen_number = 0; screen_number < si->nscreens; screen_number++) - if (ssi == &si->screens[screen_number]) - break; - strcpy (ndpy, "DISPLAY="); s = ndpy + strlen(ndpy); strcpy (s, odpy); @@ -1094,7 +1116,7 @@ hack_subproc_environment (saver_screen_info *ssi) while (isdigit(*s)) s++; /* skip over dpy number */ while (*s == '.') s++; /* skip over dot */ if (s[-1] != '.') *s++ = '.'; /* put on a dot */ - sprintf(s, "%d", screen_number); /* put on screen number */ + sprintf(s, "%d", ssi->number); /* put on screen number */ /* Allegedly, BSD 4.3 didn't have putenv(), but nobody runs such systems any more, right? It's not Posix, but everyone seems to have it. */ @@ -1197,9 +1219,10 @@ get_best_gl_visual (saver_screen_info *ssi) { Visual *v = id_to_visual (ssi->screen, result); if (si->prefs.verbose_p) - fprintf (stderr, "%s: %s says the GL visual is 0x%X%s.\n", - blurb(), av[0], result, - (v == ssi->default_visual ? " (the default)" : "")); + fprintf (stderr, "%s: %d: %s: GL visual is 0x%X%s.\n", + blurb(), ssi->number, + av[0], result, + (v == ssi->default_visual ? " (default)" : "")); return v; } } diff --git a/driver/test-fade.c b/driver/test-fade.c index b8e4475f..f43b87ca 100644 --- a/driver/test-fade.c +++ b/driver/test-fade.c @@ -97,6 +97,9 @@ main (int argc, char **argv) # endif /* !HAVE_XF86VMODE_GAMMA */ } + fprintf (stderr, "%s: fading %d screen%s\n", + progname, ScreenCount(dpy), ScreenCount(dpy) == 1 ? "" : "s"); + while (1) { XSync (dpy, False); diff --git a/driver/test-passwd.c b/driver/test-passwd.c index eaa884ff..988b0012 100644 --- a/driver/test-passwd.c +++ b/driver/test-passwd.c @@ -14,12 +14,6 @@ itself. */ -#define WHICH_PASS 100 -#define WHICH_SPLASH 101 -#define WHICH_TTY 102 - -#define WHICH WHICH_PASS - #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -61,7 +55,8 @@ const char *signal_name(int signal) { return "???"; } void restore_real_vroot (saver_info *si) {} void store_saver_status (saver_info *si) {} void saver_exit (saver_info *si, int status, const char *core) { exit(status);} -int move_mouse_grab (saver_info *si, Window to, Cursor cursor) { return 0; } +int move_mouse_grab (saver_info *si, Window to, Cursor c, int ts) { return 0; } +int mouse_screen (saver_info *si) { return 0; } const char *blurb(void) { return progname; } Atom XA_SCREENSAVER, XA_DEMO, XA_PREFS; @@ -70,6 +65,7 @@ void get_screen_viewport (saver_screen_info *ssi, int *x_ret, int *y_ret, int *w_ret, int *h_ret, + int tx, int ty, Bool verbose_p) { *x_ret = 0; @@ -99,6 +95,7 @@ static char *fallback[] = { int main (int argc, char **argv) { + enum { PASS, SPLASH, TTY } which; Widget toplevel_shell = 0; saver_screen_info ssip; saver_info sip; @@ -124,6 +121,17 @@ main (int argc, char **argv) if (*s) strcpy (progname, s+1); } + if (argc != 2) goto USAGE; + else if (!strcmp (argv[1], "pass")) which = PASS; + else if (!strcmp (argv[1], "splash")) which = SPLASH; + else if (!strcmp (argv[1], "tty")) which = TTY; + else + { + USAGE: + fprintf (stderr, "usage: %s [ pass | splash | tty ]\n", progname); + exit (1); + } + /* before hack_uid() for proper permissions */ lock_priv_init (argc, argv, True); @@ -137,79 +145,81 @@ main (int argc, char **argv) progclass = "XScreenSaver"; -#if (WHICH != WHICH_TTY) - toplevel_shell = XtAppInitialize (&si->app, progclass, 0, 0, - &argc, argv, fallback, - 0, 0); - - si->dpy = XtDisplay (toplevel_shell); - p->db = XtDatabase (si->dpy); - si->default_screen->toplevel_shell = toplevel_shell; - si->default_screen->screen = XtScreen(toplevel_shell); - si->default_screen->default_visual = - si->default_screen->current_visual = - DefaultVisualOfScreen(si->default_screen->screen); - si->default_screen->screensaver_window = - RootWindowOfScreen(si->default_screen->screen); - si->default_screen->current_depth = - visual_depth(si->default_screen->screen, - si->default_screen->current_visual); - - db = p->db; - XtGetApplicationNameAndClass (si->dpy, &progname, &progclass); - - load_init_file (&si->prefs); + if (which != TTY) + { + toplevel_shell = XtAppInitialize (&si->app, progclass, 0, 0, + &argc, argv, fallback, + 0, 0); + + si->dpy = XtDisplay (toplevel_shell); + p->db = XtDatabase (si->dpy); + si->default_screen->toplevel_shell = toplevel_shell; + si->default_screen->screen = XtScreen(toplevel_shell); + si->default_screen->default_visual = + si->default_screen->current_visual = + DefaultVisualOfScreen(si->default_screen->screen); + si->default_screen->screensaver_window = + RootWindowOfScreen(si->default_screen->screen); + si->default_screen->current_depth = + visual_depth(si->default_screen->screen, + si->default_screen->current_visual); + + db = p->db; + XtGetApplicationNameAndClass (si->dpy, &progname, &progclass); + + load_init_file (&si->prefs); -#endif /* (WHICH != 2) */ + } p->verbose_p = True; while (1) { -#if WHICH == WHICH_PASS - if (unlock_p (si)) - fprintf (stderr, "%s: password correct\n", progname); + if (which == PASS) + { + if (unlock_p (si)) + fprintf (stderr, "%s: password correct\n", progname); + else + fprintf (stderr, "%s: password INCORRECT!\n", progname); + + XSync(si->dpy, False); + sleep (3); + } + else if (which == SPLASH) + { + XEvent event; + make_splash_dialog (si); + XtAppAddTimeOut (si->app, p->splash_duration + 1000, + idle_timer, (XtPointer) si); + while (si->splash_dialog) + { + XtAppNextEvent (si->app, &event); + if (event.xany.window == si->splash_dialog) + handle_splash_event (si, &event); + XtDispatchEvent (&event); + } + XSync (si->dpy, False); + sleep (1); + } + else if (which == TTY) + { + char *pass; + char buf[255]; + struct passwd *p = getpwuid (getuid ()); + printf ("\n%s: %s's password: ", progname, p->pw_name); + + pass = fgets (buf, sizeof(buf)-1, stdin); + if (!pass || !*pass) + exit (0); + if (pass[strlen(pass)-1] == '\n') + pass[strlen(pass)-1] = 0; + + if (passwd_valid_p (pass, True)) + printf ("%s: Ok!\n", progname); + else + printf ("%s: Wrong!\n", progname); + } else - fprintf (stderr, "%s: password INCORRECT!\n", progname); - - XSync(si->dpy, False); - sleep (3); -#elif WHICH == WHICH_SPLASH - { - XEvent event; - make_splash_dialog (si); - XtAppAddTimeOut (si->app, p->splash_duration + 1000, - idle_timer, (XtPointer) si); - while (si->splash_dialog) - { - XtAppNextEvent (si->app, &event); - if (event.xany.window == si->splash_dialog) - handle_splash_event (si, &event); - XtDispatchEvent (&event); - } - XSync (si->dpy, False); - sleep (1); - } -#elif WHICH == WHICH_TTY - { - char *pass; - char buf[255]; - struct passwd *p = getpwuid (getuid ()); - printf ("\n%s: %s's password: ", progname, p->pw_name); - - pass = fgets (buf, sizeof(buf)-1, stdin); - if (!pass || !*pass) - exit (0); - if (pass[strlen(pass)-1] == '\n') - pass[strlen(pass)-1] = 0; - - if (passwd_valid_p (pass, True)) - printf ("%s: Ok!\n", progname); - else - printf ("%s: Wrong!\n", progname); - } -#else -# error bogus WHICH value! -#endif + abort(); } } diff --git a/driver/timers.c b/driver/timers.c index 1e66c770..7c2c363a 100644 --- a/driver/timers.c +++ b/driver/timers.c @@ -99,6 +99,7 @@ notice_events (saver_info *si, Window window, Bool top_p) unsigned long events; Window root, parent, *kids; unsigned int nkids; + int screen_no; if (XtWindowToWidget (si->dpy, window)) /* If it's one of ours, don't mess up its event mask. */ @@ -109,6 +110,11 @@ notice_events (saver_info *si, Window window, Bool top_p) if (window == root) top_p = False; + /* Figure out which screen this window is on, for the diagnostics. */ + for (screen_no = 0; screen_no < si->nscreens; screen_no++) + if (root == RootWindowOfScreen (si->screens[screen_no].screen)) + break; + XGetWindowAttributes (si->dpy, window, &attrs); events = ((attrs.all_event_masks | attrs.do_not_propagate_mask) & KeyPressMask); @@ -131,8 +137,8 @@ notice_events (saver_info *si, Window window, Bool top_p) if (top_p && p->verbose_p && (events & KeyPressMask)) { /* Only mention one window per tree (hack hack). */ - fprintf (stderr, "%s: selected KeyPress on 0x%lX\n", blurb(), - (unsigned long) window); + fprintf (stderr, "%s: %d: selected KeyPress on 0x%lX\n", + blurb(), screen_no, (unsigned long) window); top_p = False; } @@ -336,8 +342,14 @@ check_pointer_timer (XtPointer closure, XtIntervalId *id) int root_x, root_y, x, y; unsigned int mask; - XQueryPointer (si->dpy, ssi->screensaver_window, &root, &child, - &root_x, &root_y, &x, &y, &mask); + if (!XQueryPointer (si->dpy, ssi->screensaver_window, &root, &child, + &root_x, &root_y, &x, &y, &mask)) + { + /* If XQueryPointer() returns false, the mouse is not on this screen. + */ + root_x = -1; + root_y = -1; + } if (root_x == ssi->poll_mouse_last_root_x && root_y == ssi->poll_mouse_last_root_y && @@ -349,23 +361,37 @@ check_pointer_timer (XtPointer closure, XtIntervalId *id) #ifdef DEBUG_TIMERS if (p->verbose_p) - if (root_x == ssi->poll_mouse_last_root_x && - root_y == ssi->poll_mouse_last_root_y && - child == ssi->poll_mouse_last_child) - fprintf (stderr, "%s: modifiers changed at %s on screen %d.\n", - blurb(), timestring(), i); - else - fprintf (stderr, "%s: pointer moved at %s on screen %d.\n", - blurb(), timestring(), i); - -# if 0 - fprintf (stderr, "%s: old: %d %d 0x%x ; new: %d %d 0x%x\n", - blurb(), - ssi->poll_mouse_last_root_x, - ssi->poll_mouse_last_root_y, - (unsigned int) ssi->poll_mouse_last_child, - root_x, root_y, (unsigned int) child); -# endif /* 0 */ + { + if (root_x == ssi->poll_mouse_last_root_x && + root_y == ssi->poll_mouse_last_root_y && + child == ssi->poll_mouse_last_child) + fprintf (stderr, "%s: %d: modifiers changed: 0x%04x -> 0x%04x.\n", + blurb(), i, ssi->poll_mouse_last_mask, mask); + else + { + fprintf (stderr, "%s: %d: pointer moved: ", blurb(), i); + if (ssi->poll_mouse_last_root_x == -1) + fprintf (stderr, "off screen"); + else + fprintf (stderr, "%d,%d", + ssi->poll_mouse_last_root_x, + ssi->poll_mouse_last_root_y); + fprintf (stderr, " -> "); + if (root_x == -1) + fprintf (stderr, "off screen."); + else + fprintf (stderr, "%d,%d", root_x, root_y); + if (ssi->poll_mouse_last_root_x == -1 || root_x == -1) + fprintf (stderr, ".\n"); + else +# undef ABS +# define ABS(x)((x)<0?-(x):(x)) + fprintf (stderr, " (%d,%d).\n", + ABS(ssi->poll_mouse_last_root_x - root_x), + ABS(ssi->poll_mouse_last_root_y - root_y)); +# undef ABS + } + } #endif /* DEBUG_TIMERS */ @@ -424,8 +450,13 @@ check_for_clock_skew (saver_info *si) #ifdef DEBUG_TIMERS if (p->verbose_p) - fprintf (stderr, "%s: checking wall clock (%d).\n", blurb(), - (si->last_wall_clock_time == 0 ? 0 : shift)); + { + int i = (si->last_wall_clock_time == 0 ? 0 : shift); + fprintf (stderr, + "%s: checking wall clock for hibernation (%d:%02d:%02d).\n", + blurb(), + (i / (60 * 60)), ((i / 60) % 60), (i % 60)); + } #endif /* DEBUG_TIMERS */ if (si->last_wall_clock_time != 0 && @@ -692,14 +723,46 @@ sleep_until_idle (saver_info *si, Bool until_idle_p) #ifdef DEBUG_TIMERS if (p->verbose_p) { + Window root, window; + int x, y; + const char *type = 0; if (event.xany.type == MotionNotify) - fprintf (stderr,"%s: MotionNotify at %s\n",blurb(),timestring()); + { + type = "MotionNotify"; + root = event.xmotion.root; + window = event.xmotion.window; + x = event.xmotion.x_root; + y = event.xmotion.y_root; + } else if (event.xany.type == KeyPress) - fprintf (stderr, "%s: KeyPress seen on 0x%X at %s\n", blurb(), - (unsigned int) event.xkey.window, timestring ()); + { + type = "KeyPress"; + root = event.xkey.root; + window = event.xkey.window; + x = y = -1; + } else if (event.xany.type == ButtonPress) - fprintf (stderr, "%s: ButtonPress seen on 0x%X at %s\n", blurb(), - (unsigned int) event.xbutton.window, timestring ()); + { + type = "ButtonPress"; + root = event.xkey.root; + window = event.xkey.window; + x = event.xmotion.x_root; + y = event.xmotion.y_root; + } + + if (type) + { + int i; + for (i = 0; i < si->nscreens; i++) + if (root == RootWindowOfScreen (si->screens[i].screen)) + break; + fprintf (stderr,"%s: %d: %s on 0x%x", + blurb(), i, type, (unsigned long) window); + if (x == -1) + fprintf (stderr, "\n"); + else + fprintf (stderr, " at %d,%d.\n", x, y); + } } #endif /* DEBUG_TIMERS */ @@ -1088,7 +1151,9 @@ watchdog_timer (XtPointer closure, XtIntervalId *id) /* If the DPMS settings on the server have changed, change them back to what ~/.xscreensaver says they should be. */ - sync_server_dpms_settings (si->dpy, p->dpms_enabled_p, + sync_server_dpms_settings (si->dpy, + (p->dpms_enabled_p && + p->mode != DONT_BLANK), p->dpms_standby / 1000, p->dpms_suspend / 1000, p->dpms_off / 1000, diff --git a/driver/windows.c b/driver/windows.c index b0198e14..8598e7e0 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -45,6 +45,10 @@ # include #endif /* HAVE_XF86VMODE */ +#ifdef HAVE_XINERAMA +# include +#endif /* HAVE_XINERAMA */ + /* This file doesn't need the Xt headers, so stub these types out... */ #undef XtPointer @@ -69,7 +73,7 @@ Atom XA_SCREENSAVER_STATUS; extern saver_info *global_si_kludge; /* I hate C so much... */ static void maybe_transfer_grabs (saver_screen_info *ssi, - Window old_w, Window new_w); + Window old_w, Window new_w, int new_screen); #define ALL_POINTER_EVENTS \ (ButtonPressMask | ButtonReleaseMask | EnterWindowMask | \ @@ -98,7 +102,7 @@ grab_string(int status) } static int -grab_kbd(saver_info *si, Window w) +grab_kbd(saver_info *si, Window w, int screen_no) { saver_preferences *p = &si->prefs; int status = XGrabKeyboard (si->dpy, w, True, @@ -107,28 +111,34 @@ grab_kbd(saver_info *si, Window w) GrabModeSync, GrabModeAsync, CurrentTime); if (status == GrabSuccess) - si->keyboard_grab_window = w; + { + si->keyboard_grab_window = w; + si->keyboard_grab_screen = screen_no; + } if (p->verbose_p) - fprintf(stderr, "%s: grabbing keyboard on 0x%x... %s.\n", - blurb(), (unsigned long) w, grab_string(status)); + fprintf(stderr, "%s: %d: grabbing keyboard on 0x%x... %s.\n", + blurb(), screen_no, (unsigned long) w, grab_string(status)); return status; } static int -grab_mouse (saver_info *si, Window w, Cursor cursor) +grab_mouse (saver_info *si, Window w, Cursor cursor, int screen_no) { saver_preferences *p = &si->prefs; int status = XGrabPointer (si->dpy, w, True, ALL_POINTER_EVENTS, GrabModeAsync, GrabModeAsync, w, cursor, CurrentTime); if (status == GrabSuccess) - si->mouse_grab_window = w; + { + si->mouse_grab_window = w; + si->mouse_grab_screen = screen_no; + } if (p->verbose_p) - fprintf(stderr, "%s: grabbing mouse on 0x%x... %s.\n", - blurb(), (unsigned long) w, grab_string(status)); + fprintf(stderr, "%s: %d: grabbing mouse on 0x%x... %s.\n", + blurb(), screen_no, (unsigned long) w, grab_string(status)); return status; } @@ -139,8 +149,9 @@ ungrab_kbd(saver_info *si) saver_preferences *p = &si->prefs; XUngrabKeyboard(si->dpy, CurrentTime); if (p->verbose_p) - fprintf(stderr, "%s: ungrabbing keyboard (was 0x%x).\n", blurb(), - (unsigned long) si->keyboard_grab_window); + fprintf(stderr, "%s: %d: ungrabbing keyboard (was 0x%x).\n", + blurb(), si->keyboard_grab_screen, + (unsigned long) si->keyboard_grab_window); si->keyboard_grab_window = 0; } @@ -151,14 +162,16 @@ ungrab_mouse(saver_info *si) saver_preferences *p = &si->prefs; XUngrabPointer(si->dpy, CurrentTime); if (p->verbose_p) - fprintf(stderr, "%s: ungrabbing mouse (was 0x%x).\n", blurb(), - (unsigned long) si->mouse_grab_window); + fprintf(stderr, "%s: %d: ungrabbing mouse (was 0x%x).\n", + blurb(), si->mouse_grab_screen, + (unsigned long) si->mouse_grab_window); si->mouse_grab_window = 0; } static Bool -grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor) +grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor, + int screen_no) { Status mstatus, kstatus; int i; @@ -167,7 +180,7 @@ grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor) for (i = 0; i < retries; i++) { XSync (si->dpy, False); - kstatus = grab_kbd (si, window); + kstatus = grab_kbd (si, window, screen_no); if (kstatus == GrabSuccess) break; @@ -182,7 +195,7 @@ grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor) for (i = 0; i < retries; i++) { XSync (si->dpy, False); - mstatus = grab_mouse (si, window, cursor); + mstatus = grab_mouse (si, window, cursor, screen_no); if (mstatus == GrabSuccess) break; @@ -207,12 +220,12 @@ ungrab_keyboard_and_mouse (saver_info *si) int -move_mouse_grab (saver_info *si, Window to, Cursor cursor) +move_mouse_grab (saver_info *si, Window to, Cursor cursor, int to_screen_no) { Window old = si->mouse_grab_window; if (old == 0) - return grab_mouse (si, to, cursor); + return grab_mouse (si, to, cursor, to_screen_no); else { saver_preferences *p = &si->prefs; @@ -226,18 +239,18 @@ move_mouse_grab (saver_info *si, Window to, Cursor cursor) fprintf(stderr, "%s: grabbing server...\n", blurb()); ungrab_mouse (si); - status = grab_mouse (si, to, cursor); + status = grab_mouse (si, to, cursor, to_screen_no); if (status != GrabSuccess) /* Augh! */ { sleep (1); /* Note dramatic evil of sleeping with server grabbed. */ XSync (si->dpy, False); - status = grab_mouse (si, to, cursor); + status = grab_mouse (si, to, cursor, to_screen_no); } if (status != GrabSuccess) /* Augh! Try to get the old one back... */ - grab_mouse (si, to, cursor); + grab_mouse (si, old, cursor, to_screen_no); XUngrabServer (si->dpy); XSync (si->dpy, False); /* ###### (danger over) */ @@ -836,6 +849,7 @@ void get_screen_viewport (saver_screen_info *ssi, int *x_ret, int *y_ret, int *w_ret, int *h_ret, + int target_x, int target_y, Bool verbose_p) { int w = WidthOfScreen (ssi->screen); @@ -843,20 +857,68 @@ get_screen_viewport (saver_screen_info *ssi, #ifdef HAVE_XF86VMODE saver_info *si = ssi->global; - int screen_no = screen_number (ssi->screen); - int op, event, error; + int event, error; int dot; XF86VidModeModeLine ml; int x, y; + Bool xinerama_p; + Bool placement_only_p = (target_x != -1 && target_y != -1); + +#ifdef HAVE_XINERAMA + xinerama_p = (XineramaQueryExtension (si->dpy, &event, &error) && + XineramaIsActive (si->dpy)); +#else /* !HAVE_XINERAMA */ + /* Even if we don't have the client-side Xinerama lib, check to see if + the server supports Xinerama, so that we know to ignore the VidMode + extension -- otherwise a server crash could result. Yay. */ + xinerama_p = XQueryExtension (si->dpy, "XINERAMA", &error, &event, &error); + +#endif /* !HAVE_XINERAMA */ - /* Check for Xinerama first, because the VidModeExtension is broken - when Xinerama is present. Wheee! - */ +#ifdef HAVE_XINERAMA + if (xinerama_p && placement_only_p) + { + int nscreens = 0; + XineramaScreenInfo *xsi = XineramaQueryScreens (si->dpy, &nscreens); + if (xsi) + { + /* Find the screen that contains the mouse. */ + int which = -1; + int i; + for (i = 0; i < nscreens; i++) + { + if (target_x >= xsi[i].x_org && + target_y >= xsi[i].y_org && + target_x < xsi[i].x_org + xsi[i].width && + target_y < xsi[i].y_org + xsi[i].height) + which = i; + if (verbose_p) + { + fprintf (stderr, "%s: %d: xinerama vp: %dx%d+%d+%d", + blurb(), i, + xsi[which].width, xsi[which].height, + xsi[i].x_org, xsi[i].y_org); + if (which == i) + fprintf (stderr, "; mouse at %d,%d", + target_x, target_y); + fprintf (stderr, ".\n"); + } + } + if (which == -1) which = 0; /* didn't find it? Use the first. */ + *x_ret = xsi[which].x_org; + *y_ret = xsi[which].y_org; + *w_ret = xsi[which].width; + *h_ret = xsi[which].height; + XFree (xsi); + return; + } + } +#endif /* HAVE_XINERAMA */ - if (!XQueryExtension (si->dpy, "XINERAMA", &op, &event, &error) && + if (!xinerama_p && /* Xinerama + VidMode = broken. */ XF86VidModeQueryExtension (si->dpy, &event, &error) && - XF86VidModeGetModeLine (si->dpy, screen_no, &dot, &ml) && - XF86VidModeGetViewPort (si->dpy, screen_no, &x, &y)) + XF86VidModeGetModeLine (si->dpy, ssi->number, &dot, &ml) && + XF86VidModeGetViewPort (si->dpy, ssi->number, &x, &y)) { char msg[512]; *x_ret = x; @@ -895,10 +957,10 @@ get_screen_viewport (saver_screen_info *ssi, *h_ret = h; return; } - - sprintf (msg, "%s: vp is %dx%d+%d+%d", - blurb(), *w_ret, *h_ret, *x_ret, *y_ret); + sprintf (msg, "%s: %d: vp is %dx%d+%d+%d", + blurb(), ssi->number, + *w_ret, *h_ret, *x_ret, *y_ret); /* Apparently, though the server stores the X position in increments of @@ -1054,7 +1116,7 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) static Bool printed_visual_info = False; /* only print the message once. */ Window horked_window = 0; - get_screen_viewport (ssi, &x, &y, &width, &height, + get_screen_viewport (ssi, &x, &y, &width, &height, -1, -1, (p->verbose_p && !si->screen_blanked_p)); black.red = black.green = black.blue = 0; @@ -1115,7 +1177,7 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) ; else if (ssi->current_visual == DefaultVisualOfScreen (ssi->screen)) { - fprintf (stderr, "%s: using default visual ", blurb()); + fprintf (stderr, "%s: %d: visual ", blurb(), ssi->number); describe_visual (stderr, ssi->screen, ssi->current_visual, install_cmap_p); } @@ -1217,14 +1279,16 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) fprintf (stderr, "%s: someone horked our saver window (0x%lx)! Recreating it...\n", blurb(), (unsigned long) horked_window); - maybe_transfer_grabs (ssi, horked_window, ssi->screensaver_window); + maybe_transfer_grabs (ssi, horked_window, ssi->screensaver_window, + ssi->number); safe_XDestroyWindow (si->dpy, horked_window); horked_window = 0; } if (p->verbose_p) - fprintf (stderr, "%s: saver window is 0x%lx.\n", - blurb(), (unsigned long) ssi->screensaver_window); + fprintf (stderr, "%s: %d: saver window is 0x%lx.\n", + blurb(), ssi->number, + (unsigned long) ssi->screensaver_window); } store_saver_id (ssi); /* store window name and IDs */ @@ -1364,22 +1428,63 @@ raise_window (saver_info *si, } } + +int +mouse_screen (saver_info *si) +{ + saver_preferences *p = &si->prefs; + + if (si->nscreens == 1) + return 0; + else + { + int i; + for (i = 0; i < si->nscreens; i++) + { + saver_screen_info *ssi = &si->screens[i]; + Window pointer_root, pointer_child; + int root_x, root_y, win_x, win_y; + unsigned int mask; + if (XQueryPointer (si->dpy, + RootWindowOfScreen (ssi->screen), + &pointer_root, &pointer_child, + &root_x, &root_y, &win_x, &win_y, &mask)) + { + if (p->verbose_p) + fprintf (stderr, "%s: mouse is on screen %d\n", + blurb(), i, si->nscreens); + return i; + } + } + + /* couldn't figure out where the mouse is? Oh well. */ + return 0; + } +} + + Bool blank_screen (saver_info *si) { int i; Bool ok; + Window w; + int mscreen; /* Note: we do our grabs on the root window, not on the screensaver window. If we grabbed on the saver window, then the demo mode and lock dialog boxes wouldn't get any events. + + By "the root window", we mean "the root window that contains the mouse." + We use to always grab the mouse on screen 0, but that has the effect of + moving the mouse to screen 0 from whichever screen it was on, on + multi-head systems. */ - ok = grab_keyboard_and_mouse (si, - /*si->screens[0].screensaver_window,*/ - RootWindowOfScreen(si->screens[0].screen), - (si->demoing_p - ? 0 - : si->screens[0].cursor)); + mscreen = mouse_screen (si); + w = RootWindowOfScreen(si->screens[mscreen].screen); + ok = grab_keyboard_and_mouse (si, w, + (si->demoing_p ? 0 : si->screens[0].cursor), + mscreen); if (si->using_mit_saver_extension || si->using_sgi_saver_extension) @@ -1552,7 +1657,8 @@ unblank_screen (saver_info *si) */ static void maybe_transfer_grabs (saver_screen_info *ssi, - Window old_w, Window new_w) + Window old_w, Window new_w, + int new_screen_no) { saver_info *si = ssi->global; @@ -1564,9 +1670,8 @@ maybe_transfer_grabs (saver_screen_info *ssi, XGrabServer (si->dpy); /* ############ DANGER! */ ungrab_mouse (si); grab_mouse (si, ssi->screensaver_window, - (si->demoing_p - ? 0 - : ssi->cursor)); + (si->demoing_p ? 0 : ssi->cursor), + new_screen_no); XUngrabServer (si->dpy); XSync (si->dpy, False); /* ###### (danger over) */ } @@ -1578,7 +1683,7 @@ maybe_transfer_grabs (saver_screen_info *ssi, { XGrabServer (si->dpy); /* ############ DANGER! */ ungrab_kbd(si); - grab_kbd(si, ssi->screensaver_window); + grab_kbd(si, ssi->screensaver_window, ssi->number); XUngrabServer (si->dpy); XSync (si->dpy, False); /* ###### (danger over) */ } @@ -1647,10 +1752,10 @@ select_visual (saver_screen_info *ssi, const char *visual_name) if (p->verbose_p) { - fprintf (stderr, "%s: switching to visual ", blurb()); + fprintf (stderr, "%s: %d: visual ", blurb(), ssi->number); describe_visual (stderr, ssi->screen, new_v, install_cmap_p); #if 0 - fprintf (stderr, "%s: from ", blurb()); + fprintf (stderr, "%s: from ", blurb()); describe_visual (stderr, ssi->screen, ssi->current_visual, was_installed_p); #endif @@ -1675,14 +1780,14 @@ select_visual (saver_screen_info *ssi, const char *visual_name) ssi->screensaver_window, ssi->screensaver_window); /* Transfer any grabs from the old window to the new. */ - maybe_transfer_grabs (ssi, old_w, ssi->screensaver_window); + maybe_transfer_grabs (ssi, old_w, ssi->screensaver_window, ssi->number); /* Now we can destroy the old window without horking our grabs. */ XDestroyWindow (si->dpy, old_w); if (p->verbose_p) - fprintf (stderr, "%s: destroyed old saver window 0x%lx.\n", - blurb(), (unsigned long) old_w); + fprintf (stderr, "%s: %d: destroyed old saver window 0x%lx.\n", + blurb(), ssi->number, (unsigned long) old_w); if (old_c && old_c != DefaultColormapOfScreen (ssi->screen) && diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c index 9b86557b..53712ee2 100644 --- a/driver/xscreensaver-command.c +++ b/driver/xscreensaver-command.c @@ -1,4 +1,4 @@ -/* xscreensaver-command, Copyright (c) 1991-2001 +/* xscreensaver-command, Copyright (c) 1991-2002 * by Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its @@ -52,7 +52,7 @@ static char *usage = "\n\ usage: %s -