From: Vlad Date: Tue, 17 Aug 2010 10:28:40 +0000 (+0300) Subject: Initial push X-Git-Url: http://git.maemo.org/git/?p=shermanaquarium;a=commitdiff_plain;h=049ea8f74cbe2e1a7bde1afcbfa82ac7a8f46c0d Initial push --- diff --git a/sherman-aquarium/AUTHORS b/sherman-aquarium/AUTHORS new file mode 100644 index 0000000..0f2cba5 --- /dev/null +++ b/sherman-aquarium/AUTHORS @@ -0,0 +1,55 @@ + +Sherman's aquarium was written by Jonas Aaberg during +2002-2005. + + Code sources: +--------------- + +Timecop + - Many functions are based upon his wmfishmon applet +Mathias Meisfjordskar + - Code for reading led status. +Ben Hines + - Mac osx port and cpu load measurement code for osx. + Makefile fixes. +Brett Nash + - Gnome 2 applet fixes and improvments. Also some + grammer corrections. + + Graphics: +----------- +Jim Toomey - All fish graphics (www.slagoon.com) +Tarzeau - Themormeter and bubbles +Mathias Meisfjordskar - The led "lights" + + Bugfixes: +---------- +Stefan Schatzl + - Compiling problems and more +Wladimir J. van der Laan + - Patch for removing a bad "Floating Point Exception" +Bodnar Istvan + - Compiling problems on FreeBSD, testing of FreeBSD port and + bug reports. And feature sudjections. +Gerald Schuberth + - Patches for avoiding warnings on Redhat systems. +Michael Baron + - Big/little endian fix. + + Translations: +-------------- +Gerald Schuberth + - Some german translation. + + + Suggestions/Ideas/Helps/Nice emails ;-) : +------------------------------------------- +(I will add the names of all people that send a creative mail to me here.) +Jordan Mack - Helped finding a bug. +Matus Telgarsky - For telling me how much + he likes Sherman's aquarium. +Onno Freringa - Feature sudjestion. +Christian Fredrik Kalager Schaller - Feature sudjestion. +Fabio Stumbo - Found fvwm2 problems + and unclear things in README. +Michal Ambroz - Redhat .spec file. diff --git a/sherman-aquarium/BUGS b/sherman-aquarium/BUGS new file mode 100644 index 0000000..636d7d4 --- /dev/null +++ b/sherman-aquarium/BUGS @@ -0,0 +1,4 @@ + + - Sound is not that syncronized with the fish actions. + - Tetris does not always follow size changes. + - Tetris is kinda buggy sometimes. \ No newline at end of file diff --git a/sherman-aquarium/COPYING b/sherman-aquarium/COPYING new file mode 100644 index 0000000..eeb586b --- /dev/null +++ b/sherman-aquarium/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/sherman-aquarium/ChangeLog b/sherman-aquarium/ChangeLog new file mode 100644 index 0000000..0d87976 --- /dev/null +++ b/sherman-aquarium/ChangeLog @@ -0,0 +1,164 @@ + +3.0.1 - 20th February 2005. + - Fixed compile problem with Linux 2.4 reported by yogib + + - Fixed configure problem when you didn't have gai installed, but + has XMMS installed. (Both gtk 1.2 and 2.0 get included.) + Reported by Jozef Riha and others. + - Fixed applet initialization bug noticable sometimes with new gccs. + +3.0.0 - 5th September 2004. + - The current desktop can be used as background in screensaver mode. + - Sherman's aquarium now interacts with xscreensaver-demo nicely. + - Fish are now knowing about high aquariums. + - Bottom creatures shall not come flying. + - You can have comics on the background in screensaver mode. + (some comics included) + - Fixed bug in plasma with heights >300. + - Tetris now seems to work.. + - Matrix scroller bug finally fixed. + - Documentation updates. + - Thermometer now works with both Linux 2.4 and Linux 2.6 + - Many minor tweeks and fixes. + - Lots of bugfixes + - The ChangeLog is incomplete!! (Again!) + +3.0.0pre2 - + - Added patch that solves endian problems for screensaver. + - Sound effects are quiet when in "over" mode. + - Screensaver support added, allthough abit buggy when selecting + from the xscreensaver-demo menu. + - The screensaver got xscreensaver configuration support. + - Fixed Gnome panel sizing bug caused by correcting bugs in gai. + +3.0.0pre1 - + Not complete! + - Rebirth added. + - Thermometer pic is now ok. + - Thermometer can messure a lot of stuff. + - exploded fishes and eaten fished cooperated now.(Thanks to?) + - New size organization. + - Sherman's aquarium is splitted into: + Sherman's aquarium - Applet + Sherman's aquarium - Screensaver + - Command line options are now completly removed. + You have to configure Sherman's aquarium via the preference menu. + It can be started by clicking on it with the right mouse button. + It works no matter if you use gnome or not. + - You can have a background shade between any two colours. + - Great parts are rewritten and the code is modulized. + - Code "prettification" and reorganization. Still alot to do. + - Uses now the "General Applet Interface Library" (GAI) for basic + wmapplet/dockapp and gnome2 applet routines. (Gnome 1.x is no + more supported.) + - Removed some warnings on Redhat systems.(Thanks to Gerald Schuberth!) + - More plants and rocks. + - Megan added. + - Fixed fvwm2 problem. (Thanks to Fabio Stumbo!) + - Fixed SDL problem that made Sherman's living on after quit and + eating alot of processor power. + - Made fish scared by the mouse pointer acting better. + - No outputs in xscreensaver mode. + - Hiding mouse pointer when over applet option added. + - Matrix scroller is partly rewritten. (Bug fixed hopefully) + - Tetris with levels, score and highscore table is added. + - Added code for a plasma. + - Now it is possible to load and save settings without compile + in gnome support. (Thanks to GAI.) + - Unnessecary configure options are removed. + - Added some different bottom colour shades. + - Bottom now possible option as applet. + - The scale of the bottom can be set. + - Fixed bug that made some fish sometimes come behind the moving + "bottom" creatures. + - Added more colours of the leds and maximum of four leds instead of + three. + - Fish can have abit variable size, so two fish from the same + spiece don't have the same size. + - The speed of each fish variables alittle for the normal speed for + that spiece. + - Fixed a rounding up bug that could cause some fish get the images + of the moment animation somewhat wrong for some scales. + - Makefile dependency fixes. + - New feature can display XMMS(www.xmms.org) current song name. + - Added the original sound effects. Sean Maguire + missed them. + + + +2.2.0 - 31st August 2002 + - Makefile & configure fixes. + - Swedish and German translation for the Gnome menu. + (But not yet for the preference window.) + - Fixed preference window and keyleds bug. + - Gnome 2 panel detection. Notice that gnome 2 applets must be started from + the panel. + - XScreenSaver is now supported! Finally! + - Internal changes makes it possible to run more than one instance at + the same time. (Screensaver and applet, for example.) + - Resize blowfish blow up action to correct size. Strangly it was two + time too big. + - The blowfish now explodes and updates correctly in fullscreen. + - The pray gets eaten correctly now. + - You can have a seafloor(-f)in fullscreen mode now. + - Some changes for SunOs. But still no thermometer code. + - New graphics taken from the Swedish version of Sherman's Lagoon. + - Added graphics includes plants and stones for the sea floor. + - Hawthorne and Bob the bottom dweller are added. They appear only in + fullscreen/xscreensaver mode. + - Added new command line option "-m" for activate the matrix scroller + for those that hasn't gnome installed. + - Changed solid blue to solid colour. Now you can choose any colour + you want instead. + +2.1.1 - 20th July 2002 + - Fixed bad bug making just a blue box under many window managers. + - FreeBSD port. (Hopefully it will work. Please mail me if otherwise!) + - Some loading speed ups. + - Adding fullscreen option -K, keep current resolution. + - Option --numfishes is changed to --numfish, since the plural of fish + is fish, not fishes. + - Some Gnome 2 fixes. + +2.1.0 - 8th July 2002 + - Gnome version 2.0.x support + - GTK+ version 2.0.x support + - Bug fixes (preference windows, automagical detection bug, and more.) + - Resizing speed ups. + - configure script instead of messy makefiles. + - Matrix scroller is now a valid option + fixing some matrix bugs. + - Better handeling of missing files when running as gnome applet + - New option. "-r" Reset settings. Default settings, if something + has gone wrong. + - Fullscreen("-l") using SDL. This is most for testing. + In the future it will become a screensaver. + +2.0.1 - 23rd(late) June 2002 + - Mac Os X port and thermometer code + - Fixing a floating point exception bug + - Some Makefile errors fixed. + - Documentation updates and some new sections + +2.0 - 23rd(early) June 2002 + - Name change to "Sherman's aquarium" + - Gnome panel applet version + - Prefrences window + - Remember your settings + - Scaling of fishes + - Size of window can be choosen. + - Choose your own background. + - ALOT of internal changes + - Automagical detection of window manager and gnome panel. + - Swordfish can make the blowfish explode + - Much better animation of all fishes. + - One big fish can eats a special kind of fish + +1.01 - 11th May 2002 + - Minor bug fixes. + - New switches: -x and -y for selecting location on screen. + -u for selecting number of bubbles. + +1.0 - 24th April 2002 (Public 4th May) + - First release. + + diff --git a/sherman-aquarium/GNOME_shermans_appletApplet.server b/sherman-aquarium/GNOME_shermans_appletApplet.server new file mode 100644 index 0000000..f64c080 --- /dev/null +++ b/sherman-aquarium/GNOME_shermans_appletApplet.server @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sherman-aquarium/GNOME_shermans_appletApplet.server.in b/sherman-aquarium/GNOME_shermans_appletApplet.server.in new file mode 100644 index 0000000..eb5de9a --- /dev/null +++ b/sherman-aquarium/GNOME_shermans_appletApplet.server.in @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sherman-aquarium/HACKING b/sherman-aquarium/HACKING new file mode 100644 index 0000000..b9fe9a6 --- /dev/null +++ b/sherman-aquarium/HACKING @@ -0,0 +1,5 @@ +You are very welcome to add functions and change things in my code! +Please mail me any changes! Thanks and happy coding! + + + diff --git a/sherman-aquarium/INSTALL b/sherman-aquarium/INSTALL new file mode 100644 index 0000000..97de0aa --- /dev/null +++ b/sherman-aquarium/INSTALL @@ -0,0 +1,43 @@ + + Installation instructions for Sherman's aquarium +-------------------------------------------------- + +Quick installation: + +./configure +make +make install (become root might be required.) + +See XSCREENSAVER for howto install Sherman's aquarium as screensaver + + Required libraries and programs +--------------------------------- + +The General Applet Interface Library (GAI) is required for applet +support. You can get it at http://gai.sf.net + +SDL is required for Screensaver support. (www.libsdl.org) + +GTK+ v2.2.0 or later is required for everything. + +On some distributions, Like Redhat, the include headers are +sometimes not installed by default. If you believe that the +configure script fails to detect some library that you are +sure that you have installed, please make sure that you have +install the "devel" part of that library too. + + + Supported Operative Systems and limitations +---------------------------------------------- +All features are supported with Linux 2.4 and Linux 2.6. +CPU load only is supported for FreeBSD and Mac OSX/Darwin. + +If you want to have more features for your favorite Unix system +and are prepared to do some testing, please don't hessitate to mail me! + + +Any problems? I hope not. If you hit some, please mail me! +Jonas Aaberg (Please include the word Sherman in the subject) + + + diff --git a/sherman-aquarium/Makefile b/sherman-aquarium/Makefile new file mode 100644 index 0000000..8aadd71 --- /dev/null +++ b/sherman-aquarium/Makefile @@ -0,0 +1,12 @@ + +# Makefile for Sherman's Aquarium + +all: + (cd shermans;make all) +clean: + (cd shermans;make clean) + rm -f config.log config.status + +install: + (cd shermans;make install) +.PHONY: all clean install diff --git a/sherman-aquarium/Makefile.in b/sherman-aquarium/Makefile.in new file mode 100644 index 0000000..8aadd71 --- /dev/null +++ b/sherman-aquarium/Makefile.in @@ -0,0 +1,12 @@ + +# Makefile for Sherman's Aquarium + +all: + (cd shermans;make all) +clean: + (cd shermans;make clean) + rm -f config.log config.status + +install: + (cd shermans;make install) +.PHONY: all clean install diff --git a/sherman-aquarium/NEWS b/sherman-aquarium/NEWS new file mode 100644 index 0000000..1e7f4d5 --- /dev/null +++ b/sherman-aquarium/NEWS @@ -0,0 +1,2 @@ + +See ChangeLog \ No newline at end of file diff --git a/sherman-aquarium/README b/sherman-aquarium/README new file mode 100644 index 0000000..c6e7cc0 --- /dev/null +++ b/sherman-aquarium/README @@ -0,0 +1,67 @@ + + Sherman's aquarium - Applet v3.0.1 +==================================== +(Formly known as Aquarium applet) + +This is a wm(Window maker) applet(dockapp), Gnome 2 Panel Applet and +a XscreenSaver "hack" that gives you an aquarium with some randomly +selected fishes that lives there. Well, to tell you the truth, you +can get some other strange sea animals in your aquarium too. +It can display the status of alot of different things in various ways. + +The fishes are done by Jim Toomey, the author of the "Sherman's Lagoon" +comics. + + +Fish Images: +------------ + +The fish images are taken from a freeware windows screen saver by +Jim Toomey.(www.slagoon.com) He draws a really great cartoon strip +named "Sherman's lagoon". (You can ready a daily strip at his site, +and in many news papers.) +I have to point out that NO reverse engineering nor disassembling +of the code was made in order to extract the fish images. I did +just look at the hex code and wrote a program that read the +interesting parts, and converted them to readable images. +So the fish images are copyrighted by Jim Toomey, and released +in his screensaver as freeware. +I've manage to get in contact with Jim Toomey and he told me +he likes "Sherman's aquarium" and that it's ok that I use that +name for my program. But he didn't give me permission to use +his graphics, but neither did he tell me to remove his graphics, +which I'm very thankfull for. (Jim, THANKS ALOT!!) + + +History: +-------- + +I saw the "Sherman's lagoon" screensaver for Windows about 1997 or so. +From the very start I wanted to have it for Linux too. Quite quick I +made a program that extracted the graphics and the sounds. Then I +tried to make a screensaver, but I got stuck in gtk+/gdk problems +that I couldn't solve at that time. +Then one day, years later, I played with the code Timecop's +wmfishmon code, and years later this is the result. + + +See ChangeLog for a more recent history. + +See the AUTHOR file for credits. + + +If you enjoy this small program, please send me (Jonas Aaberg ) +an email. For every email I get, the chances that I add new features +and/or make other applets get larger. (Please include Sherman's +aquarium in the subject.) + +Patches, constructive critizism, extra features, sudjestions(good ones :-), +better graphics, pizzas,.. are very welcome! :-) + +If you need help with anything, don't hessitate to contact me! + +Sherman's aquarium home is: http://aquariumapplet.sourceforge.net +(Big thanks to the SF team for providing a home for Sherman's aquarium!) + +Have fun, + Jonas Aaberg diff --git a/sherman-aquarium/README.gai b/sherman-aquarium/README.gai new file mode 100644 index 0000000..1d50513 --- /dev/null +++ b/sherman-aquarium/README.gai @@ -0,0 +1,17 @@ + +This is the general readme for all applets that uses GAI. + +These options are recognized by the library: + + --gai-debug-on Stores debug info in /tmp/gai-debug-output. + Notice that it eats some processor power. + --gai-debug-off Turns off debug mode. + --gai-broken-wm Lets all applets run as a normal program. + --gai-working-wm Lets all applets run as + dockapps/wmapplets. + --gai-list-settings List current settings. + --gai-help Shows this text. + +The --gai-debug-on option should only be used by developers that +suspects that there is something wrong with the library itself. + diff --git a/sherman-aquarium/TODO b/sherman-aquarium/TODO new file mode 100644 index 0000000..befc359 --- /dev/null +++ b/sherman-aquarium/TODO @@ -0,0 +1,15 @@ + +TODO: + + - Add more features to leds. Like ping, tempeature, battery warning, cpu load level, sawp load level... + - Be able to invert levels. + - Add more features to thermometer, battery level, cpu speed.. + - Comic download. + - Comic next/prev. + - Comic storage. + - Internationalization. + - Teletext/web text scroller. (Not just XMMS) + - Background could change on differnet events. + - Surface a la wmbubble? + - Tetris backgrounds. + diff --git a/sherman-aquarium/XSCREENSAVER b/sherman-aquarium/XSCREENSAVER new file mode 100644 index 0000000..f42105d --- /dev/null +++ b/sherman-aquarium/XSCREENSAVER @@ -0,0 +1,85 @@ + + How to install Sherman's aquarium as a Xscreensaver hack +========================================================== + +First make sure that you have libSDL 1.2.x (www.libsdl.org), +xscreensaver (www.jwz.org/xscreensaver) and that you have compiled +Sherman's aquarium with Screensaver support. +(Notice that some distributions differes the library and the +headers. So make sure you have installed the "devel" package +of SDL, if you use such a distribution.) + +The rest of the text in this file assumes that you have a +working xscreensaver installation. + +If you have installed the screensaver part of Sherman's aquarium +executing "shermans" will demostrate Sherman's aquarium. +So try: + +shermans + +(Assuming that you have sherman's aquarium in your path) +This will show you sherman's aquarium screensaver in window mode. + +Then go on and edit ~/.xscreensaver (If you don't have such a file, +run xscreensaver-demo, it will generate one for you.) + +Find the line: +-- +programs: +-- + +Insert after that line a new line that says: + +-- +"Sherman's aquarium" shermans -root \n\ +-- + +Save the changes. + +Now you have to see if the Xscreensaver configuration XML file did +end up correctly. Default installation path for GNU programs is +/usr/local/, while program that comes with distributions nearly always +is installed in /usr/ +So if you didn't give --prefix=somethingelse to "configure", the +Xscreensaver XML configuration file for Sherman's aquarium(shermans.xml) +did end up in: + +/usr/local/share/control-center/screensavers + +If "shermans.xml" is the only file there, the Xscreensaver is configured +with another path. Maybe /usr/share/control-center/screensaver +See if you have that directory, and if it contains a lot of .xml files +then move the shermans.xml into that directory. + +If you can't find the directory, search for "ant.xml", which is a +xscreensaver hack that is installed by default. + +Now it's time to configure Sherman's aquarium and the Xscreensaver. +Run xscreensaver-demo. Click on the settings button to configure +the apperence of Sherman's aquarium. If the settings window is +empty, Xscreensaver can't find "shermans.xml" and if you can't +find "Sherman's aquarium" among the Hacks, you might have done +something wrong when you edited your ~/.xscreensaver file. + +I think you have to restart the Xscreensaver daemon when you change +settings, but I might be wrong on that point. + +If you want to use "Current desktop as background", i.e. let the fish +swim over your screen without changing the background, sometimes you +have to click in the "Grab Desktop Images" checkbox in the "Advanced" +menu in xscreensaver-demo (Just besides Display Modes) or else you +might end up with an error message that says something like "Bad Access". + +The comic strips that are included by default in the Sherman's Lagoon +windows screensaver is included in Sherman's aquarium too and +can normally be found in: + +/usr/share/pixmaps/shermans/strips/ + +(When installed with --prefix=/usr) + +Any questions? Mail them to me, Jonas Aaberg +Please include the word "Shermans" in the subject. Or else your +mail might be considered as spam. + diff --git a/sherman-aquarium/aquarium/COPYING.graphics b/sherman-aquarium/aquarium/COPYING.graphics new file mode 100644 index 0000000..d9b1649 --- /dev/null +++ b/sherman-aquarium/aquarium/COPYING.graphics @@ -0,0 +1,28 @@ +The license below applies to the fish images used in shermans-aquarium. + +The license is available from: + http://www.slagoon.com/freeware/scrpc.html + +The fish images are copyright (C) 2005 Jim Toomey. + +******************************************************************************* +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +******************************************************************************* diff --git a/sherman-aquarium/aquarium/bottom/bigplant.png b/sherman-aquarium/aquarium/bottom/bigplant.png new file mode 100644 index 0000000..08faa0d Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/bigplant.png differ diff --git a/sherman-aquarium/aquarium/bottom/bottom1.png b/sherman-aquarium/aquarium/bottom/bottom1.png new file mode 100644 index 0000000..b2c5be5 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/bottom1.png differ diff --git a/sherman-aquarium/aquarium/bottom/bottom2.png b/sherman-aquarium/aquarium/bottom/bottom2.png new file mode 100644 index 0000000..a245073 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/bottom2.png differ diff --git a/sherman-aquarium/aquarium/bottom/bottom3.png b/sherman-aquarium/aquarium/bottom/bottom3.png new file mode 100644 index 0000000..bd1418c Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/bottom3.png differ diff --git a/sherman-aquarium/aquarium/bottom/octo1.png b/sherman-aquarium/aquarium/bottom/octo1.png new file mode 100644 index 0000000..a608653 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/octo1.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant1.png b/sherman-aquarium/aquarium/bottom/plant1.png new file mode 100644 index 0000000..4cc7e32 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant1.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant10.png b/sherman-aquarium/aquarium/bottom/plant10.png new file mode 100644 index 0000000..21a83b4 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant10.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant2.png b/sherman-aquarium/aquarium/bottom/plant2.png new file mode 100644 index 0000000..0d892ca Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant2.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant3.png b/sherman-aquarium/aquarium/bottom/plant3.png new file mode 100644 index 0000000..3634110 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant3.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant4.png b/sherman-aquarium/aquarium/bottom/plant4.png new file mode 100644 index 0000000..6fdd83d Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant4.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant5.png b/sherman-aquarium/aquarium/bottom/plant5.png new file mode 100644 index 0000000..b8d7b4e Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant5.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant6.png b/sherman-aquarium/aquarium/bottom/plant6.png new file mode 100644 index 0000000..d7c074d Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant6.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant7.png b/sherman-aquarium/aquarium/bottom/plant7.png new file mode 100644 index 0000000..b0952e3 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant7.png differ diff --git a/sherman-aquarium/aquarium/bottom/plant9.png b/sherman-aquarium/aquarium/bottom/plant9.png new file mode 100644 index 0000000..08a760c Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/plant9.png differ diff --git a/sherman-aquarium/aquarium/bottom/smallstone1.png b/sherman-aquarium/aquarium/bottom/smallstone1.png new file mode 100644 index 0000000..45d3ab2 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/smallstone1.png differ diff --git a/sherman-aquarium/aquarium/bottom/smallstone3.png b/sherman-aquarium/aquarium/bottom/smallstone3.png new file mode 100644 index 0000000..4ae335d Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/smallstone3.png differ diff --git a/sherman-aquarium/aquarium/bottom/stone1.png b/sherman-aquarium/aquarium/bottom/stone1.png new file mode 100644 index 0000000..17599a2 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/stone1.png differ diff --git a/sherman-aquarium/aquarium/bottom/stone2.png b/sherman-aquarium/aquarium/bottom/stone2.png new file mode 100644 index 0000000..6c71349 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/stone2.png differ diff --git a/sherman-aquarium/aquarium/bottom/stone3.png b/sherman-aquarium/aquarium/bottom/stone3.png new file mode 100644 index 0000000..aa6c3c6 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/stone3.png differ diff --git a/sherman-aquarium/aquarium/bottom/weirdplant.png b/sherman-aquarium/aquarium/bottom/weirdplant.png new file mode 100644 index 0000000..f79e05f Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/weirdplant.png differ diff --git a/sherman-aquarium/aquarium/bottom/weirdplant2.png b/sherman-aquarium/aquarium/bottom/weirdplant2.png new file mode 100644 index 0000000..2093d27 Binary files /dev/null and b/sherman-aquarium/aquarium/bottom/weirdplant2.png differ diff --git a/sherman-aquarium/aquarium/bubbles.png b/sherman-aquarium/aquarium/bubbles.png new file mode 100644 index 0000000..b9cef28 Binary files /dev/null and b/sherman-aquarium/aquarium/bubbles.png differ diff --git a/sherman-aquarium/aquarium/clock/date/figures.png b/sherman-aquarium/aquarium/clock/date/figures.png new file mode 100644 index 0000000..18b9f96 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/date/figures.png differ diff --git a/sherman-aquarium/aquarium/clock/date/months.png b/sherman-aquarium/aquarium/clock/date/months.png new file mode 100644 index 0000000..3b167a2 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/date/months.png differ diff --git a/sherman-aquarium/aquarium/clock/date/weekdays.png b/sherman-aquarium/aquarium/clock/date/weekdays.png new file mode 100644 index 0000000..ad79fb4 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/date/weekdays.png differ diff --git a/sherman-aquarium/aquarium/clock/digital/bigcolon.png b/sherman-aquarium/aquarium/clock/digital/bigcolon.png new file mode 100644 index 0000000..1504cb1 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/digital/bigcolon.png differ diff --git a/sherman-aquarium/aquarium/clock/digital/bigfigures.png b/sherman-aquarium/aquarium/clock/digital/bigfigures.png new file mode 100644 index 0000000..377dd11 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/digital/bigfigures.png differ diff --git a/sherman-aquarium/aquarium/clock/digital/smallcolon.png b/sherman-aquarium/aquarium/clock/digital/smallcolon.png new file mode 100644 index 0000000..1c022dd Binary files /dev/null and b/sherman-aquarium/aquarium/clock/digital/smallcolon.png differ diff --git a/sherman-aquarium/aquarium/clock/digital/smallfigures.png b/sherman-aquarium/aquarium/clock/digital/smallfigures.png new file mode 100644 index 0000000..e951cfd Binary files /dev/null and b/sherman-aquarium/aquarium/clock/digital/smallfigures.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Eight.png b/sherman-aquarium/aquarium/clock/fuzzy/Eight.png new file mode 100644 index 0000000..165e564 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Eight.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Eleven.png b/sherman-aquarium/aquarium/clock/fuzzy/Eleven.png new file mode 100644 index 0000000..1a780b9 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Eleven.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Five.png b/sherman-aquarium/aquarium/clock/fuzzy/Five.png new file mode 100644 index 0000000..6607e09 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Five.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Four.png b/sherman-aquarium/aquarium/clock/fuzzy/Four.png new file mode 100644 index 0000000..c277392 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Four.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Half.png b/sherman-aquarium/aquarium/clock/fuzzy/Half.png new file mode 100644 index 0000000..a615a01 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Half.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Nine.png b/sherman-aquarium/aquarium/clock/fuzzy/Nine.png new file mode 100644 index 0000000..9b76bae Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Nine.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Oclock.png b/sherman-aquarium/aquarium/clock/fuzzy/Oclock.png new file mode 100644 index 0000000..4b9239d Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Oclock.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/One.png b/sherman-aquarium/aquarium/clock/fuzzy/One.png new file mode 100644 index 0000000..eb95994 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/One.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Past.png b/sherman-aquarium/aquarium/clock/fuzzy/Past.png new file mode 100644 index 0000000..04351ae Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Past.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Quarter.png b/sherman-aquarium/aquarium/clock/fuzzy/Quarter.png new file mode 100644 index 0000000..535b34f Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Quarter.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Seven.png b/sherman-aquarium/aquarium/clock/fuzzy/Seven.png new file mode 100644 index 0000000..43bc203 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Seven.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Six.png b/sherman-aquarium/aquarium/clock/fuzzy/Six.png new file mode 100644 index 0000000..2a762b7 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Six.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Ten.png b/sherman-aquarium/aquarium/clock/fuzzy/Ten.png new file mode 100644 index 0000000..f8e42c5 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Ten.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Three.png b/sherman-aquarium/aquarium/clock/fuzzy/Three.png new file mode 100644 index 0000000..64eba9f Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Three.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/To.png b/sherman-aquarium/aquarium/clock/fuzzy/To.png new file mode 100644 index 0000000..fe6f264 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/To.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Twelve.png b/sherman-aquarium/aquarium/clock/fuzzy/Twelve.png new file mode 100644 index 0000000..adfa845 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Twelve.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Twenty.png b/sherman-aquarium/aquarium/clock/fuzzy/Twenty.png new file mode 100644 index 0000000..3650f66 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Twenty.png differ diff --git a/sherman-aquarium/aquarium/clock/fuzzy/Two.png b/sherman-aquarium/aquarium/clock/fuzzy/Two.png new file mode 100644 index 0000000..3076c83 Binary files /dev/null and b/sherman-aquarium/aquarium/clock/fuzzy/Two.png differ diff --git a/sherman-aquarium/aquarium/leds/blue.png b/sherman-aquarium/aquarium/leds/blue.png new file mode 100644 index 0000000..d4912a3 Binary files /dev/null and b/sherman-aquarium/aquarium/leds/blue.png differ diff --git a/sherman-aquarium/aquarium/leds/bluegreen.png b/sherman-aquarium/aquarium/leds/bluegreen.png new file mode 100644 index 0000000..983c98c Binary files /dev/null and b/sherman-aquarium/aquarium/leds/bluegreen.png differ diff --git a/sherman-aquarium/aquarium/leds/darkblue.png b/sherman-aquarium/aquarium/leds/darkblue.png new file mode 100644 index 0000000..29a42ac Binary files /dev/null and b/sherman-aquarium/aquarium/leds/darkblue.png differ diff --git a/sherman-aquarium/aquarium/leds/green.png b/sherman-aquarium/aquarium/leds/green.png new file mode 100644 index 0000000..27a4453 Binary files /dev/null and b/sherman-aquarium/aquarium/leds/green.png differ diff --git a/sherman-aquarium/aquarium/leds/lightblue.png b/sherman-aquarium/aquarium/leds/lightblue.png new file mode 100644 index 0000000..95ec492 Binary files /dev/null and b/sherman-aquarium/aquarium/leds/lightblue.png differ diff --git a/sherman-aquarium/aquarium/leds/orange.png b/sherman-aquarium/aquarium/leds/orange.png new file mode 100644 index 0000000..386f4ac Binary files /dev/null and b/sherman-aquarium/aquarium/leds/orange.png differ diff --git a/sherman-aquarium/aquarium/leds/pink.png b/sherman-aquarium/aquarium/leds/pink.png new file mode 100644 index 0000000..c61dd74 Binary files /dev/null and b/sherman-aquarium/aquarium/leds/pink.png differ diff --git a/sherman-aquarium/aquarium/leds/red.png b/sherman-aquarium/aquarium/leds/red.png new file mode 100644 index 0000000..1ae8cb4 Binary files /dev/null and b/sherman-aquarium/aquarium/leds/red.png differ diff --git a/sherman-aquarium/aquarium/leds/violet.png b/sherman-aquarium/aquarium/leds/violet.png new file mode 100644 index 0000000..0e0cf9b Binary files /dev/null and b/sherman-aquarium/aquarium/leds/violet.png differ diff --git a/sherman-aquarium/aquarium/leds/yellow.png b/sherman-aquarium/aquarium/leds/yellow.png new file mode 100644 index 0000000..39fbf0c Binary files /dev/null and b/sherman-aquarium/aquarium/leds/yellow.png differ diff --git a/sherman-aquarium/aquarium/leds/yellowgreen.png b/sherman-aquarium/aquarium/leds/yellowgreen.png new file mode 100644 index 0000000..ad6204b Binary files /dev/null and b/sherman-aquarium/aquarium/leds/yellowgreen.png differ diff --git a/sherman-aquarium/aquarium/matrix1.png b/sherman-aquarium/aquarium/matrix1.png new file mode 100644 index 0000000..45d9dde Binary files /dev/null and b/sherman-aquarium/aquarium/matrix1.png differ diff --git a/sherman-aquarium/aquarium/matrix2.png b/sherman-aquarium/aquarium/matrix2.png new file mode 100644 index 0000000..09962e4 Binary files /dev/null and b/sherman-aquarium/aquarium/matrix2.png differ diff --git a/sherman-aquarium/aquarium/sherman/bdweller.png b/sherman-aquarium/aquarium/sherman/bdweller.png new file mode 100644 index 0000000..b193307 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/bdweller.png differ diff --git a/sherman-aquarium/aquarium/sherman/blowfish.png b/sherman-aquarium/aquarium/sherman/blowfish.png new file mode 100644 index 0000000..2c07822 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/blowfish.png differ diff --git a/sherman-aquarium/aquarium/sherman/blowup.png b/sherman-aquarium/aquarium/sherman/blowup.png new file mode 100644 index 0000000..502273c Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/blowup.png differ diff --git a/sherman-aquarium/aquarium/sherman/eating.png b/sherman-aquarium/aquarium/sherman/eating.png new file mode 100644 index 0000000..d570707 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/eating.png differ diff --git a/sherman-aquarium/aquarium/sherman/ernest.png b/sherman-aquarium/aquarium/sherman/ernest.png new file mode 100644 index 0000000..9df43a9 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/ernest.png differ diff --git a/sherman-aquarium/aquarium/sherman/fillmore.png b/sherman-aquarium/aquarium/sherman/fillmore.png new file mode 100644 index 0000000..731a47d Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fillmore.png differ diff --git a/sherman-aquarium/aquarium/sherman/fish1.png b/sherman-aquarium/aquarium/sherman/fish1.png new file mode 100644 index 0000000..6e5b506 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fish1.png differ diff --git a/sherman-aquarium/aquarium/sherman/fish2.png b/sherman-aquarium/aquarium/sherman/fish2.png new file mode 100644 index 0000000..f8cfee6 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fish2.png differ diff --git a/sherman-aquarium/aquarium/sherman/fish3.png b/sherman-aquarium/aquarium/sherman/fish3.png new file mode 100644 index 0000000..1440ce9 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fish3.png differ diff --git a/sherman-aquarium/aquarium/sherman/fish4.png b/sherman-aquarium/aquarium/sherman/fish4.png new file mode 100644 index 0000000..fbd5b31 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fish4.png differ diff --git a/sherman-aquarium/aquarium/sherman/fish5.png b/sherman-aquarium/aquarium/sherman/fish5.png new file mode 100644 index 0000000..ecdce5a Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fish5.png differ diff --git a/sherman-aquarium/aquarium/sherman/fish6.png b/sherman-aquarium/aquarium/sherman/fish6.png new file mode 100644 index 0000000..97519d9 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/fish6.png differ diff --git a/sherman-aquarium/aquarium/sherman/hawthorne.png b/sherman-aquarium/aquarium/sherman/hawthorne.png new file mode 100644 index 0000000..617cd7f Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/hawthorne.png differ diff --git a/sherman-aquarium/aquarium/sherman/hunter.png b/sherman-aquarium/aquarium/sherman/hunter.png new file mode 100644 index 0000000..a398739 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/hunter.png differ diff --git a/sherman-aquarium/aquarium/sherman/lori.png b/sherman-aquarium/aquarium/sherman/lori.png new file mode 100644 index 0000000..db3465f Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/lori.png differ diff --git a/sherman-aquarium/aquarium/sherman/megan.png b/sherman-aquarium/aquarium/sherman/megan.png new file mode 100644 index 0000000..81ff24a Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/megan.png differ diff --git a/sherman-aquarium/aquarium/sherman/prey.png b/sherman-aquarium/aquarium/sherman/prey.png new file mode 100644 index 0000000..1933cd8 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/prey.png differ diff --git a/sherman-aquarium/aquarium/sherman/sherman.png b/sherman-aquarium/aquarium/sherman/sherman.png new file mode 100644 index 0000000..d525be4 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/sherman.png differ diff --git a/sherman-aquarium/aquarium/sherman/squid.png b/sherman-aquarium/aquarium/sherman/squid.png new file mode 100644 index 0000000..4a6aa24 Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/squid.png differ diff --git a/sherman-aquarium/aquarium/sherman/swordfish.png b/sherman-aquarium/aquarium/sherman/swordfish.png new file mode 100644 index 0000000..2d2d50a Binary files /dev/null and b/sherman-aquarium/aquarium/sherman/swordfish.png differ diff --git a/sherman-aquarium/aquarium/small_letters.png b/sherman-aquarium/aquarium/small_letters.png new file mode 100644 index 0000000..47ee3a1 Binary files /dev/null and b/sherman-aquarium/aquarium/small_letters.png differ diff --git a/sherman-aquarium/aquarium/sounds/README.SOUNDS b/sherman-aquarium/aquarium/sounds/README.SOUNDS new file mode 100644 index 0000000..3b902a2 --- /dev/null +++ b/sherman-aquarium/aquarium/sounds/README.SOUNDS @@ -0,0 +1,17 @@ + +The sound effects are copyrighted by Jim Toomey, and are +extracted from the screensaver "Sherman's Lagoon". + +The original sound files are in WAVE format, but since most +people have a command line mp3 player and no command line wave +file player, I've converted them to mp3s, using LAME 3.92. + +lame -m a --r3mix -q 9 -v -c -p --tt "Many bubbles" --tc \ +"Copyright by Jim Toomey" manybubbles.wav manybubbles.mp3 + +For those of you that dislikes mp3s for various reaons +and prefer oggs there are ogg files too. + +oggenc -q 7 -t "Prey death scream" -c "Copyright by Jim Toomey" \ +deathscream.wav + diff --git a/sherman-aquarium/aquarium/sounds/mp3/deathscream.mp3 b/sherman-aquarium/aquarium/sounds/mp3/deathscream.mp3 new file mode 100644 index 0000000..5aff267 Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/mp3/deathscream.mp3 differ diff --git a/sherman-aquarium/aquarium/sounds/mp3/explode.mp3 b/sherman-aquarium/aquarium/sounds/mp3/explode.mp3 new file mode 100644 index 0000000..40023ef Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/mp3/explode.mp3 differ diff --git a/sherman-aquarium/aquarium/sounds/mp3/fewbubbles.mp3 b/sherman-aquarium/aquarium/sounds/mp3/fewbubbles.mp3 new file mode 100644 index 0000000..67d2e5c Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/mp3/fewbubbles.mp3 differ diff --git a/sherman-aquarium/aquarium/sounds/mp3/manybubbles.mp3 b/sherman-aquarium/aquarium/sounds/mp3/manybubbles.mp3 new file mode 100644 index 0000000..76ca0b3 Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/mp3/manybubbles.mp3 differ diff --git a/sherman-aquarium/aquarium/sounds/ogg/deathscream.ogg b/sherman-aquarium/aquarium/sounds/ogg/deathscream.ogg new file mode 100644 index 0000000..3563d40 Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/ogg/deathscream.ogg differ diff --git a/sherman-aquarium/aquarium/sounds/ogg/explode.ogg b/sherman-aquarium/aquarium/sounds/ogg/explode.ogg new file mode 100644 index 0000000..957e72a Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/ogg/explode.ogg differ diff --git a/sherman-aquarium/aquarium/sounds/ogg/fewbubbles.ogg b/sherman-aquarium/aquarium/sounds/ogg/fewbubbles.ogg new file mode 100644 index 0000000..7a4d7c7 Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/ogg/fewbubbles.ogg differ diff --git a/sherman-aquarium/aquarium/sounds/ogg/manybubbles.ogg b/sherman-aquarium/aquarium/sounds/ogg/manybubbles.ogg new file mode 100644 index 0000000..eda2d58 Binary files /dev/null and b/sherman-aquarium/aquarium/sounds/ogg/manybubbles.ogg differ diff --git a/sherman-aquarium/aquarium/strips/comic1.gif b/sherman-aquarium/aquarium/strips/comic1.gif new file mode 100644 index 0000000..f206e9a Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic1.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic10.gif b/sherman-aquarium/aquarium/strips/comic10.gif new file mode 100644 index 0000000..f3c6686 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic10.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic11.gif b/sherman-aquarium/aquarium/strips/comic11.gif new file mode 100644 index 0000000..1e9fc5c Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic11.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic12.gif b/sherman-aquarium/aquarium/strips/comic12.gif new file mode 100644 index 0000000..5bb7d8f Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic12.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic13.gif b/sherman-aquarium/aquarium/strips/comic13.gif new file mode 100644 index 0000000..350f209 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic13.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic14.gif b/sherman-aquarium/aquarium/strips/comic14.gif new file mode 100644 index 0000000..c679de5 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic14.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic15.gif b/sherman-aquarium/aquarium/strips/comic15.gif new file mode 100644 index 0000000..c4acf31 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic15.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic16.gif b/sherman-aquarium/aquarium/strips/comic16.gif new file mode 100644 index 0000000..36559e3 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic16.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic17.gif b/sherman-aquarium/aquarium/strips/comic17.gif new file mode 100644 index 0000000..3e17408 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic17.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic18.gif b/sherman-aquarium/aquarium/strips/comic18.gif new file mode 100644 index 0000000..7a45cd7 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic18.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic19.gif b/sherman-aquarium/aquarium/strips/comic19.gif new file mode 100644 index 0000000..1740460 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic19.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic2.gif b/sherman-aquarium/aquarium/strips/comic2.gif new file mode 100644 index 0000000..a75990e Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic2.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic20.gif b/sherman-aquarium/aquarium/strips/comic20.gif new file mode 100644 index 0000000..9517e41 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic20.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic21.gif b/sherman-aquarium/aquarium/strips/comic21.gif new file mode 100644 index 0000000..5815bf4 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic21.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic22.gif b/sherman-aquarium/aquarium/strips/comic22.gif new file mode 100644 index 0000000..f480a6e Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic22.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic23.gif b/sherman-aquarium/aquarium/strips/comic23.gif new file mode 100644 index 0000000..cadd267 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic23.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic24.gif b/sherman-aquarium/aquarium/strips/comic24.gif new file mode 100644 index 0000000..ed1c69d Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic24.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic25.gif b/sherman-aquarium/aquarium/strips/comic25.gif new file mode 100644 index 0000000..88215bb Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic25.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic3.gif b/sherman-aquarium/aquarium/strips/comic3.gif new file mode 100644 index 0000000..8022115 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic3.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic4.gif b/sherman-aquarium/aquarium/strips/comic4.gif new file mode 100644 index 0000000..22c3ade Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic4.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic5.gif b/sherman-aquarium/aquarium/strips/comic5.gif new file mode 100644 index 0000000..359123e Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic5.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic6.gif b/sherman-aquarium/aquarium/strips/comic6.gif new file mode 100644 index 0000000..3c706f6 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic6.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic7.gif b/sherman-aquarium/aquarium/strips/comic7.gif new file mode 100644 index 0000000..31305a6 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic7.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic8.gif b/sherman-aquarium/aquarium/strips/comic8.gif new file mode 100644 index 0000000..4ebc8f1 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic8.gif differ diff --git a/sherman-aquarium/aquarium/strips/comic9.gif b/sherman-aquarium/aquarium/strips/comic9.gif new file mode 100644 index 0000000..90a5f25 Binary files /dev/null and b/sherman-aquarium/aquarium/strips/comic9.gif differ diff --git a/sherman-aquarium/aquarium/tetris_figures.png b/sherman-aquarium/aquarium/tetris_figures.png new file mode 100644 index 0000000..a43d134 Binary files /dev/null and b/sherman-aquarium/aquarium/tetris_figures.png differ diff --git a/sherman-aquarium/aquarium/tetris_figures2.png b/sherman-aquarium/aquarium/tetris_figures2.png new file mode 100644 index 0000000..c23e715 Binary files /dev/null and b/sherman-aquarium/aquarium/tetris_figures2.png differ diff --git a/sherman-aquarium/aquarium/tetris_gameover.png b/sherman-aquarium/aquarium/tetris_gameover.png new file mode 100644 index 0000000..93df37e Binary files /dev/null and b/sherman-aquarium/aquarium/tetris_gameover.png differ diff --git a/sherman-aquarium/aquarium/tetris_pieces.png b/sherman-aquarium/aquarium/tetris_pieces.png new file mode 100644 index 0000000..b7f0444 Binary files /dev/null and b/sherman-aquarium/aquarium/tetris_pieces.png differ diff --git a/sherman-aquarium/aquarium/tetris_status.png b/sherman-aquarium/aquarium/tetris_status.png new file mode 100644 index 0000000..6557ad9 Binary files /dev/null and b/sherman-aquarium/aquarium/tetris_status.png differ diff --git a/sherman-aquarium/aquarium/thermometer.png b/sherman-aquarium/aquarium/thermometer.png new file mode 100644 index 0000000..cad2550 Binary files /dev/null and b/sherman-aquarium/aquarium/thermometer.png differ diff --git a/sherman-aquarium/aquarium/water.png b/sherman-aquarium/aquarium/water.png new file mode 100644 index 0000000..15f8275 Binary files /dev/null and b/sherman-aquarium/aquarium/water.png differ diff --git a/sherman-aquarium/config.h b/sherman-aquarium/config.h new file mode 100644 index 0000000..fe19bcf --- /dev/null +++ b/sherman-aquarium/config.h @@ -0,0 +1,32 @@ + +/* + Generic config.h file for GAI applets. + + You don't have to use it for your applet, but a few things will be simpler. + + This file is autogenerated by the configure script. + So don't add things you want permanent here. +*/ +#ifndef GAI_CONFIG_H +#define GAI_CONFIG_H + +#include + +#ifdef GAI_APPLET_DEFINES +static GaiApplet applet_defines = { + "shermans_applet", + "3.0.1", + "Sherman's aquarium", + "Jonas Aaberg, 2002-2005. Graphics by Jim Toomey.", + "Program released under GNU GPL.\nMost graphics Copyrighted by Jim Toomey and is NOT under GNU GPL.", + "Sherman's aquarium is an applet with the\ncreatures from Jim Toomey's\nwonderful comic, Sherman's Lagoon\n(www.slagoon.com).", + "/usr/share/pixmaps/shermans_icon.png", + "/usr/share/pixmaps/shermans" +}; +#endif +#define LINUX +#define IMAGE_PATH "/usr/share/pixmaps/shermans" +#define APPLET_NAME "shermans_applet" +#define APPLET_VERSION "3.0.1" + +#endif diff --git a/sherman-aquarium/config.h.in b/sherman-aquarium/config.h.in new file mode 100644 index 0000000..2154c7a --- /dev/null +++ b/sherman-aquarium/config.h.in @@ -0,0 +1,32 @@ + +/* + Generic config.h file for GAI applets. + + You don't have to use it for your applet, but a few things will be simpler. + + @REMARK@ + @REMARK2@ +*/ +#ifndef GAI_CONFIG_H +#define GAI_CONFIG_H + +#include + +#ifdef GAI_APPLET_DEFINES +static GaiApplet applet_defines = { + "@APPLET_NAME@", + "@APPLET_VERSION@", + "@APPLET_NICE_NAME@", + "@APPLET_AUTHOR@", + "@APPLET_LICENSE@", + "@APPLET_DESCRIPTION@", + "@APPLET_ICON@", + "@APPLET_IMAGE_PATH@" +}; +#endif +#define @HOST@ +#define IMAGE_PATH "@APPLET_IMAGE_PATH@" +#define APPLET_NAME "@APPLET_NAME@" +#define APPLET_VERSION "@APPLET_VERSION@" +@XMMS@ +#endif diff --git a/sherman-aquarium/configure b/sherman-aquarium/configure new file mode 100755 index 0000000..ef81b00 --- /dev/null +++ b/sherman-aquarium/configure @@ -0,0 +1,3744 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT APPLET_NAME APPLET_VERSION APPLET_NICE_NAME APPLET_AUTHOR APPLET_GROUP APPLET_NAME_ICON APPLET_IMAGES APPLET_DESCRIPTION_SHORT APPLET_DESCRIPTION APPLET_LICENSE HOST SYSTEM_SPECIFIC_LIBS STATUS PKGCONF GNOMEDIR DGAI GAI_CFLAGS GAI_LIBS APPLET INSTALL_APPLET INSTALL_GNOME INSTALL_PATH INSTALL_ROX ROX_PATH INSTALL_IMAGES APPLET_IMAGE_PATH APPLET_ICON SDLCONF GTK_LIBS GTK_CFLAGS INSTALL_SCREENSAVER SDL_CFLAGS SDL_LIBS SCREENSAVER XMMS_CONFIG XMMS_OBJ XMMS_CFLAGS XMMS_LIBS XMMS REMARK REMARK2 LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-sdl Compile Sherman's aquarium without Screensaver support + --disable-gai Compile Sherman's aquarium without applet support + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + +APPLET_NAME="shermans_applet" + +APPLET_VERSION="3.0.1" + +APPLET_NICE_NAME="Sherman's aquarium" + +APPLET_AUTHOR="Jonas Aaberg, 2002-2005. Graphics by Jim Toomey." + +APPLET_GROUP="Amusements" + +APPLET_NAME_ICON="shermans_icon.png" + +APPLET_IMAGES="aquarium/*" + +APPLET_DESCRIPTION_SHORT="Bringer of life." + +APPLET_DESCRIPTION="Sherman's aquarium is an applet with the\ncreatures from Jim Toomey's\nwonderful comic, Sherman's Lagoon\n(www.slagoon.com)." + +APPLET_LICENSE="Program released under GNU GPL.\nMost graphics Copyrighted by Jim Toomey and is NOT under GNU GPL." + +APPLET_REQUIRES_GAI_VERSION="0.5.3" + +APPLET_XMMS=checkfor + + +with_sdl=yes +echo "$as_me:$LINENO: checking whether to try to include Screensaver support" >&5 +echo $ECHO_N "checking whether to try to include Screensaver support... $ECHO_C" >&6 +# Check whether --enable-sdl or --disable-sdl was given. +if test "${enable_sdl+set}" = set; then + enableval="$enable_sdl" + + if test x$withval = xyes; then + with_sdl=yes + else + with_sdl=no + fi + +fi; +if test x$with_sdl = xno; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +fi + + +with_gai=yes +echo "$as_me:$LINENO: checking whether to try to compile applet support " >&5 +echo $ECHO_N "checking whether to try to compile applet support ... $ECHO_C" >&6 +# Check whether --enable-gai or --disable-gai was given. +if test "${enable_gai+set}" = set; then + enableval="$enable_gai" + + if test x$withval = xyes; then + with_gai=yes + else + with_gai=no + fi + +fi; +if test x$with_gai = xno; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +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 "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +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 "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + +echo "$as_me:$LINENO: checking operating system" >&5 +echo $ECHO_N "checking operating system... $ECHO_C" >&6 +OSTYPE=`uname -s` +echo "$as_me:$LINENO: result: $OSTYPE" >&5 +echo "${ECHO_T}$OSTYPE" >&6 +HOST="UNKNOWN" +STATUS= +SYSTEM_SPECIFIC_LIBS= +case $OSTYPE in + + Linux) + HOST="LINUX" + MINOR=`uname -r | sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\(.*\)/\2/'` + if test x$MINOR = x4 ; then + STATUS="status_linux24.o" + else + STATUS="status_linux26.o" + fi + ;; + Darwin) + HOST="DARWIN" + STATUS="status_drawin.o" + ;; + FreeBSD) + HOST="FREEBSD" + STATUS="status_freebsd.o" + SYSTEM_SPECIFIC_LIBS="-lkvm" + ;; + OpenBSD) + HOST="OPENBSD" + ;; + NetBSD) + HOST="NETBSD" + ;; + SunOS) + HOST="SUNOS" + ;; +esac + + + + +INSTALL_APPLET= +GAI=no +APPLET= +DGAI= +FOUND_GAI_LIBS=no + +INSTALL_GNOME= +GNOME=no + + +if test x$with_gai = xyes ; then +# Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_PKGCONF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$PKGCONF"; then + ac_cv_prog_PKGCONF="$PKGCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PKGCONF="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_PKGCONF" && ac_cv_prog_PKGCONF="false" +fi +fi +PKGCONF=$ac_cv_prog_PKGCONF +if test -n "$PKGCONF"; then + echo "$as_me:$LINENO: result: $PKGCONF" >&5 +echo "${ECHO_T}$PKGCONF" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + +if $PKGCONF ; then + echo "$as_me:$LINENO: checking for gai" >&5 +echo $ECHO_N "checking for gai... $ECHO_C" >&6 + if `pkg-config --exists gai` ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + GAI_CFLAGS=`pkg-config --cflags gai` + GAI_LIBS=`pkg-config --libs gai` + FOUND_GAI_LIBS=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi +else + { { echo "$as_me:$LINENO: error: \"can't find pkg-config!\"" >&5 +echo "$as_me: error: \"can't find pkg-config!\"" >&2;} + { (exit 1); exit 1; }; } +fi + +if test x$FOUND_GAI_LIBS = xyes ; then + + echo "$as_me:$LINENO: checking for gai version >= $APPLET_REQUIRES_GAI_VERSION" >&5 +echo $ECHO_N "checking for gai version >= $APPLET_REQUIRES_GAI_VERSION... $ECHO_C" >&6 + if `pkg-config gai --atleast-version $APPLET_REQUIRES_GAI_VERSION` ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + DGAI=-DGAI + GAI=yes + APPLET=shermans_applet + INSTALL_APPLET=install_applet + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + GAI=no + fi + + + +if test x$GAI = xyes ; then +echo "$as_me:$LINENO: checking if gai is compiled with gnome support" >&5 +echo $ECHO_N "checking if gai is compiled with gnome support... $ECHO_C" >&6 + +INSTALL_GNOME= +GNOME_SERVER= + +if test `pkg-config gai --variable=gnome` = yes; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + GNOME=yes + echo "$as_me:$LINENO: checking for gnome prefix" >&5 +echo $ECHO_N "checking for gnome prefix... $ECHO_C" >&6 + with_gnome_prefix=`(pkg-config --variable=prefix libpanelapplet-2.0) 2>/dev/null` + if test $? -ne 0; then + with_gnome_prefix='${prefix}' + fi + echo "$as_me:$LINENO: result: $with_gnome_prefix" >&5 +echo "${ECHO_T}$with_gnome_prefix" >&6 + + GNOMEDIR=$with_gnome_prefix + INSTALL_GNOME=install-gnome + INSTALL_PATH='$(GNOMEDIR)' + + GNOMESERVER=`echo -n GNOME_$APPLET_NAME;echo -n "Applet.server"` + cat >$GNOMESERVER.in << EOF + + + + + + + + + + + + + + + + + + + + + + +EOF + + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + GNOME=no + if test x$prefix = xNONE ; then + GNOMEDIR=/usr/local/ + INSTALL_PATH=/usr/local/ + else + GNOMEDIR=$prefix + INSTALL_PATH=$prefix + fi +fi + + +fi + + + + +ROX_APPRUN= +ROX_APPINFO= +INSTALL_ROX= +ROX_PATH= +echo "$as_me:$LINENO: checking if gai knows about the ROX panel" >&5 +echo $ECHO_N "checking if gai knows about the ROX panel... $ECHO_C" >&6 +if test `pkg-config gai --variable=rox` = yes; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + ROX_APPRUN=AppRun + + cat >AppRun.in << EOF +#!/bin/sh +# Slightly modified by Jonas Aaberg to suit GAI applets. + +PROG=@APPLET_NAME@ + +APP_DIR=\`dirname "\$0"\` +APP_DIR=\`cd "\$APP_DIR";pwd\`; export APP_DIR + +BIN="\$APP_DIR/\$PROG" + +exec "\$BIN" --gai-rox "\$@" +EOF + + ROX_APPINFO=AppInfo.xml + + cat >AppInfo.xml.in << EOF + + + @APPLET_DESCRIPTION_SHORT@ + + +EOF + + + INSTALL_ROX=install-rox + ROX_PATH=`pkg-config gai --variable=roxpath` + echo "$as_me:$LINENO: checking for ROX path" >&5 +echo $ECHO_N "checking for ROX path... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $ROX_PATH" >&5 +echo "${ECHO_T}$ROX_PATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + +fi + +fi + + +if test x$GAI = xno ; then + if test x$prefix = xNONE ; then + GNOMEDIR=/usr/local/ + INSTALL_PATH=/usr/local/ + else + GNOMEDIR=$prefix + INSTALL_PATH=$prefix + fi +fi + + + + + + + + + + + + + + + + + +if test x$APPLET_IMAGES = x; then + INSTALL_IMAGES= +else + INSTALL_IMAGES=install-images +fi + + +if test x$GNOME = xyes ; then + APPLET_IMAGE_PATH=$GNOMEDIR/share/pixmaps/shermans + APPLET_ICON=$GNOMEDIR/share/pixmaps/$APPLET_NAME_ICON +else + if test x$prefix = xNONE ; then + APPLET_IMAGE_PATH=/usr/local/share/pixmaps/shermans + APPLET_ICON=/usr/local/share/pixmaps/$APPLET_NAME_ICON + else + APPLET_IMAGE_PATH=$prefix/share/pixmaps/shermans + APPLET_ICON=$prefix/share/pixmaps/$APPLET_NAME_ICON + fi +fi + + + + + +SDL=no +SCREENSAVER= +SDL_CFLAGS= +SDL_LIBS= +INSTALL_SCREENSAVER= + +if test x$with_sdl = xyes ; then + # Extract the first word of "sdl-config", so it can be a program name with args. +set dummy sdl-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_SDLCONF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$SDLCONF"; then + ac_cv_prog_SDLCONF="$SDLCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_SDLCONF="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_SDLCONF" && ac_cv_prog_SDLCONF="false" +fi +fi +SDLCONF=$ac_cv_prog_SDLCONF +if test -n "$SDLCONF"; then + echo "$as_me:$LINENO: result: $SDLCONF" >&5 +echo "${ECHO_T}$SDLCONF" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if $SDLCONF ; then + sdl_version=`sdl-config --version` + echo "$as_me:$LINENO: checking for SDL version ($sdl_version) >= 1.2.0" >&5 +echo $ECHO_N "checking for SDL version ($sdl_version) >= 1.2.0... $ECHO_C" >&6 + SDL_MAJOR=`sdl-config --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + SDL_MINOR=`sdl-config --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + SDL_MICRO=`sdl-config --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + SDL=yes + + if test $SDL_MAJOR -eq 1 ; then + if test $SDL_MINOR -eq 2 ; then + SDL=yes; + else + SDL=no; + fi + else + SDL=no + fi + + if test x$SDL = xyes ; then + SDL_CFLAGS=`sdl-config --cflags` + SDL_LIBS=`sdl-config --libs` + SCREENSAVER=shermans + INSTALL_SCREENSAVER=install_screensaver + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + echo "$as_me:$LINENO: checking for gtk+ version >= 2.2.0" >&5 +echo $ECHO_N "checking for gtk+ version >= 2.2.0... $ECHO_C" >&6 + if `pkg-config gtk+-2.0 --atleast-version 2.2.0` ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + GTK_CFLAGS=`pkg-config --cflags gtk+-2.0` + GTK_LIBS=`pkg-config --libs gtk+-2.0` + + + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: GTK+ v2.2.0 or later is needed for Sherman's aquarium!" >&5 +echo "$as_me: error: GTK+ v2.2.0 or later is needed for Sherman's aquarium!" >&2;} + { (exit 1); exit 1; }; } + fi + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + fi + +fi + + + + + + + + + + +XMMS= +XMMS_CFLAGS= +XMMS_LIBS= +XMMS_OBJ= +if test x$FOUND_GAI_LIBS = xyes ; then +if test x$with_gai = xyes ; then +if test x$APPLET_XMMS = xyes ; then + # Extract the first word of "xmms-config", so it can be a program name with args. +set dummy xmms-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_XMMS_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$XMMS_CONFIG"; then + ac_cv_prog_XMMS_CONFIG="$XMMS_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_XMMS_CONFIG="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_XMMS_CONFIG" && ac_cv_prog_XMMS_CONFIG="false" +fi +fi +XMMS_CONFIG=$ac_cv_prog_XMMS_CONFIG +if test -n "$XMMS_CONFIG"; then + echo "$as_me:$LINENO: result: $XMMS_CONFIG" >&5 +echo "${ECHO_T}$XMMS_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if $XMMS_CONFIG ; then + XMMS_CFLAGS=`xmms-config --cflags` + XMMS_LIBS=`xmms-config --libs` + XMMS="#define XMMS" + else + { { echo "$as_me:$LINENO: error: \"can't find xmms-config! XMMS installed?\"" >&5 +echo "$as_me: error: \"can't find xmms-config! XMMS installed?\"" >&2;} + { (exit 1); exit 1; }; } + fi +fi +if test x$APPLET_XMMS = xcheckfor ; then + # Extract the first word of "xmms-config", so it can be a program name with args. +set dummy xmms-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_XMMS_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$XMMS_CONFIG"; then + ac_cv_prog_XMMS_CONFIG="$XMMS_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_XMMS_CONFIG="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_XMMS_CONFIG" && ac_cv_prog_XMMS_CONFIG="false" +fi +fi +XMMS_CONFIG=$ac_cv_prog_XMMS_CONFIG +if test -n "$XMMS_CONFIG"; then + echo "$as_me:$LINENO: result: $XMMS_CONFIG" >&5 +echo "${ECHO_T}$XMMS_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if $XMMS_CONFIG ; then + XMMS_CFLAGS=`xmms-config --cflags` + XMMS_LIBS=`xmms-config --libs` + XMMS="#define XMMS" + XMMS_OBJ="xmms_sn.o" + fi +fi +fi +fi + + + + + + +REMARK="This file is autogenerated by the configure script." +REMARK2="So don't add things you want permanent here." + + + + + ac_config_files="$ac_config_files $GNOMESERVER $ROX_APPRUN $ROX_APPINFO Makefile config.h shermans/Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "$GNOMESERVER" ) CONFIG_FILES="$CONFIG_FILES $GNOMESERVER" ;; + "$ROX_APPRUN" ) CONFIG_FILES="$CONFIG_FILES $ROX_APPRUN" ;; + "$ROX_APPINFO" ) CONFIG_FILES="$CONFIG_FILES $ROX_APPINFO" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config.h" ) CONFIG_FILES="$CONFIG_FILES config.h" ;; + "shermans/Makefile" ) CONFIG_FILES="$CONFIG_FILES shermans/Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@APPLET_NAME@,$APPLET_NAME,;t t +s,@APPLET_VERSION@,$APPLET_VERSION,;t t +s,@APPLET_NICE_NAME@,$APPLET_NICE_NAME,;t t +s,@APPLET_AUTHOR@,$APPLET_AUTHOR,;t t +s,@APPLET_GROUP@,$APPLET_GROUP,;t t +s,@APPLET_NAME_ICON@,$APPLET_NAME_ICON,;t t +s,@APPLET_IMAGES@,$APPLET_IMAGES,;t t +s,@APPLET_DESCRIPTION_SHORT@,$APPLET_DESCRIPTION_SHORT,;t t +s,@APPLET_DESCRIPTION@,$APPLET_DESCRIPTION,;t t +s,@APPLET_LICENSE@,$APPLET_LICENSE,;t t +s,@HOST@,$HOST,;t t +s,@SYSTEM_SPECIFIC_LIBS@,$SYSTEM_SPECIFIC_LIBS,;t t +s,@STATUS@,$STATUS,;t t +s,@PKGCONF@,$PKGCONF,;t t +s,@GNOMEDIR@,$GNOMEDIR,;t t +s,@DGAI@,$DGAI,;t t +s,@GAI_CFLAGS@,$GAI_CFLAGS,;t t +s,@GAI_LIBS@,$GAI_LIBS,;t t +s,@APPLET@,$APPLET,;t t +s,@INSTALL_APPLET@,$INSTALL_APPLET,;t t +s,@INSTALL_GNOME@,$INSTALL_GNOME,;t t +s,@INSTALL_PATH@,$INSTALL_PATH,;t t +s,@INSTALL_ROX@,$INSTALL_ROX,;t t +s,@ROX_PATH@,$ROX_PATH,;t t +s,@INSTALL_IMAGES@,$INSTALL_IMAGES,;t t +s,@APPLET_IMAGE_PATH@,$APPLET_IMAGE_PATH,;t t +s,@APPLET_ICON@,$APPLET_ICON,;t t +s,@SDLCONF@,$SDLCONF,;t t +s,@GTK_LIBS@,$GTK_LIBS,;t t +s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t +s,@INSTALL_SCREENSAVER@,$INSTALL_SCREENSAVER,;t t +s,@SDL_CFLAGS@,$SDL_CFLAGS,;t t +s,@SDL_LIBS@,$SDL_LIBS,;t t +s,@SCREENSAVER@,$SCREENSAVER,;t t +s,@XMMS_CONFIG@,$XMMS_CONFIG,;t t +s,@XMMS_OBJ@,$XMMS_OBJ,;t t +s,@XMMS_CFLAGS@,$XMMS_CFLAGS,;t t +s,@XMMS_LIBS@,$XMMS_LIBS,;t t +s,@XMMS@,$XMMS,;t t +s,@REMARK@,$REMARK,;t t +s,@REMARK2@,$REMARK2,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + +echo +echo " Sherman's aquarium v$APPLET_VERSION" +echo "===========================" +echo " - Compile Sherman's aquarium - dockapp/wmapplet: $GAI" +echo " - Compile Sherman's aquarium - Gnome 2 Panel applet: $GNOME" +echo " - Compile Sherman's aquarium - Screensaver: $SDL" diff --git a/sherman-aquarium/configure.in b/sherman-aquarium/configure.in new file mode 100644 index 0000000..8413c07 --- /dev/null +++ b/sherman-aquarium/configure.in @@ -0,0 +1,473 @@ +dnl +dnl Sherman's aquarium 3.0.1 configure script. +dnl Written by Jonas Aaberg 2002-2005 +dnl +dnl run autoconf to generate a configure script from this file. +dnl + +AC_PREREQ(2.13) +AC_INIT() + +dnl ************************************************************************** +dnl Change those things between the star lines. +dnl *************************************************************************** + +dnl This is the name of your applet, low level. $(APPLET_NAME).c is the main +dnl c file. +APPLET_NAME="shermans_applet" + +dnl The version of your applet +APPLET_VERSION="3.0.1" + +dnl The display name in the gnome 2 menu and for the About box. +APPLET_NICE_NAME="Sherman's aquarium" + +dnl Your name and email for the "Written by " field in the about box +APPLET_AUTHOR="Jonas Aaberg, 2002-2005. Graphics by Jim Toomey." + +dnl Change the group. (This is just for gnome) +dnl Valid groups are: +dnl "Accessories", "Amusements", "Internet", "Multimedia" and "Utility" +APPLET_GROUP="Amusements" + +dnl The name file of the icon for the menu. +APPLET_NAME_ICON="shermans_icon.png" + +dnl Images to install. +APPLET_IMAGES="aquarium/*" + +dnl A one line description for the gnome menu. +APPLET_DESCRIPTION_SHORT="Bringer of life." + +dnl This is the text displayed in the about box. +APPLET_DESCRIPTION="Sherman's aquarium is an applet with the\ncreatures from Jim Toomey's\nwonderful comic, Sherman's Lagoon\n(www.slagoon.com)." + +dnl This is for the license line in the about box. +APPLET_LICENSE="Program released under GNU GPL.\nMost graphics Copyrighted by Jim Toomey and is NOT under GNU GPL." + +dnl Version of GAI that is required +APPLET_REQUIRES_GAI_VERSION="0.5.3" + +dnl Require XMMS (yes or no or checkfor) +APPLET_XMMS=checkfor + +dnl **************************************************************************** + +with_sdl=yes +AC_MSG_CHECKING(whether to try to include Screensaver support) +AC_ARG_ENABLE(sdl, [ --disable-sdl Compile Sherman's aquarium without Screensaver support],[ + if test x$withval = xyes; then + with_sdl=yes + else + with_sdl=no + fi +]) +if test x$with_sdl = xno; then + AC_MSG_RESULT(no) +else + AC_MSG_RESULT(yes) +fi + + +with_gai=yes +AC_MSG_CHECKING(whether to try to compile applet support ) +AC_ARG_ENABLE(gai, [ --disable-gai Compile Sherman's aquarium without applet support],[ + if test x$withval = xyes; then + with_gai=yes + else + with_gai=no + fi +]) +if test x$with_gai = xno; then + AC_MSG_RESULT(no) +else + AC_MSG_RESULT(yes) +fi + + +AC_PROG_CC +AC_SUBST(APPLET_NAME) +AC_SUBST(APPLET_VERSION) +AC_SUBST(APPLET_NICE_NAME) +AC_SUBST(APPLET_AUTHOR) +AC_SUBST(APPLET_GROUP) +AC_SUBST(APPLET_NAME_ICON) +AC_SUBST(APPLET_IMAGES) +AC_SUBST(APPLET_DESCRIPTION_SHORT) +AC_SUBST(APPLET_DESCRIPTION) +AC_SUBST(APPLET_LICENSE) + +dnl OS check + +AC_MSG_CHECKING(operating system) +OSTYPE=`uname -s` +AC_MSG_RESULT($OSTYPE) +HOST="UNKNOWN" +STATUS= +SYSTEM_SPECIFIC_LIBS= +case $OSTYPE in + + Linux) + HOST="LINUX" + MINOR=`uname -r | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'` + if test x$MINOR = x4 ; then + STATUS="status_linux24.o" + else + STATUS="status_linux26.o" + fi + ;; + Darwin) + HOST="DARWIN" + STATUS="status_drawin.o" + ;; + FreeBSD) + HOST="FREEBSD" + STATUS="status_freebsd.o" + SYSTEM_SPECIFIC_LIBS="-lkvm" + ;; + OpenBSD) + HOST="OPENBSD" + ;; + NetBSD) + HOST="NETBSD" + ;; + SunOS) + HOST="SUNOS" + ;; +esac +AC_SUBST(HOST) +AC_SUBST(SYSTEM_SPECIFIC_LIBS) +AC_SUBST(STATUS) + +INSTALL_APPLET= +GAI=no +APPLET= +DGAI= +FOUND_GAI_LIBS=no + +INSTALL_GNOME= +GNOME=no + + +dnl gai +if test x$with_gai = xyes ; then +AC_CHECK_PROG(PKGCONF, pkg-config, true, false) + +if $PKGCONF ; then + AC_MSG_CHECKING(for gai) + if `pkg-config --exists gai` ; then + AC_MSG_RESULT(yes) + GAI_CFLAGS=`pkg-config --cflags gai` + GAI_LIBS=`pkg-config --libs gai` + FOUND_GAI_LIBS=yes + else + AC_MSG_RESULT(no, +GAI is needed for applet support! Please visit http://gai.sf.net) + fi +else + AC_MSG_ERROR("can't find pkg-config!") +fi + +dnl gai version +if test x$FOUND_GAI_LIBS = xyes ; then + + AC_MSG_CHECKING(for gai version >= $APPLET_REQUIRES_GAI_VERSION) + if `pkg-config gai --atleast-version $APPLET_REQUIRES_GAI_VERSION` ; then + AC_MSG_RESULT(yes) + DGAI=-DGAI + GAI=yes + APPLET=shermans_applet + INSTALL_APPLET=install_applet + else + AC_MSG_RESULT(no, + a newer version of GAI is needed! Please visit http://gai.sf.net) + GAI=no + fi + + + +dnl Gnome support +if test x$GAI = xyes ; then +AC_MSG_CHECKING(if gai is compiled with gnome support) + +INSTALL_GNOME= +GNOME_SERVER= + +if test `pkg-config gai --variable=gnome` = yes; then + AC_MSG_RESULT(yes) + GNOME=yes + AC_MSG_CHECKING([for gnome prefix]) + with_gnome_prefix=`(pkg-config --variable=prefix libpanelapplet-2.0) 2>/dev/null` + if test $? -ne 0; then + with_gnome_prefix='${prefix}' + fi + AC_MSG_RESULT([$with_gnome_prefix]) + + GNOMEDIR=$with_gnome_prefix + INSTALL_GNOME=install-gnome + INSTALL_PATH='$(GNOMEDIR)' + + GNOMESERVER=`echo -n GNOME_$APPLET_NAME;echo -n "Applet.server"` + cat >$GNOMESERVER.in << EOF + + + + + + + + + + + + + + + + + + + + + + +EOF + + +else + AC_MSG_RESULT(no) + GNOME=no + if test x$prefix = xNONE ; then + GNOMEDIR=/usr/local/ + INSTALL_PATH=/usr/local/ + else + GNOMEDIR=$prefix + INSTALL_PATH=$prefix + fi +fi + + +fi + +AC_SUBST(GNOMEDIR) + + +ROX_APPRUN= +ROX_APPINFO= +INSTALL_ROX= +ROX_PATH= +dnl ROX +AC_MSG_CHECKING(if gai knows about the ROX panel) +if test `pkg-config gai --variable=rox` = yes; then + AC_MSG_RESULT(yes) + ROX_APPRUN=AppRun + + cat >AppRun.in << EOF +#!/bin/sh +# Slightly modified by Jonas Aaberg to suit GAI applets. + +PROG=@APPLET_NAME@ + +APP_DIR=\`dirname "\$0"\` +APP_DIR=\`cd "\$APP_DIR";pwd\`; export APP_DIR + +BIN="\$APP_DIR/\$PROG" + +exec "\$BIN" --gai-rox "\$@" +EOF + + ROX_APPINFO=AppInfo.xml + + cat >AppInfo.xml.in << EOF + + + @APPLET_DESCRIPTION_SHORT@ + + +EOF + + + INSTALL_ROX=install-rox + ROX_PATH=`pkg-config gai --variable=roxpath` + AC_MSG_CHECKING(for ROX path) + AC_MSG_RESULT($ROX_PATH) +else + AC_MSG_RESULT(no) +fi + + +dnl endif gai lib not found +fi + +dnl endif with gai +fi + + +if test x$GAI = xno ; then + if test x$prefix = xNONE ; then + GNOMEDIR=/usr/local/ + INSTALL_PATH=/usr/local/ + else + GNOMEDIR=$prefix + INSTALL_PATH=$prefix + fi +fi + + +AC_SUBST(DGAI) +AC_SUBST(GAI_CFLAGS) +AC_SUBST(GAI_LIBS) +AC_SUBST(APPLET) +AC_SUBST(INSTALL_APPLET) +AC_SUBST(INSTALL_GNOME) +AC_SUBST(INSTALL_PATH) + + + +AC_SUBST(INSTALL_ROX) +AC_SUBST(ROX_PATH) + + + +dnl images +if test x$APPLET_IMAGES = x; then + INSTALL_IMAGES= +else + INSTALL_IMAGES=install-images +fi +AC_SUBST(INSTALL_IMAGES) + +dnl Setup image path and icon +if test x$GNOME = xyes ; then + APPLET_IMAGE_PATH=$GNOMEDIR/share/pixmaps/shermans + APPLET_ICON=$GNOMEDIR/share/pixmaps/$APPLET_NAME_ICON +else + if test x$prefix = xNONE ; then + APPLET_IMAGE_PATH=/usr/local/share/pixmaps/shermans + APPLET_ICON=/usr/local/share/pixmaps/$APPLET_NAME_ICON + else + APPLET_IMAGE_PATH=$prefix/share/pixmaps/shermans + APPLET_ICON=$prefix/share/pixmaps/$APPLET_NAME_ICON + fi +fi + +AC_SUBST(APPLET_IMAGE_PATH) +AC_SUBST(APPLET_ICON) + + +dnl SDL +SDL=no +SCREENSAVER= +SDL_CFLAGS= +SDL_LIBS= +INSTALL_SCREENSAVER= + +if test x$with_sdl = xyes ; then + AC_CHECK_PROG(SDLCONF, sdl-config, true, false) + + if $SDLCONF ; then + sdl_version=`sdl-config --version` + AC_MSG_CHECKING([for SDL version ($sdl_version) >= 1.2.0]) + dnl copied from yawmppp that copied it from gtk+'s aclocal.m4. These guys must love sed + SDL_MAJOR=`sdl-config --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + SDL_MINOR=`sdl-config --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + SDL_MICRO=`sdl-config --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + SDL=yes + + if test $SDL_MAJOR -eq 1 ; then + if test $SDL_MINOR -eq 2 ; then + SDL=yes; + else + SDL=no; + fi + else + SDL=no + fi + + if test x$SDL = xyes ; then + SDL_CFLAGS=`sdl-config --cflags` + SDL_LIBS=`sdl-config --libs` + SCREENSAVER=shermans + INSTALL_SCREENSAVER=install_screensaver + AC_MSG_RESULT(yes) + dnl gtk+ v2.2.x + AC_MSG_CHECKING(for gtk+ version >= 2.2.0) + if `pkg-config gtk+-2.0 --atleast-version 2.2.0` ; then + AC_MSG_RESULT(yes) + GTK_CFLAGS=`pkg-config --cflags gtk+-2.0` + GTK_LIBS=`pkg-config --libs gtk+-2.0` + AC_SUBST(GTK_LIBS) + AC_SUBST(GTK_CFLAGS) + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(GTK+ v2.2.0 or later is needed for Sherman's aquarium!) + fi + else + AC_MSG_RESULT(no) + fi + fi + +fi + +AC_SUBST(GAI_CFLAGS) +AC_SUBST(GAI_LIBS) +AC_SUBST(APPLET) +AC_SUBST(INSTALL_SCREENSAVER) + +AC_SUBST(SDL_CFLAGS) +AC_SUBST(SDL_LIBS) +AC_SUBST(SCREENSAVER) + +dnl XMMS +XMMS= +XMMS_CFLAGS= +XMMS_LIBS= +XMMS_OBJ= +if test x$FOUND_GAI_LIBS = xyes ; then +if test x$with_gai = xyes ; then +if test x$APPLET_XMMS = xyes ; then + AC_CHECK_PROG(XMMS_CONFIG, xmms-config, true, false) + + if $XMMS_CONFIG ; then + XMMS_CFLAGS=`xmms-config --cflags` + XMMS_LIBS=`xmms-config --libs` + XMMS="#define XMMS" + else + AC_MSG_ERROR("can't find xmms-config! XMMS installed?") + fi +fi +if test x$APPLET_XMMS = xcheckfor ; then + AC_CHECK_PROG(XMMS_CONFIG, xmms-config, true, false) + + if $XMMS_CONFIG ; then + XMMS_CFLAGS=`xmms-config --cflags` + XMMS_LIBS=`xmms-config --libs` + XMMS="#define XMMS" + XMMS_OBJ="xmms_sn.o" + fi +fi +fi +fi + +AC_SUBST(XMMS_OBJ) +AC_SUBST(XMMS_CFLAGS) +AC_SUBST(XMMS_LIBS) +AC_SUBST(XMMS) + +REMARK="This file is autogenerated by the configure script." +REMARK2="So don't add things you want permanent here." +AC_SUBST(REMARK) +AC_SUBST(REMARK2) + + +AC_OUTPUT($GNOMESERVER $ROX_APPRUN $ROX_APPINFO Makefile config.h shermans/Makefile) + +echo +echo " Sherman's aquarium v$APPLET_VERSION" +echo "===========================" +echo " - Compile Sherman's aquarium - dockapp/wmapplet: $GAI" +echo " - Compile Sherman's aquarium - Gnome 2 Panel applet: $GNOME" +echo " - Compile Sherman's aquarium - Screensaver: $SDL" diff --git a/sherman-aquarium/debian/changelog b/sherman-aquarium/debian/changelog new file mode 100644 index 0000000..e0b7f06 --- /dev/null +++ b/sherman-aquarium/debian/changelog @@ -0,0 +1,38 @@ +shermans-aquarium (3.0.1-2) unstable; urgency=low + + * Fix location for xscreensaver config file shermans.xml + (closes: #431496). + + * Rebuild with fixed libgai to remove dependencies on gtk1.2 and xmms + (closes: #391015, #456694). + + * Fix debian/watch file (closes: #449794). + + -- Jose M. Moya Mon, 21 Jan 2008 10:33:37 +0100 + +shermans-aquarium (3.0.1-1) unstable; urgency=low + + * New upstream release (closes: #293359). + + * Maintainer upload, closes: #287089. + + -- Jose M. Moya Wed, 18 Jul 2005 12:23:52 +0100 + +shermans-aquarium (2.2.0-1.1) unstable; urgency=medium + + * Non-maintainer upload prepared by Helen Faulkner; reviewed by Branden + Robinson. Urgency due to fix for release-critical bug (non-free license + problem). + * Changed COPYING and debian/copyright to reflect the new DFSG-free (2 + clause BSD-style) licensing of the fish images, which has recently been + negotiated with the copyright holder. (Closes: #287089) + + -- Branden Robinson Wed, 2 Feb 2005 03:29:17 -0500 + +shermans-aquarium (2.2.0-1) unstable; urgency=low + + * Initial Release (closes: #154684). + Upload sponsored by Roberto Lumbreras . + + -- Jose M. Moya Tue, 27 Jul 2004 18:51:52 +0200 + diff --git a/sherman-aquarium/debian/compat b/sherman-aquarium/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/sherman-aquarium/debian/compat @@ -0,0 +1 @@ +4 diff --git a/sherman-aquarium/debian/control b/sherman-aquarium/debian/control new file mode 100644 index 0000000..902dd70 --- /dev/null +++ b/sherman-aquarium/debian/control @@ -0,0 +1,22 @@ +Source: shermans-aquarium +Section: gnome +Priority: optional +Maintainer: Jose M. Moya +Build-Depends: debhelper (>= 4.1.0), cdbs, libsdl1.2-dev, libgai-dev (>= 0.5.3), autotools-dev +Standards-Version: 3.7.3 +Homepage: http://aquariumapplet.sourceforge.net/ + +Package: shermans-aquarium +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Sherman's aquarium applet for GNOME 2 + This is a GNOME 2 panel applet, a WindowMaker applet, and a + XscreenSaver "hack" that gives you an aquarium that takes care of + itself. No feed, no cleaning and so on. + . + The temperature scale on the right side shows the CPU load. It can + also be configured to display the time and the status of numlock, + capslock and scrollock. + . + The fishes are done by Jim Toomey, the author of the "Sherman's + Lagoon" comics. diff --git a/sherman-aquarium/debian/copyright b/sherman-aquarium/debian/copyright new file mode 100644 index 0000000..5ffffa0 --- /dev/null +++ b/sherman-aquarium/debian/copyright @@ -0,0 +1,40 @@ +This package was debianized by Jose M. Moya on +Tue, 27 Jul 2004 18:51:52 +0200. + +It was downloaded from http://aquariumapplet.sourceforge.net/ + +Upstream Author: + Jonas Aaberg + +Copyright notice and license for everything except the fish images: + + Sherman's aquarium is available under GNU General Public + License (GPL) version 2. + + On Debian systems, the complete text of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL'. + +Copyright notice and license for the fish images: + + Copyright (C) 2005 Jim Toomey. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. diff --git a/sherman-aquarium/debian/dirs b/sherman-aquarium/debian/dirs new file mode 100644 index 0000000..ecb2cef --- /dev/null +++ b/sherman-aquarium/debian/dirs @@ -0,0 +1,4 @@ +usr/bin +usr/lib/bonobo/servers +usr/share/pixmaps +usr/share/xscreensaver/config diff --git a/sherman-aquarium/debian/docs b/sherman-aquarium/debian/docs new file mode 100644 index 0000000..8a2c095 --- /dev/null +++ b/sherman-aquarium/debian/docs @@ -0,0 +1,7 @@ +AUTHORS +BUGS +NEWS +README +README.gai +TODO +XSCREENSAVER diff --git a/sherman-aquarium/debian/install b/sherman-aquarium/debian/install new file mode 100644 index 0000000..8cd1e38 --- /dev/null +++ b/sherman-aquarium/debian/install @@ -0,0 +1,2 @@ +debian/lintian/shermans-aquarium /usr/share/lintian/overrides +debian/linda/shermans-aquarium /usr/share/linda/overrides diff --git a/sherman-aquarium/debian/linda/shermans-aquarium b/sherman-aquarium/debian/linda/shermans-aquarium new file mode 100644 index 0000000..adbd62c --- /dev/null +++ b/sherman-aquarium/debian/linda/shermans-aquarium @@ -0,0 +1 @@ +Tag: extra-license-file diff --git a/sherman-aquarium/debian/lintian/shermans-aquarium b/sherman-aquarium/debian/lintian/shermans-aquarium new file mode 100644 index 0000000..cf9f0c4 --- /dev/null +++ b/sherman-aquarium/debian/lintian/shermans-aquarium @@ -0,0 +1,7 @@ +# +# /usr/share/doc/shermans-aquarium/copyright contains all the +# copyright information, but COPYRIGHT.graphics is also included here +# to avoid the temptation to reuse these pixmaps without including the +# copyright notice. +# +shermans-aquarium: extra-license-file diff --git a/sherman-aquarium/debian/manpages b/sherman-aquarium/debian/manpages new file mode 100644 index 0000000..d3569f2 --- /dev/null +++ b/sherman-aquarium/debian/manpages @@ -0,0 +1,2 @@ +debian/shermans.1 +debian/shermans_applet.1 diff --git a/sherman-aquarium/debian/rules b/sherman-aquarium/debian/rules new file mode 100755 index 0000000..9b94d99 --- /dev/null +++ b/sherman-aquarium/debian/rules @@ -0,0 +1,5 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +DEB_MAKE_CLEAN_TARGET = clean diff --git a/sherman-aquarium/debian/shermans.1 b/sherman-aquarium/debian/shermans.1 new file mode 100644 index 0000000..a8096b9 --- /dev/null +++ b/sherman-aquarium/debian/shermans.1 @@ -0,0 +1,169 @@ +.TH SHERMANS-AQUARIUM "1" "March 2005" "shermans 3.0.1" "User Commands" +.SH NAME +shermans \- aquarium screensaver +.SH SYNOPSIS +.B sherman +[\fIoptions\fR] +.SH DESCRIPTION + +This is a XscreenSaver "hack" that gives you an aquarium that takes +care of itself. No feed, no cleaning and so on. + +The fishes are done by Jim Toomey, the author of the "Sherman's +Lagoon" comics. See /usr/share/doc/shermans-aquarium/copyright for +more information. + +.SH OPTIONS + +.TP +\fB\-sound\fR +Enable sound support +.TP +\fB\-soundprg\fR +External command used to play sounds +.TP +\fB\-ogg\fR +Enable OGG support + +.TP +\fB\-seafloor\fR +Show sea floor +.TP +\fB\-plants\fR # +Number of plants +.TP +\fB\-plantscale\fR # +Scale of plants +.TP +\fB\-bottomanimals\fR # +Number of bottom animals + +.TP +\fB\-bg_solid\fR +Solid background color +.TP +\fB\-bg_shaded\fR +Shaded background +.TP +\fB\-bg_wateralike\fR +Water alike background +.TP +\fB\-bg_image\fR +Set user specified image as background +.TP +\fB\-bg_image_file\fR +Set image to be used as background + +.TP +\fB\-lcr\fR # +Lower color RGB red value +.TP +\fB\-lcg\fR # +Lower color RGB green value +.TP +\fB\-lcb\fR # +Lower color RGB blue value + +.TP +\fB\-ucr\fR # +Upper color RGB red value +.TP +\fB\-ucg\fR # +Upper color RGB green value +.TP +\fB\-ucb\fR # +Upper color RGB blue value + +.TP +\fB\-comics\fR +Show random Sherman's Lagoon comic strips +.TP +\fB\-comics_dir\fR +Set local directory to load comic strips from +.TP +\fB\-comics_delay\fR # +Set delay between comic strips + +.TP +\fB\-random\fR +Random fish, population size given below +.TP +\fB\-selected\fR +User defined population +.TP +\fB\-random_pop\fR # +Population size + +.PP +User defined population +.TP +\fB\-fish1\fR # +.TP +\fB\-fish2\fR # +.TP +\fB\-fish3\fR # +.TP +\fB\-fish4\fR # +.TP +\fB\-fish5\fR # +.TP +\fB\-fish6\fR # +.TP +\fB\-swordfish\fR # +.TP +\fB\-blowfish\fR # +.TP +\fB\-bdweller\fR # +.TP +\fB\-fillmore\fR # +.TP +\fB\-sherman\fR # +.TP +\fB\-megan\fR # +.TP +\fB\-hunter\fR # +.TP +\fB\-prey\fR # +.TP +\fB\-lori\fR # +.TP +\fB\-ernest\fR # +.TP +\fB\-squid\fR # +.TP +\fB\-hawthorne\fR # + +.TP +\fB\-eat\fR +.TP +\fB\-explode\fR +.TP +\fB\-rebirth\fR +.TP +\fB\-scalediff\fR +.TP +\fB\-speed\fR # +.TP +\fB\-scale\fR # +.TP +\fB\-huntera\fR # +.TP +\fB\-sworda\fR # +.TP +\fB\-window-id\fR # +.TP +\fB\-root\fR +.TP +\fB\-bubble\fR # +.TP +\fB\-desktop\fR + + +.SH AUTHOR +\fBSherman's aquarium\fR was written by Jonas Aaberg. See +/usr/share/doc/shermans-aquarium/AUTHORS for other contributors. +.PP +This manual page was written by Jose M. Moya , for +the Debian GNU/Linux system (but may be used by others). +.SH "SEE ALSO" +/usr/share/doc/shermans-aquarium/* diff --git a/sherman-aquarium/debian/shermans_applet.1 b/sherman-aquarium/debian/shermans_applet.1 new file mode 100644 index 0000000..13411ed --- /dev/null +++ b/sherman-aquarium/debian/shermans_applet.1 @@ -0,0 +1,109 @@ +.TH SHERMANS-AQUARIUM "1" "March 2005" "shermans_applet 3.0.1" "User Commands" +.SH NAME +shermans_applet \- dockapp/wmapplet and Gnome panel applet + +.SH SYNOPSIS +.B shermans_applet +[\fIOPTION\fR...] +.SH DESCRIPTION +.TP +\fB\-\-load\-modules\fR=\fIMODULE1\fR,MODULE2,... +Dynamic modules to load +.PP +Help options +.TP +\-?, \fB\-\-help\fR +Show this help message +.TP +\fB\-\-usage\fR +Display brief usage message +.PP +GTK+ +.TP +\fB\-\-gdk\-debug\fR=\fIFLAGS\fR +Gdk debugging flags to set +.TP +\fB\-\-gdk\-no\-debug\fR=\fIFLAGS\fR +Gdk debugging flags to unset +.TP +\fB\-\-display\fR=\fIDISPLAY\fR +X display to use +.TP +\fB\-\-screen\fR=\fISCREEN\fR +X screen to use +.TP +\fB\-\-sync\fR +Make X calls synchronous +.TP +\fB\-\-name\fR=\fINAME\fR +Program name as used by the window +manager +.TP +\fB\-\-class\fR=\fICLASS\fR +Program class as used by the window +manager +.TP +\fB\-\-gtk\-debug\fR=\fIFLAGS\fR +Gtk+ debugging flags to set +.TP +\fB\-\-gtk\-no\-debug\fR=\fIFLAGS\fR +Gtk+ debugging flags to unset +.TP +\fB\-\-g\-fatal\-warnings\fR +Make all warnings fatal +.TP +\fB\-\-gtk\-module\fR=\fIMODULE\fR +Load an additional Gtk module +.PP +Bonobo activation Support +.TP +\fB\-\-oaf\-ior\-fd\fR=\fIFD\fR +File descriptor to print IOR on +.TP +\fB\-\-oaf\-activate\-iid\fR=\fIIID\fR +IID to activate +.TP +\fB\-\-oaf\-private\fR +Prevent registering of server with OAF +.PP +GNOME GConf Support +.PP +GNOME Library +.TP +\fB\-\-disable\-sound\fR +Disable sound server usage +.TP +\fB\-\-enable\-sound\fR +Enable sound server usage +.TP +\fB\-\-espeaker\fR=\fIHOSTNAME\fR:PORT +Host:port on which the sound server +to use is running +.TP +\fB\-\-version\fR +2.8.1 +.PP +Session management +.TP +\fB\-\-sm\-client\-id\fR=\fIID\fR +Specify session management ID +.TP +\fB\-\-sm\-config\-prefix\fR=\fIPREFIX\fR +Specify prefix of saved configuration +.TP +\fB\-\-sm\-disable\fR +Disable connection to session manager +.PP +GNOME GUI Library +.TP +\fB\-\-disable\-crash\-dialog\fR +Disable Crash Dialog + +.SH AUTHOR +\fBSherman's aquarium\fR was written by Jonas Aaberg. See +/usr/share/doc/shermans-aquarium/AUTHORS for other contributors. +.PP +This manual page was written by Jose M. Moya , for +the Debian GNU/Linux system (but may be used by others). +.SH "SEE ALSO" +/usr/share/doc/shermans-aquarium/* diff --git a/sherman-aquarium/debian/watch b/sherman-aquarium/debian/watch new file mode 100644 index 0000000..4d46935 --- /dev/null +++ b/sherman-aquarium/debian/watch @@ -0,0 +1,3 @@ +version=3 +http://aquariumapplet.sourceforge.net/download.html \ + http://prdownloads.sourceforge.net/aquariumapplet/shermans_aquarium-(.*)\.tar\.bz2\?download diff --git a/sherman-aquarium/shermans.xml b/sherman-aquarium/shermans.xml new file mode 100644 index 0000000..0fc5abb --- /dev/null +++ b/sherman-aquarium/shermans.xml @@ -0,0 +1,121 @@ + + + + + + +
+ + +
+ +
+ + + +
+ + + + + + + +
+ + + +
+ +
+ + + +
+ + + + + + + + + +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +<_description> +This is a screensaver is an aquarium featuring the +characters from the awesome comic Sherman's Lagoon by +Jim Toomey. + +Sherman's aquarium website: http://aquariumapplet.sourceforge.net + + + +
\ No newline at end of file diff --git a/sherman-aquarium/shermans/Makefile b/sherman-aquarium/shermans/Makefile new file mode 100644 index 0000000..6ec29dd --- /dev/null +++ b/sherman-aquarium/shermans/Makefile @@ -0,0 +1,101 @@ + +# +# Makefile for Sherman's aquarium +# + +CC = cc + +PREFIX = /usr +GNOMEDIR = /usr + +INSTALL_PATH=$(DESTDIR)$(GNOMEDIR) + +# Setting up the CFLAGS and LDFLAGS variables +CFLAGS += -Wall -Wno-strict-aliasing -O3 -DIMAGE_PATH=\"/usr/share/pixmaps/shermans\" -DGAI -pthread -DORBIT2=1 -I/usr/include/gtk-2.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/panel-2.0 -I/usr/include/gtkglext-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/libgnomeui-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/libxml2 -I/usr/include/gail-1.0 -I/usr/lib/gtkglext-1.0/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 +LDFLAGS_GAI = $(LDFLAGS) -pthread -Wl,--export-dynamic -L/usr/lib/lib -lgai -lpangoft2-1.0 -lpanel-applet-2 -lgtkglext-x11-1.0 -lgnomeui-2 -lbonoboui-2 -lgnomevfs-2 -lgconf-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lbonobo-2 -lbonobo-activation -lORBit-2 -lgthread-2.0 -lrt -lgdkglext-x11-1.0 -lGLU -lGL -lXmu -lXt -lSM -lICE -lgtk-x11-2.0 -lpangox-1.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 +LDFLAGS_SDL = $(LDFLAGS) -L/usr/lib -lSDL -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 + +OBJS = fish.o background.o bubble.o draw.o bottom.o soundeffects.o images.o +OBJS_GAI = settings.o pref.o date.o clock.o matrix.o over.o thermometer.o leds.o aquarium.o tetris.o plasma.o status_linux26.o +OBJS_SDL = screensaver.o grabscreen.o + +.PHONY: all install clean shermans_applet shermans install-images install_applet install_screensaver + +all: shermans_applet shermans + +shermans_applet: $(OBJS_GAI) $(OBJS) + $(CC) -o shermans_applet $(OBJS) $(OBJS_GAI) $(LDFLAGS_GAI) + + +shermans: $(OBJS) $(OBJS_SDL) + $(CC) -o shermans $(OBJS) $(OBJS_SDL) $(LDFLAGS_SDL) + +install: shermans_applet shermans install-images install_applet install_screensaver + +install_applet: install-gnome + install -d $(INSTALL_PATH)/bin + install -m 755 shermans_applet $(INSTALL_PATH)/bin + install -d $(INSTALL_PATH)/share/pixmaps/ + install -m 644 ../shermans_icon.png $(INSTALL_PATH)/share/pixmaps +install_screensaver: shermans + install -d $(INSTALL_PATH)/bin + install -m 755 shermans $(INSTALL_PATH)/bin + install -d $(INSTALL_PATH)/share/xscreensaver/config + install -m 644 ../shermans.xml $(INSTALL_PATH)/share/xscreensaver/config + +install-gnome: + install -d $(INSTALL_PATH)/lib/bonobo/servers/ + install -m 644 ../GNOME_shermans_appletApplet.server $(INSTALL_PATH)/lib/bonobo/servers/GNOME_shermans_appletApplet.server + + +install-images: + mkdir -p $(INSTALL_PATH)/share/pixmaps/shermans + cp -r ../aquarium/* $(INSTALL_PATH)/share/pixmaps/shermans/ + +install-rox: + mkdir -p "$(DESTDIR)/Sherman's aquarium" + rm -f "$(DESTDIR)/Sherman's aquarium/.DirIcon" + ln -s $(INSTALL_PATH)/share/pixmaps/shermans_icon.png "$(DESTDIR)/Sherman's aquarium/.DirIcon" + install -m 755 AppRun "$(DESTDIR)/Sherman's aquarium" + rm -f "$(DESTDIR)/Sherman's aquarium/AppletRun" + ln -s "/Sherman's aquarium/AppRun" "$(DESTDIR)/Sherman's aquarium/AppletRun" + rm -f "$(DESTDIR)/Sherman's aquarium/shermans_applet" + ln -s $(INSTALL_PATH)/bin/shermans_applet "$(DESTDIR)/Sherman's aquarium/shermans_applet" + install -m 644 AppInfo.xml "$(DESTDIR)/Sherman's aquarium" +clean: + rm -rf *.o .xvpics *~ shermans_applet shermans + +# Dependencies: + +aquarium.h: defines.h +aquarium.o: aquarium.c aquarium.h draw.h settings.h \ + clock.h date.h bubble.h over.h leds.h thermometer.h fish.h background.h xmms_sn.h bottom.h \ + pref.h ../config.h +background.o: background.c aquarium.h draw.h grabscreen.h background.h ../config.h +images.o: images.c aquarium.h ../config.h +screensaver.o: screensaver.c bottom.h bubble.h aquarium.h background.h fish.h soundeffects.h ../config.h +bottom.o: bottom.c aquarium.h draw.h bottom.h fish.h ../config.h +bubble.o: bubble.c bubble.h aquarium.h draw.h soundeffects.h ../config.h +clock.o: clock.c clock.h draw.h aquarium.h ../config.h +date.o: date.c date.h aquarium.h draw.h ../config.h + +draw.o: draw.c draw.h aquarium.h ../config.h +fish.o: fish.c fish.h draw.h aquarium.h soundeffects.h ../config.h +grabscreen.o: grabscreen.c grabscreen.h ../config.h + +leds.o: leds.c leds.h draw.h aquarium.h ../config.h +matrix.o: matrix.c matrix.h draw.h over.h aquarium.h ../config.h +over.o: over.c over.h aquarium.h draw.h matrix.h plasma.h tetris.h ../config.h +plasma.o: plasma.c plasma.h aquarium.h over.h ../config.h +pref.o: pref.c pref.h clock.h date.h background.h soundeffects.h bottom.h bubble.h fish.h over.h \ + leds.h thermometer.h xmms_sn.h ../config.h +settings.o: settings.c settings.h aquarium.h fish.h bubble.h date.h clock.h background.h over.h \ + leds.h bottom.h xmms_sn.h matrix.h plasma.h tetris.h ../config.h +soundeffects.o: soundeffects.c soundeffects.h aquarium.h settings.h ../config.h +status_linux24.o: status_linux24.c status_linux.h status.h defines.h ../config.h +status_linux26.o: status_linux26.c status_linux.h status.h defines.h ../config.h +status_darwin.o:status_darwin.c status_darwin.h status.h defines.h ../config.h +status_freebsd.o:status_freebsd.c status_freebsd.h status.h defines.h ../config.h +tetris.o: tetris.c tetris.h aquarium.h over.h settings.h ../config.h +thermometer.o: thermometer.c thermometer.h aquarium.h draw.h status.h ../config.h +xmms_sn.o: xmms_sn.c xmms_sn.h aquarium.h draw.h ../config.h diff --git a/sherman-aquarium/shermans/Makefile.in b/sherman-aquarium/shermans/Makefile.in new file mode 100644 index 0000000..cb1c0c7 --- /dev/null +++ b/sherman-aquarium/shermans/Makefile.in @@ -0,0 +1,101 @@ + +# +# Makefile for Sherman's aquarium +# + +CC = @CC@ + +PREFIX = @prefix@ +GNOMEDIR = @GNOMEDIR@ + +INSTALL_PATH=$(DESTDIR)@INSTALL_PATH@ + +# Setting up the CFLAGS and LDFLAGS variables +CFLAGS += -Wall -Wno-strict-aliasing -O3 -DIMAGE_PATH=\"@APPLET_IMAGE_PATH@\" @DGAI@ @GAI_CFLAGS@ @XMMS_CFLAGS@ @SDL_CFLAGS@ @GTK_CFLAGS@ +LDFLAGS_GAI = $(LDFLAGS) @GAI_LIBS@ @XMMS_LIBS@ @SYSTEM_SPECIFIC_LIBS@ +LDFLAGS_SDL = $(LDFLAGS) @SDL_LIBS@ @SYSTEM_SPECIFIC_LIBS@ @GTK_LIBS@ + +OBJS = fish.o background.o bubble.o draw.o bottom.o soundeffects.o images.o +OBJS_GAI = settings.o pref.o date.o clock.o matrix.o over.o thermometer.o leds.o aquarium.o tetris.o plasma.o @XMMS_OBJ@ @STATUS@ +OBJS_SDL = screensaver.o grabscreen.o + +.PHONY: all install clean @APPLET@ @SCREENSAVER@ @INSTALL_IMAGES@ @INSTALL_APPLET@ @INSTALL_SCREENSAVER@ + +all: @APPLET@ @SCREENSAVER@ + +shermans_applet: $(OBJS_GAI) $(OBJS) + $(CC) -o shermans_applet $(OBJS) $(OBJS_GAI) $(LDFLAGS_GAI) + + +shermans: $(OBJS) $(OBJS_SDL) + $(CC) -o shermans $(OBJS) $(OBJS_SDL) $(LDFLAGS_SDL) + +install: @APPLET@ @SCREENSAVER@ @INSTALL_IMAGES@ @INSTALL_APPLET@ @INSTALL_SCREENSAVER@ + +install_applet: @INSTALL_GNOME@ + install -d $(INSTALL_PATH)/bin + install -m 755 @APPLET_NAME@ $(INSTALL_PATH)/bin + install -d $(INSTALL_PATH)/share/pixmaps/ + install -m 644 ../@APPLET_NAME_ICON@ $(INSTALL_PATH)/share/pixmaps +install_screensaver: shermans + install -d $(INSTALL_PATH)/bin + install -m 755 @SCREENSAVER@ $(INSTALL_PATH)/bin + install -d $(INSTALL_PATH)/share/xscreensaver/config + install -m 644 ../shermans.xml $(INSTALL_PATH)/share/xscreensaver/config + +install-gnome: + install -d $(INSTALL_PATH)/lib/bonobo/servers/ + install -m 644 ../GNOME_@APPLET_NAME@Applet.server $(INSTALL_PATH)/lib/bonobo/servers/GNOME_@APPLET_NAME@Applet.server + + +install-images: + mkdir -p $(INSTALL_PATH)/share/pixmaps/shermans + cp -r ../@APPLET_IMAGES@ $(INSTALL_PATH)/share/pixmaps/shermans/ + +install-rox: + mkdir -p "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@" + rm -f "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@/.DirIcon" + ln -s $(INSTALL_PATH)/share/pixmaps/@APPLET_NAME_ICON@ "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@/.DirIcon" + install -m 755 AppRun "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@" + rm -f "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@/AppletRun" + ln -s "@ROX_PATH@/@APPLET_NICE_NAME@/AppRun" "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@/AppletRun" + rm -f "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@/@APPLET_NAME@" + ln -s $(INSTALL_PATH)/bin/@APPLET_NAME@ "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@/@APPLET_NAME@" + install -m 644 AppInfo.xml "$(DESTDIR)@ROX_PATH@/@APPLET_NICE_NAME@" +clean: + rm -rf *.o .xvpics *~ @APPLET@ @SCREENSAVER@ + +# Dependencies: + +aquarium.h: defines.h +aquarium.o: aquarium.c aquarium.h draw.h settings.h \ + clock.h date.h bubble.h over.h leds.h thermometer.h fish.h background.h xmms_sn.h bottom.h \ + pref.h ../config.h +background.o: background.c aquarium.h draw.h grabscreen.h background.h ../config.h +images.o: images.c aquarium.h ../config.h +screensaver.o: screensaver.c bottom.h bubble.h aquarium.h background.h fish.h soundeffects.h ../config.h +bottom.o: bottom.c aquarium.h draw.h bottom.h fish.h ../config.h +bubble.o: bubble.c bubble.h aquarium.h draw.h soundeffects.h ../config.h +clock.o: clock.c clock.h draw.h aquarium.h ../config.h +date.o: date.c date.h aquarium.h draw.h ../config.h + +draw.o: draw.c draw.h aquarium.h ../config.h +fish.o: fish.c fish.h draw.h aquarium.h soundeffects.h ../config.h +grabscreen.o: grabscreen.c grabscreen.h ../config.h + +leds.o: leds.c leds.h draw.h aquarium.h ../config.h +matrix.o: matrix.c matrix.h draw.h over.h aquarium.h ../config.h +over.o: over.c over.h aquarium.h draw.h matrix.h plasma.h tetris.h ../config.h +plasma.o: plasma.c plasma.h aquarium.h over.h ../config.h +pref.o: pref.c pref.h clock.h date.h background.h soundeffects.h bottom.h bubble.h fish.h over.h \ + leds.h thermometer.h xmms_sn.h ../config.h +settings.o: settings.c settings.h aquarium.h fish.h bubble.h date.h clock.h background.h over.h \ + leds.h bottom.h xmms_sn.h matrix.h plasma.h tetris.h ../config.h +soundeffects.o: soundeffects.c soundeffects.h aquarium.h settings.h ../config.h +status_linux24.o: status_linux24.c status_linux.h status.h defines.h ../config.h +status_linux26.o: status_linux26.c status_linux.h status.h defines.h ../config.h +status_darwin.o:status_darwin.c status_darwin.h status.h defines.h ../config.h +status_freebsd.o:status_freebsd.c status_freebsd.h status.h defines.h ../config.h +tetris.o: tetris.c tetris.h aquarium.h over.h settings.h ../config.h +thermometer.o: thermometer.c thermometer.h aquarium.h draw.h status.h ../config.h +xmms_sn.o: xmms_sn.c xmms_sn.h aquarium.h draw.h ../config.h diff --git a/sherman-aquarium/shermans/aquarium.c b/sherman-aquarium/shermans/aquarium.c new file mode 100644 index 0000000..d161fdf --- /dev/null +++ b/sherman-aquarium/shermans/aquarium.c @@ -0,0 +1,485 @@ +/* + * Sherman's aquarium - Applet v3.0.1 + * + * (Formely known as aquarium applet.) + * + * Copyright (C) 2002-2003 Jonas Aaberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You did not receive a copy of the GNU General Public License along with + * this program; chances are, you already have at least 10 copies of this + * license somewhere on your system. If you still want it, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * This applet was once based upon timecop's fishmon, + * but not much is now left of his code. (draw.c is mainly his code) + * + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define GAI_APPLET_DEFINES +#include "../config.h" +#include "aquarium.h" +#include "draw.h" +#include "settings.h" + +/* Features */ +#include "clock.h" +#include "date.h" +#include "bubble.h" +#include "over.h" +#include "leds.h" +#include "thermometer.h" +#include "fish.h" +#include "background.h" +#ifdef XMMS +#include "xmms_sn.h" +#endif +#include "soundeffects.h" +#include "status.h" +#include "bottom.h" +#include "pref.h" + + +/* keeps track of mouse focus */ +static int over_ruled; +static AquariumData ad; +static General_settings general_settings; + +/* Only there for screensaver compability */ +int fullscreen = 0, window_id = -1; + + +static void aquarium_enter(gpointer d) +{ + ad.proximity = 1; + fish_enter(); +} + +static void aquarium_keypress(int key, gpointer d) +{ + if(ad.proximity) + over_keypress(key); +} + +static void aquarium_joystick(GaiFlagsJoystick flags, gpointer d) +{ + if(ad.proximity) + over_joystick(flags); +} + +static void aquarium_leave(gpointer d) +{ + ad.proximity = 0; + fish_leave(); +} + +static void mouse_action(int flag, char *option) +{ + if(flag == MOUSE_OFF) + return; + + if(flag == MOUSE_RUN){ + gai_exec(option); + return; + } +} + +static void aquarium_mouseclick_left(int x, int y, gpointer d) +{ + mouse_action(general_settings.mouse_left, general_settings.mouse_left_option); +} + +static void aquarium_mouseclick_middle(int x, int y, gpointer d) +{ + mouse_action(general_settings.mouse_middle, general_settings.mouse_middle_option); +} + +static void aquarium_mouseclick_updown(int dir, gpointer d) +{ + if(dir == GDK_SCROLL_UP) + mouse_action(general_settings.mouse_up, general_settings.mouse_up_option); + if(dir == GDK_SCROLL_DOWN) + mouse_action(general_settings.mouse_down, general_settings.mouse_down_option); +} + + + +void aquarium_change(int orient, int new_w, int new_h, gpointer d) +{ + static int old_xmax = -1, old_ymax = -1; + ad.dont_update = 1; + + ad.ymin = gai_scale(YMIN); + ad.xmin = gai_scale(XMIN); + + if(gai_applet_mode() == GAI_DOCKAPP){ + if(general_settings.ratio_width > general_settings.ratio_height){ + ad.xmax = gai_get_size()*general_settings.ratio_width/general_settings.ratio_height - 2*ad.xmin; + ad.ymax = gai_get_size() - 2*ad.ymin; + } else { + ad.xmax = gai_get_size() - 2*ad.xmin; + ad.ymax = gai_get_size()*general_settings.ratio_height/general_settings.ratio_width - 2*ad.ymin; + } + if(old_ymax != ad.ymax || old_xmax != ad.xmax) + gai_background_set(ad.xmax+2*ad.xmin, ad.ymax+2*ad.ymin, GAI_BACKGROUND_MAX_SIZE_NONE, TRUE); + } else { + if(orient == GAI_HORIZONTAL){ + if(general_settings.ratio_width > general_settings.ratio_height){ + ad.xmax = gai_get_size()*general_settings.ratio_width/general_settings.ratio_height - 2*ad.xmin; + ad.ymax = gai_get_size() - 2*ad.ymin; + } else { + ad.ymax = gai_get_size() - 2*ad.ymin; + ad.xmax = gai_get_size()*general_settings.ratio_height/general_settings.ratio_width - 2*ad.xmin; + } + if(old_ymax != ad.ymax || old_xmax != ad.xmax) + gai_background_set(ad.xmax+2*ad.xmin, ad.ymax+2*ad.ymin, GAI_BACKGROUND_MAX_SIZE_NONE, TRUE); + } else { + /* Vertical */ + if(general_settings.ratio_width > general_settings.ratio_height){ + ad.ymax = gai_get_size() * general_settings.ratio_width/general_settings.ratio_height - 2*ad.ymin; + ad.xmax = gai_get_size() - 2*ad.xmin; + } else { + ad.xmax = gai_get_size() - 2*ad.xmin; + ad.ymax = gai_get_size()*general_settings.ratio_height/general_settings.ratio_width - 2*ad.ymin; + } + if(old_ymax != ad.ymax || old_xmax != ad.xmax) + gai_background_set(ad.ymax+2*ad.ymin,ad.xmax+2*ad.xmin, GAI_BACKGROUND_MAX_SIZE_NONE, TRUE); + } + +} + old_ymax = ad.ymax; + old_xmax = ad.xmax; + + ad.virtual_aquarium_x = ad.xmax + 2 * VIRTUAL_AQUARIUM_DX; + ad.virtual_aquarium_y = ad.ymax + 2 * VIRTUAL_AQUARIUM_DX; + + g_free(ad.rgb); + g_free(ad.bgr); + + ad.rgb = g_malloc0((ad.xmax + 2) * (ad.ymax + 2) * 3); + ad.bgr = g_malloc0((ad.xmax + 2) * (ad.ymax + 2) * 3); + + background_init(); + bottom_init(); + + ad.dont_update = 0; + +} + + + +void prepare_graphics(void) +{ + + clock_init(); + date_init(); + + bubble_init(); + + thermometer_init(); + + leds_init(); +#ifdef XMMS + xmms_sn_init(); +#endif + fish_init(); + + background_init(); + bottom_init(); + + status_init(); + over_init(); + +} + + +void aquarium_update(gpointer d) +{ + static gboolean inited = 0; + /* If this function is called during reload of images, + just quit and wait until that is done. */ + + if(ad.dont_update) + return; + + if(!inited){ + inited = TRUE; + if(gai_applet_mode() == GAI_DOCKAPP){ + if(ad.xmax < ad.ymax){ + aquarium_change(gai_get_orient(), + gai_get_size(), + gai_get_size()*general_settings.ratio_height/general_settings.ratio_width, + NULL); + } else { + aquarium_change(gai_get_orient(), + gai_get_size()*general_settings.ratio_width/general_settings.ratio_height, + gai_get_size(), + NULL); + } + } else { + if(gai_get_orient() == GAI_HORIZONTAL){ + aquarium_change(gai_get_orient(), + gai_get_size(), + gai_get_size()*general_settings.ratio_height/general_settings.ratio_width, + NULL); + + } + else { + aquarium_change(gai_get_orient(), + gai_get_size()*general_settings.ratio_width/general_settings.ratio_height, + gai_get_size(), + NULL); + } + } + } + + if(ad.drawingarea == NULL) + ad.drawingarea = gai_get_drawingarea(); + + memcpy(ad.rgb, ad.bgr, ad.ymax * ad.xmax * 3); + + /* If the mouse over function is completly domiating, + then, only call the mouse over function */ + + if(!over_ruled) { + leds_update(DRAW_BEFORE); + thermometer_update(DRAW_BEFORE); + clock_update(DRAW_BEFORE); +#ifdef XMMS + xmms_sn_update(DRAW_BEFORE); +#endif + date_update(DRAW_BEFORE); + + + fish_update(); + bubble_update(); + + + thermometer_update(DRAW_AFTER); + clock_update(DRAW_AFTER); +#ifdef XMMS + xmms_sn_update(DRAW_AFTER); +#endif + date_update(DRAW_AFTER); + leds_update(DRAW_AFTER); + } + + over_ruled = over_update(ad.proximity); + + ad.gc = gai_get_gc(); + + /* Draw it, not using gai */ + gdk_draw_rgb_image(ad.drawingarea->window, ad.gc, ad.xmin, ad.ymin, ad.xmax, ad.ymax, + GDK_RGB_DITHER_NONE,ad.rgb, ad.xmax*3); + gdk_flush(); +} + + + +void aquarium_free_all() +{ + + background_exit(); + clock_exit(); + date_exit(); + over_exit(); +#ifdef XMMS + xmms_sn_exit(); +#endif + thermometer_exit(); + status_exit(); + bubble_exit(); + fish_exit(); + bottom_exit(); + + over_exit(); + +} + +void aquarium_reload_all() +{ + background_init(); + clock_init(); + date_init(); + status_init(); +#ifdef XMMS + xmms_sn_init(); +#endif + thermometer_init(); + bubble_init(); + /* We are loading fishes before aquarium_change gets activated, since it needs to call bottom and bg */ + // printf("fish init\n"); + //fish_init(); + bottom_init(); /* Must be after fish, because it draw bottom creatures. */ + over_init(); + +} + +/* This function (re)sets all the global variables to their default */ +/* Some globals, don't have a default, those are not set ofcourse */ + +void init(void) +{ + + memset(&ad, 0, sizeof(AquariumData)); + + ad.rnd = g_rand_new(); + + clock_load_settings(); + date_load_settings(); +#ifdef XMMS + xmms_sn_load_settings(); +#endif + + bubble_load_settings(); + + thermometer_load_settings(); + over_load_settings(); + leds_load_settings(); + + + background_load_settings(); + bottom_load_settings(); + + fish_load_settings(); + general_load_settings(); + sound_load_settings(); + tetris_load_settings(); + + /* Default at start up is horizontal gnome-panel */ + ad.ymax = YMAX; + ad.xmax = XMAX; + + if(general_settings.ratio_width > general_settings.ratio_height){ + ad.xmax = (XMAX+2*XMIN)*general_settings.ratio_width/general_settings.ratio_height - 2*XMIN; + } else { + ad.ymax = (YMAX+2*YMIN)*general_settings.ratio_height/general_settings.ratio_width - 2*YMIN; + } + + ad.ymin = YMIN; + ad.xmin = XMIN; + + ad.virtual_aquarium_x = XMAX + 2 * VIRTUAL_AQUARIUM_DX; + ad.virtual_aquarium_y = YMAX + 2 * VIRTUAL_AQUARIUM_DY; + ad.viewpoint_start_x = VIEWPOINT_START_X; + ad.viewpoint_start_y = VIEWPOINT_START_Y; + + ad.proximity = 0; + over_ruled = 0; + + ad.posx=ad.posy=-1; + + ad.gc = NULL; + ad.drawingarea = NULL; + + ad.special_action = 0; +} + + + + +int main(int argc, char **argv) +{ + + gai_init2(&applet_defines ,&argc, &argv); + + + /* Load saved settings and reset others */ + init(); + + ad.rgb = g_malloc0((ad.xmax + 2) * (ad.ymax + 2) * 3); + ad.bgr = g_malloc0((ad.xmax + 2) * (ad.ymax + 2) * 3); + + prepare_graphics(); + + pref_init(); + + gai_background_set(ad.xmax+2*ad.xmin, ad.ymax+2*ad.ymin, GAI_BACKGROUND_MAX_SIZE_NONE, TRUE); + + gai_preferences2("Sherman's aquarium - Preferences", + shermans_pref, + "You cannot do anything dangerous with this applet,\n" + "so just play around and look at what the applet does.\n" + "If you still have some questions, feel free to mail me, cja@gmx.net.\n\n" + "Thanks for trying Sherman's aquarium!\n\n" + "http://aquariumapplet.sourceforge.net", + (GaiCallback0 *)pref_restart, NULL); + + /* 20 frames per second */ + gai_signal_on_update((GaiCallback0 *)aquarium_update, 1000/50, NULL); + gai_signal_on_enter((GaiCallback0 *)aquarium_enter, NULL); + gai_signal_on_leave((GaiCallback0 *)aquarium_leave, NULL); + gai_signal_on_change((GaiCallback3 *)aquarium_change, NULL); + gai_signal_on_keypress((GaiCallback1 *)aquarium_keypress, NULL); + gai_signal_on_joystick((GaiCallback1 *)aquarium_joystick, NULL); + + gai_signal_on_mouse_button_click((GaiCallback2 *)aquarium_mouseclick_left, GAI_MOUSE_BUTTON_1, NULL); + gai_signal_on_mouse_button_click((GaiCallback2 *)aquarium_mouseclick_middle, GAI_MOUSE_BUTTON_2, NULL); + gai_signal_on_scroll_buttons((GaiCallback1 *)aquarium_mouseclick_updown, NULL); + + + gai_start(); + return 0; +} + + +AquariumData *aquarium_get_settings_ptr(void) +{ + return &ad; +} + +unsigned char *aquarium_install_path(void) +{ + return applet_defines.image_path; +} + +General_settings *general_get_settings_ptr(void) +{ + return &general_settings; +} + + +void aquarium_draw_image(int x, int y, int idx, int rev, SA_Image *image) +{ + draw_image(x, y, idx, rev, image); +} + +void aquarium_draw_pic_alpha(SA_Image *image, int w, int h, int x, int y, int idx, int alpha) +{ + draw_pic_alpha(image->image, w, h, x, y, idx, alpha); +} + + +void aquarium_clean_image(int x, int y, int w, int h) +{ + +} + +/* This is just to keep background.c happy */ +void grab_screen_image (Screen *s, Window w) +{ + +} diff --git a/sherman-aquarium/shermans/aquarium.h b/sherman-aquarium/shermans/aquarium.h new file mode 100644 index 0000000..ac0a7c1 --- /dev/null +++ b/sherman-aquarium/shermans/aquarium.h @@ -0,0 +1,109 @@ + +/* Main header file for Sherman's aquarium */ +#ifndef AQUARIUM_H +#define AQUARIUM_H + + +#include +#include +#include +#include +#include "defines.h" + +#ifdef GNOME +#include +#include +#endif + + +typedef struct { + unsigned char *image; + unsigned char *rev; + int width; + int height; + int frames; + int full_height; + int rowstride; + GdkPixbuf *pixbuf; +} SA_Image; + +/* main dockapp info structure. windows, buffers, etc */ +typedef struct { + + int xmax; + int ymax; + int xmin; + int ymin; + /* int windowsize_x; + int windowsize_y;*/ + int virtual_aquarium_x; + int virtual_aquarium_y; + int viewpoint_start_x; + int viewpoint_start_y; + + int posx; + int posy; + int proximity; + + + GdkWindow *win; /* main window */ + GdkWindow *iconwin; + + + GtkWidget *about_box; + GtkWidget *applet; + GtkWidget *drawingarea; + int oldwidth; + int oldheight; + int oldbg; + + GdkGC *gc; /* drawing GC */ + + GRand *rnd; /* Random number instance */ + + /* main image buffer */ + unsigned char *rgb; + + /* back buffer - stores things we dont want to redraw all the time */ + unsigned char *bgr; + int special_action; + int dont_update; + +} AquariumData; + + +#define MOUSE_OFF 0 +#define MOUSE_RUN 1 + +typedef struct { + int ratio_width; + int ratio_height; + + int mouse_left, mouse_middle, mouse_down, mouse_up; + char *mouse_left_option, *mouse_middle_option, *mouse_up_option, *mouse_down_option; + +} General_settings; + +/* Declare functions */ + +void aquarium_update(gpointer); +void aquarium_change(int, int, int, gpointer); +void prepare_graphics(void); + +void aquarium_reload_all(void); +void aquarium_free_all(void); +void aquarium_draw_image(int, int, int, int, SA_Image *); +void aquarium_clean_image(int, int, int, int); +void aquarium_draw_pic_alpha(SA_Image *, int, int, int, int, int, int); +unsigned char *aquarium_install_path(void); + +/* Returns a pointer to the static struct in aquarium.c */ +AquariumData *aquarium_get_settings_ptr(void); +General_settings *general_get_settings_ptr(void); + +void load_image(char *, SA_Image *,int); +void load_image_n_scale(char *, SA_Image *,int, int); + +unsigned int checksum(unsigned char *, int); + +#endif diff --git a/sherman-aquarium/shermans/background.c b/sherman-aquarium/shermans/background.c new file mode 100644 index 0000000..9285838 --- /dev/null +++ b/sherman-aquarium/shermans/background.c @@ -0,0 +1,197 @@ + +#include +#include + +#ifdef GAI +#include +#else + +#include + +typedef struct { + unsigned char r,g,b,alpha; +} GaiColor; + +void gai_display_error_continue(const char *); +GdkPixbuf *gai_load_image(const char *); + +#endif + +#include "aquarium.h" +#include "draw.h" +#include "grabscreen.h" +#include "background.h" + + +static Background_settings background_settings; +static AquariumData *ad; + +Background_settings *background_get_settings_ptr(void) +{ + return &background_settings; +} + +static void background_prepare_solid(unsigned char r, unsigned char g, unsigned b) +{ + int i,j,t; + + for (i = 0; i < ad->ymax; i++) { + for (j = 0; j < ad->xmax; j++) { + t = (i * ad->xmax * 3) + j * 3; + ad->bgr[t + 0] = r; + ad->bgr[t + 1] = g; + ad->bgr[t + 2] = b; + } + } + +} + +static void background_prepare_shaded(unsigned char r1, unsigned char g1, unsigned b1, + unsigned char r2, unsigned char g2, unsigned b2) +{ + int i,j,t; + float d1,d2,d3; + + d1 = ((float)r2 - (float)r1) / (float) ad->ymax; + d2 = ((float)g2 - (float)g1) / (float) ad->ymax; + d3 = ((float)b2 - (float)b1) / (float) ad->ymax; + + for (i = 0; i < ad->ymax; i++) { + for (j = 0; j < ad->xmax; j++) { + t = (i * ad->xmax * 3) + j * 3; + ad->bgr[t + 0] = (unsigned char)((float)r1 + ((float) i * d1)); + ad->bgr[t + 1] = (unsigned char)((float)g1 + ((float) i * d2)); + ad->bgr[t + 2] = (unsigned char)((float)b1 + ((float) i * d3)); + } + } + +} + + +static void background_prepare_image(char *image_file, int user_choise) +{ + GdkPixbuf *water=NULL, *water2=NULL; + GError *imerr=NULL; + unsigned char *buff; + int i, j, k=0, y, rowstride, alpha; + + if(user_choise){ + water = gdk_pixbuf_new_from_file(image_file, &imerr); + if (water==NULL){ + gai_display_error_continue("Can't load image!\nChanging to default water image background."); + water = gai_load_image("water.png"); + } + } else { + water = gai_load_image("water.png"); + } + + water2 = gdk_pixbuf_scale_simple(water, ad->xmax, ad->ymax, + GDK_INTERP_BILINEAR); + buff = gdk_pixbuf_get_pixels(water2); + + rowstride = gdk_pixbuf_get_rowstride(water2); + alpha = (int)gdk_pixbuf_get_has_alpha(water2); + + for (i = 0; i < ad->ymax; i++) { + y = i * rowstride; + for (j = 0; j < ((ad->xmax * (3+alpha))); j += (3+alpha)) { + ad->bgr[k + 0] = buff[y + j + 0]; + ad->bgr[k + 1] = buff[y + j + 1]; + ad->bgr[k + 2] = buff[y + j + 2]; + k += 3; + } + } + + g_object_unref(water); + g_object_unref(water2); + +} + +static void background_prepare_desktop(void) +{ + int rowstride, alpha, i, j, k=0, y; + unsigned char *buff, *str; + GdkPixbuf *desktop, *tmp_desktop; + GdkWindow *win; + Display *display; + Window xwin; + + win = gdk_get_default_root_window(); + str = getenv("SDL_WINDOWID"); + + if(str == NULL){ + xwin = GDK_WINDOW_XWINDOW(win); + } + else{ + xwin = (Window)atoi(str); + display = XOpenDisplay(NULL); + grab_screen_image(ScreenOfDisplay(display, DefaultScreen(display)), xwin); + } + + + desktop = gdk_pixbuf_get_from_drawable(NULL, + GDK_DRAWABLE(win), + NULL, 0,0,0,0, + gdk_screen_width(), gdk_screen_height()); + + if(gdk_screen_width() != ad->xmax || gdk_screen_height() != ad->ymax){ + tmp_desktop = gdk_pixbuf_scale_simple(desktop, ad->xmax, ad->ymax, + GDK_INTERP_BILINEAR); + g_object_unref(desktop); + desktop = tmp_desktop; + } + + buff = gdk_pixbuf_get_pixels(desktop); + + rowstride = gdk_pixbuf_get_rowstride(desktop); + alpha = (int)gdk_pixbuf_get_has_alpha(desktop); + + for (i = 0; i < ad->ymax; i++) { + y = i * rowstride; + for (j = 0; j < ((ad->xmax * (3+alpha))); j += (3+alpha)) { + ad->bgr[k + 0] = buff[y + j + 0]; + ad->bgr[k + 1] = buff[y + j + 1]; + ad->bgr[k + 2] = buff[y + j + 2]; + k += 3; + } + } + + g_object_unref(desktop); +} + +void background_exit(void) +{ + +} + +void background_init(void) +{ + ad = aquarium_get_settings_ptr(); + + if(background_settings.desktop){ + background_prepare_desktop(); + return; + } + + + if(background_settings.type == BG_SOLID) + background_prepare_solid(background_settings.solid_c.r, + background_settings.solid_c.g, + background_settings.solid_c.b); + + if(background_settings.type == BG_SHADED) + background_prepare_shaded(background_settings.shaded_top_c.r, + background_settings.shaded_top_c.g, + background_settings.shaded_top_c.b, + background_settings.shaded_bot_c.r, + background_settings.shaded_bot_c.g, + background_settings.shaded_bot_c.b); + + if(background_settings.type == BG_IMAGE) + background_prepare_image(background_settings.imagename, 1); + + if(background_settings.type == BG_WATER) + background_prepare_image(NULL,0); + + +} diff --git a/sherman-aquarium/shermans/background.h b/sherman-aquarium/shermans/background.h new file mode 100644 index 0000000..e94dd80 --- /dev/null +++ b/sherman-aquarium/shermans/background.h @@ -0,0 +1,22 @@ +#ifndef BACKGROUND_H +#define BACKGROUND_H + +#define BG_SOLID 0 +#define BG_SHADED 1 +#define BG_WATER 2 +#define BG_IMAGE 3 + + +typedef struct +{ + char *imagename, *imagename_new; + int type; + int desktop; + GaiColor shaded_top_c, shaded_bot_c, solid_c; + +} Background_settings; + +Background_settings *background_get_settings_ptr(void); +void background_init(void); +void background_exit(void); +#endif diff --git a/sherman-aquarium/shermans/bottom.c b/sherman-aquarium/shermans/bottom.c new file mode 100644 index 0000000..c5faac0 --- /dev/null +++ b/sherman-aquarium/shermans/bottom.c @@ -0,0 +1,201 @@ + +#include +#include "aquarium.h" +#include "draw.h" +#include "bottom.h" +#include "fish.h" + +static Bottom_settings bottom_settings; +static AquariumData *ad; + + + +Bottom_settings *bottom_get_settings_ptr(void) +{ + return &bottom_settings; +} + +void bottom_init(void) +{ + SA_Image sea_floor; + SA_Image bottom_stuff; + + Bottom bottom_items[NUMOFBOTTOMITEMS] = { + {"bottom/plant1.png", 0}, + {"bottom/plant2.png", 0}, + {"bottom/plant3.png", 0}, + {"bottom/plant4.png", 0}, + {"bottom/plant5.png", 0}, + {"bottom/plant6.png", 0}, + {"bottom/plant7.png", 0}, + {"bottom/plant9.png", 0}, + {"bottom/plant10.png", 0}, + {"bottom/smallstone1.png", 0}, + {"bottom/smallstone3.png", 0}, + {"bottom/stone1.png", 0}, + {"bottom/stone2.png", 0}, + {"bottom/stone3.png", 0}, + {"bottom/weirdplant.png", 0}, + {"bottom/weirdplant2.png", 0}, + {"bottom/octo1.png", 0}, + {"bottom/bigplant.png", 0} + }; + + char *bottom_image_files[] = { + "bottom/bottom1.png", + "bottom/bottom2.png", + "bottom/bottom3.png", + NULL + }; + + + int start_sea_floor_x, start_sea_floor_y; + + int curr_sea_floor_height; + int i,j,k,l,jj, step_max, current_loc,x=0; + int old_height=0,old_x=0, old_current_loc=0, bx[10], bw[10], nfa; + Fish *fishes; + Fish_settings *fish_settings; + + ad = aquarium_get_settings_ptr(); + + fishes = fish_get_fishes_ptr(); + + fish_settings = fish_get_settings_ptr(); + + + if(!bottom_settings.have_sea_floor) + return; + + i = g_rand_int_range(ad->rnd, 0, NUMBOTTOMIMAGES); + + load_image_n_scale(bottom_image_files[i], &sea_floor, 1, bottom_settings.scale); + + start_sea_floor_x = g_rand_int_range(ad->rnd, 0, sea_floor.width); + + curr_sea_floor_height = sea_floor.height - g_rand_int_range(ad->rnd, 0, sea_floor.height*4/5); + + if(curr_sea_floor_height == 0) + curr_sea_floor_height = 1; + + + start_sea_floor_y = ad->ymax - curr_sea_floor_height; + + + for(i = (start_sea_floor_x - sea_floor.width); i < ad->xmax; i += sea_floor.width) + draw_image_bg(i, start_sea_floor_y, 0, 0, &sea_floor); + + + + /* Number of plants and stones default max 15 */ + + if(bottom_settings.random_plants) + j = g_rand_int_range(ad->rnd, 1, bottom_settings.max_plants+1); + else + j = bottom_settings.max_plants; + + step_max = curr_sea_floor_height / j; + + /* The smallest stone/plant is 32 high */ + current_loc = ad->ymax - curr_sea_floor_height + 10; + //printf("Curr loc: %d %d %d\n", current_loc, ad->ymax, curr_sea_floor_height); + + /* See if we have a bottom dweller and or a hacktorn*/ + nfa=0; + + for(i = 0;i < fish_settings->num_fish; i++){ + if(fishes[i].type == BDWELLER || fishes[i].type == HAWTHORNE){ + + for(jj = 0; jj < 10; jj++){ + if(ad->xmax-fishes[i].width == 0) + x = 0; + else + x = g_rand_int_range(ad->rnd, 0, ad->xmax - fishes[i].width); + + for(l = 0; l < nfa; l++) + if(x > bx[l] && x < (bx[l]+bw[l])) + break; + if(l == nfa) break; + } + /* Do just 10 athempts to place a bottom fish, if not sucessfull, + then try next fish */ + if(jj == 10){ + /* Make sure the fish is outside the picture. */ + fishes[i].tx = 2 * ad->xmax; + fishes[i].y = 0; + continue; + } + + bx[nfa] = x; + bw[nfa] = fishes[i].width; + fishes[i].tx = bx[nfa]; + /* (int)(20*(float)scale/100)*/ + fishes[i].y = current_loc + curr_sea_floor_height / 3 + g_rand_int_range(ad->rnd, 0, curr_sea_floor_height) + ad->viewpoint_start_y - 30; + if(fishes[i].type == BDWELLER) + fishes[i].fast_frame_change = 0.02; + else + fishes[i].fast_frame_change = 0.07; + + fishes[i].speed_mul = 0.0001; + nfa++; + } + } + + + /* Freeing sea floor. Not needed any longer */ + g_object_unref(sea_floor.pixbuf); + + + for(i = 0; i < j; i++){ + k=g_rand_int_range(ad->rnd, 0, NUMOFBOTTOMITEMS); + + + load_image_n_scale(bottom_items[k].image, &bottom_stuff, + 1, (bottom_settings.scale / 2) + (g_rand_int_range(ad->rnd, 0, bottom_settings.scale / 2) * bottom_settings.scale / 100)); + + /* from -15 to ad.xmax+15 */ + jj = 0; + if(nfa != 0){ + for(jj = 0; jj < 10; jj++){ + x = g_rand_int_range(ad->rnd, 0, ad->xmax + 30) - 15; + for(l = 0;l < nfa; l++) + if(x > (bx[l] - bottom_stuff.width) && x < (bx[l] + bw[l])) break; + if(l == nfa) break; + } + + } + else + x = g_rand_int_range(ad->rnd, 0, ad->xmax + 30) - 15; + + /* If we fail to put plants too many times.. */ + if(jj == 10) continue; + + /* Are they too close? */ + if(abs(x - old_x) < bottom_stuff.width) + if((old_current_loc + old_height) > (bottom_stuff.height + current_loc)){ + current_loc = old_current_loc + old_height - bottom_stuff.height + 5; + } + + + draw_image_bg(x, current_loc-bottom_stuff.height + 4, + 0, g_rand_int_range(ad->rnd, 0, 2), + &bottom_stuff); + + old_current_loc = current_loc; + current_loc += g_rand_int_range(ad->rnd, 0, step_max); + + old_height = bottom_stuff.height; + old_x = x; + + g_object_unref(bottom_stuff.pixbuf); + + bottom_stuff.image = NULL; + + } + +} + +void bottom_exit(void) +{ + +} diff --git a/sherman-aquarium/shermans/bottom.h b/sherman-aquarium/shermans/bottom.h new file mode 100644 index 0000000..064bec4 --- /dev/null +++ b/sherman-aquarium/shermans/bottom.h @@ -0,0 +1,41 @@ +#ifndef BOTTOM_H +#define BOTTOM_H + +#define MAXPLANTS 4 + +#define DEFAULT_HAWTHORNE 2 +#define DEFAULT_BDWELLER 2 + +#define BOTTOM_SCALE 30 + +#define NUMBOTTOMIMAGES 3 + +/* Number of plants, stones and none moving bottom things */ +/* Only change if you add new graphics. */ +#define NUMOFBOTTOMITEMS 18 + +#define DEFAULT_BOTTOM_ANIMALS 1 + + + +typedef struct +{ + int have_sea_floor; + int max_plants; + int random_plants; + int scale; + int num_bottom_animals; +} Bottom_settings; + + +typedef struct { + char *image; + int flags; +} Bottom; + + +Bottom_settings *bottom_get_settings_ptr(void); +void bottom_init(void); +void bottom_exit(void); + +#endif diff --git a/sherman-aquarium/shermans/bubble.c b/sherman-aquarium/shermans/bubble.c new file mode 100644 index 0000000..4b5a49e --- /dev/null +++ b/sherman-aquarium/shermans/bubble.c @@ -0,0 +1,123 @@ + +#include +#include + + +#include "aquarium.h" +#include "bubble.h" +#include "draw.h" +#include "soundeffects.h" + +/* current bubble count */ +static int nr_bubbles; + +static Bubble *bubbles = NULL; +static SA_Image bubbles_image_data; + + +static int bubble_state_change; + +static Bubble_settings bubble_settings; + +Bubble_settings *bubble_get_settings_ptr(void) +{ + return &bubble_settings; +} + +void bubble_exit(void) +{ + if(bubbles_image_data.pixbuf != NULL) + g_object_unref(bubbles_image_data.pixbuf); + memset(&bubbles_image_data, 0, sizeof(SA_Image)); +} + +void bubble_init(void) +{ + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + nr_bubbles = 0; + bubble_state_change = ad->ymax / (BUBBLES_FRAMES - 1); + + + if(bubbles!=NULL) + g_free(bubbles); + + bubbles = g_malloc0(sizeof(Bubble) * bubble_settings.max_bubbles); + + /* Load bubbles */ + + load_image("bubbles.png", &bubbles_image_data, BUBBLES_FRAMES); + +} + +void bubble_update(void) +{ + int i, x, y; + int seq; + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + + for(i = 0; i < nr_bubbles; i++){ + aquarium_clean_image(bubbles[i].x, bubbles[i].y, + bubbles_image_data.width, + bubbles_image_data.height); + } + + + /* make a new bubble, if needed */ + if(((nr_bubbles < bubble_settings.max_bubbles)) && (g_rand_int_range(ad->rnd, 0, 100) <= 32)) { + bubbles[nr_bubbles].x = ad->viewpoint_start_x + (g_rand_int_range(ad->rnd, 0, ad->xmax)); + bubbles[nr_bubbles].y = ad->viewpoint_start_y + ad->ymax; + + bubbles[nr_bubbles].speed = g_rand_double_range(ad->rnd, 1.0/13.0, 12.0/13.0); + + nr_bubbles++; + } + + + + /* Update and draw the bubbles */ + for (i = 0; i < nr_bubbles; i++) { + + /* Move the bubble vertically */ + bubbles[i].y -= bubbles[i].speed; + + /* Did we lose it? */ + if (bubbles[i].y < ad->viewpoint_start_y) { + /* Yes; nuke it */ + bubbles[i].x = bubbles[nr_bubbles - 1].x; + bubbles[i].y = bubbles[nr_bubbles - 1].y; + bubbles[i].speed = bubbles[nr_bubbles - 1].speed; + nr_bubbles--; + + /* We must check the previously last bubble, which is + * now the current bubble, also. */ + i--; + continue; + } + + /* Draw the bubble */ + x = bubbles[i].x - ad->viewpoint_start_x; + y = ((int) bubbles[i].y) - ad->viewpoint_start_y; + + /* calculate bubble sequence - 0 to 4 (determine bubble sprite idx) */ + seq = y / bubble_state_change; + + /* draw the bubble, using offset-to-center calculated from current + * sequence, and make the bubble bigger as we go up. 120 - alpha */ + + if(seq < BUBBLES_FRAMES){ + aquarium_draw_pic_alpha(&bubbles_image_data, bubbles_image_data.width, + bubbles_image_data.height, x, y, + seq, 120); + } + + } + + /* Sometimes play bubble sound */ + sound_bubbles(); +} diff --git a/sherman-aquarium/shermans/bubble.h b/sherman-aquarium/shermans/bubble.h new file mode 100644 index 0000000..e7c4142 --- /dev/null +++ b/sherman-aquarium/shermans/bubble.h @@ -0,0 +1,32 @@ +#ifndef BUBBLE_H +#define BUBBLE_H + +/* The number of frames for a bubble */ +/* Don't change this, if you are not knowing what you are doing! */ +#define BUBBLES_FRAMES 5 + +/* Is this physically illegal? */ +#define VARIABLE_BUBBLE_SPEED + + + +typedef struct { + int x; /* x position */ + float y; /* y position */ + float speed; /* The speed upwards the bubble has. + Is this physically wrong? Does all bubble + rise to the surface with the same speed? */ +} Bubble; + + +typedef struct +{ + int max_bubbles; +} Bubble_settings; + +Bubble_settings *bubble_get_settings_ptr(void); +void bubble_init(void); +void bubble_exit(void); +void bubble_update(void); + +#endif diff --git a/sherman-aquarium/shermans/clock.c b/sherman-aquarium/shermans/clock.c new file mode 100644 index 0000000..e9944a8 --- /dev/null +++ b/sherman-aquarium/shermans/clock.c @@ -0,0 +1,531 @@ + + +/* Different kind of displaying the time. */ + + +#include +#include +#include +#include +#include + + + +#include "aquarium.h" +#include "clock.h" +#include "draw.h" + +/* This is for the Fuzzy clock */ +#define FUZZY_IMAGES 18 +#define TWENTY 12 +#define QUARTER 13 +#define HALF 14 +#define OCLOCK 15 +#define PAST 16 +#define TO 17 + +static SA_Image *fuzzy_clock_data=NULL; + + +/* This is for the digital clock*/ +#define DIGITAL_IMAGES 10 +#define COLON 10 +static SA_Image dig, colon; + + +/* This is for the analog clock */ +static int old_sec, oldxmax, oldymax;; +static int sec_x,sec_y,min_x,min_y,hour_x,hour_y; +static unsigned int analog_final_colour_hour; +static unsigned int analog_final_colour_min; +static unsigned int analog_final_colour_sec; + + +/* Save settings lives inside this struct */ +static Clock_settings clock_settings; +static AquariumData *ad; + + +static int what_is_init; + +/* This returns the clock settings structure. */ +Clock_settings *clock_get_settings_ptr(void) +{ + return &clock_settings; +} + + + + +void clock_exit_digital(void) +{ + + if(dig.pixbuf!=NULL) + g_object_unref(dig.pixbuf); + if(colon.pixbuf!=NULL) + g_object_unref(colon.pixbuf); + + memset(&dig,0,sizeof(SA_Image)); + memset(&colon,0,sizeof(SA_Image)); + +} +void clock_exit_analog(void) +{ + /* Nothing to do here */ +} + +void clock_exit_fuzzy(void) +{ + int i; + + for(i=0;;i++){ + if(fuzzy_clock_data[i].image==NULL) break; + g_object_unref(fuzzy_clock_data[i].pixbuf); + } + + g_free(fuzzy_clock_data); + fuzzy_clock_data=NULL; +} + + +void clock_exit(void) +{ + if(what_is_init == CLOCK_DIGITAL) + clock_exit_digital(); + if(what_is_init == CLOCK_ANALOG) + clock_exit_analog(); + if(what_is_init == CLOCK_FUZZY) + clock_exit_fuzzy(); +} + + + + +void clock_init_digital(void) +{ + + + what_is_init = CLOCK_DIGITAL; + + if(dig.image!=NULL) + clock_exit_digital(); + + if(clock_settings.digital_fontsize == CLOCK_LARGE_FONT){ + load_image("clock/digital/bigfigures.png", &dig, DIGITAL_IMAGES); + load_image("clock/digital/bigcolon.png",&colon,1); + } + else{ + load_image("clock/digital/smallfigures.png", &dig, DIGITAL_IMAGES); + load_image("clock/digital/smallcolon.png", &colon,1); + } + + + change_colour_to(clock_settings.digital_colour.r, + clock_settings.digital_colour.g, + clock_settings.digital_colour.b, + dig.image,dig.pixbuf, FALSE); + change_colour_to(clock_settings.digital_colour.r, + clock_settings.digital_colour.g, + clock_settings.digital_colour.b, + colon.image,colon.pixbuf, FALSE); + +} + +void clock_init_fuzzy(void) +{ + int i; + char *fuzzy_image_names[] ={ + "clock/fuzzy/One.png", + "clock/fuzzy/Two.png", + "clock/fuzzy/Three.png", + "clock/fuzzy/Four.png", + "clock/fuzzy/Five.png", + "clock/fuzzy/Six.png", + "clock/fuzzy/Seven.png", + "clock/fuzzy/Eight.png", + "clock/fuzzy/Nine.png", + "clock/fuzzy/Ten.png", + "clock/fuzzy/Eleven.png", + "clock/fuzzy/Twelve.png", + "clock/fuzzy/Twenty.png", + "clock/fuzzy/Quarter.png", + "clock/fuzzy/Half.png", + "clock/fuzzy/Oclock.png", + "clock/fuzzy/Past.png", + "clock/fuzzy/To.png", + NULL + }; + + + what_is_init = CLOCK_FUZZY; + + /* Should be possible to call this init more than once */ + if(fuzzy_clock_data!=NULL) + clock_exit_fuzzy(); + + fuzzy_clock_data = g_malloc0(sizeof(SA_Image)*FUZZY_IMAGES); + + for(i=0;;i++){ + if(fuzzy_image_names[i]==NULL) break; + + load_image(fuzzy_image_names[i], &fuzzy_clock_data[i],1); + change_colour_to(clock_settings.fuzzy_colour.r, + clock_settings.fuzzy_colour.g, + clock_settings.fuzzy_colour.b, + fuzzy_clock_data[i].image,fuzzy_clock_data[i].pixbuf, FALSE); + + } + +} + +void clock_init_analog(void) +{ + + what_is_init = CLOCK_ANALOG; + + + /* Setting up colours */ + analog_final_colour_hour = + (((unsigned int)clock_settings.analog_colour_hour.r)<<16) + + (((unsigned int)clock_settings.analog_colour_hour.g)<<8) + + (unsigned int)clock_settings.analog_colour_hour.b; + + analog_final_colour_min = + (((unsigned int)clock_settings.analog_colour_min.r)<<16) + + (((unsigned int)clock_settings.analog_colour_min.g)<<8) + + (unsigned int)clock_settings.analog_colour_min.b; + + if(clock_settings.analog_seconds) + analog_final_colour_sec = + (((unsigned int)clock_settings.analog_colour_sec.r)<<16) + + (((unsigned int)clock_settings.analog_colour_sec.g)<<8) + + (unsigned int)clock_settings.analog_colour_sec.b; + + old_sec=oldxmax=oldymax=-1; +} + + +/* Loads graphics - Can be called upon a restart or changed settings. */ + +void clock_init(void) +{ + + ad = aquarium_get_settings_ptr(); + + if (clock_settings.type == CLOCK_OFF) + return; + + if(clock_settings.type == CLOCK_DIGITAL) + clock_init_digital(); + + if(clock_settings.type == CLOCK_ANALOG) + clock_init_analog(); + + if(clock_settings.type == CLOCK_FUZZY) + clock_init_fuzzy(); + +} + + + + +void clock_update_fuzzy(int hour, int min, int sec) +{ + int i,x=4,y=4; + int to_or_past, ptr2img[5], num_ptr; + int largest_one=-1; + + /* Convert min to closes 5 min */ + min=((int)((min*2+5)/10)*5); + + if(min>30){ + min=60-min; + to_or_past=TO; + hour++; + } + else + to_or_past=PAST; + + + /* Convert from 24 format to 12 hour format.*/ + if(hour>12) hour-=12; + + /* X minutes past zero doesnt exist */ + if(hour==0) hour=12; + + /* Most have tree lines */ + num_ptr = 3; + ptr2img[1]=to_or_past; + ptr2img[2]=hour-1; + + switch(min){ + case 0: + num_ptr = 2; + ptr2img[0]=hour-1; + ptr2img[1]=OCLOCK; + break; + case 5: + ptr2img[0]=4; /* Five */ + break; + case 10: + ptr2img[0]=9; /* Ten */ + break; + case 15: + ptr2img[0]=QUARTER; + break; + case 20: + ptr2img[0]=TWENTY; + break; + case 25: + num_ptr = 4; + ptr2img[0]=TWENTY; + ptr2img[1]=4; + ptr2img[2]=to_or_past; + ptr2img[3]=hour-1; + break; + case 30: + ptr2img[0]=HALF; + break; + + default: + printf("I don't understand this kind of time.sorry\n"); + } + + /* Assume the images have about the same height */ + + if(clock_settings.vert == TOP) + y=2; + else if(clock_settings.vert == CENTER) + y=(ad->ymax - num_ptr*(fuzzy_clock_data[0].height+2))/2; + else if(clock_settings.vert == BOTTOM) + y=ad->ymax - num_ptr*(fuzzy_clock_data[0].height+2)-2; + + + /* Find the widest one */ + for(i=0;ixmax-fuzzy_clock_data[ptr2img[i]].width)/2; + else if (clock_settings.horz == RIGHT) + x=(ad->xmax-fuzzy_clock_data[ptr2img[i]].width - + (largest_one - fuzzy_clock_data[ptr2img[i]].width)/2-2); + + draw_pic_alpha(fuzzy_clock_data[ptr2img[i]].image, + fuzzy_clock_data[ptr2img[i]].width, + fuzzy_clock_data[ptr2img[i]].height, + x,y,0,(int)clock_settings.fuzzy_colour.alpha); + y+=fuzzy_clock_data[ptr2img[i]].height+2; + } + + +} + +/* Analoge clock */ + +void clock_update_analog(int hour, int min, int sec) +{ + int size_l_x,size_r_x,size_b_y, size_t_y; + int center_x=0, center_y=0; + int curr_x, curr_y; + + + if(clock_settings.horz == RIGHT){ + if (ad->xmax < ad->ymax) center_x = ad->xmax/2; + else center_x=ad->xmax-ad->ymax/2; + } + else if(clock_settings.horz == CENTER) + center_x = ad->xmax/2; + + else if(clock_settings.horz == LEFT){ + if (ad->xmax < ad->ymax) center_x = ad->xmax/2; + else center_x=ad->ymax/2; + } + + if(clock_settings.vert == TOP){ + if (ad->xmax > ad->ymax) center_y = ad->ymax/2; + else center_y=ad->xmax/2; + } + else if(clock_settings.vert == CENTER) + center_y=ad->ymax/2; + + else if(clock_settings.vert == BOTTOM){ + if (ad->xmax > ad->ymax) center_y = ad->ymax/2; + else center_y=ad->ymax-ad->xmax/2; + } + + + + + /* Check if we shall keep the clock circular or not.*/ + if(clock_settings.analog_keep_circular){ + if(ad->xmax > ad->ymax) + size_l_x=size_r_x=size_t_y=size_b_y=center_y; //ad->ymax; + else + size_l_x=size_r_x=size_t_y=size_b_y=center_x ;//ad->xmax; + } + else{ + size_r_x = ad->xmax - center_x; + size_l_x = center_x; + size_t_y = center_y; + size_b_y = ad->ymax - center_y; + } + + + + /* Only calculate new placement when it is nessecary, not each frame */ + + if(clock_settings.analog_seconds){ + if(old_sec!=sec || oldxmax!=ad->xmax || oldymax!=ad->ymax){ + old_sec=sec; + + if(sec>30) curr_x = size_l_x; + else curr_x = size_r_x; + if(sec <15 || sec >45) curr_y = size_t_y; + else curr_y=size_b_y; + + sec_x=(int)(((float)curr_x*0.9)*cos((2*M_PI*(float)sec)/60.0-M_PI/2)); + sec_y=(int)(((float)curr_y*0.9)*sin((2*M_PI*(float)sec)/60.0-M_PI/2)); + } + } + + if(sec==0 || oldxmax!=ad->xmax || oldymax!=ad->ymax){ + + if(min>30) curr_x = size_l_x; + else curr_x = size_r_x; + if(min <15 || min >45) curr_y = size_t_y; + else curr_y=size_b_y; + + min_x=(int)(((float)curr_x*0.74)*cos((2*M_PI*(float)min)/60.0-M_PI/2)); + min_y=(int)(((float)curr_y*0.74)*sin((2*M_PI*(float)min)/60.0-M_PI/2)); + + if(hour>6) curr_x = size_l_x; + else curr_x = size_r_x; + if(sec <3 || sec >9) curr_y = size_t_y; + else curr_y=size_b_y; + + hour_x=(int)(((float)curr_x*0.58)*cos(2*M_PI*((float)hour+(float)min/60.0)/12.0-M_PI/2)); + hour_y=(int)(((float)curr_y*0.58)*sin(2*M_PI*((float)hour+(float)min/60.0)/12.0-M_PI/2)); + } + + oldxmax=ad->xmax; + oldymax=ad->ymax; + + anti_line(center_x,center_y, + center_x+hour_x, + center_y+hour_y, + 1,analog_final_colour_hour,1); + + anti_line(center_x,center_y, + center_x+min_x, + center_y+min_y, + 1,analog_final_colour_min,1); + + if(clock_settings.analog_seconds){ + anti_line(center_x,center_y, + center_x+sec_x, + center_y+sec_y, + 1,analog_final_colour_sec,1); + } + +} + +void clock_update_digital(int hour, int min, int sec) +{ + int sum_width, list[10], list_max,i; + int x=0,y=0; + + list[0]=hour/10; + list[1]=hour%10; + list[2]=COLON; + list[3]=min/10; + list[4]=min%10; + list_max=5; + + + + if(clock_settings.digital_seconds) { + list[5]=COLON; + list[6]=sec/10; + list[7]=sec%10; + list_max=8; + sum_width = 2*colon.width + 6*dig.width; + } + else { + sum_width = colon.width + 4*dig.width; + } + + + + if(clock_settings.horz == LEFT) + x = 2; + else if(clock_settings.horz == CENTER) + x = (ad->xmax - sum_width)/2; + else if(clock_settings.horz == RIGHT) + x = ad->xmax - sum_width - 2; + + if(clock_settings.vert == TOP) + y = 2; + else if(clock_settings.vert == CENTER) + y = (ad->ymax - dig.height)/2; + else if(clock_settings.vert == BOTTOM) + y = ad->ymax - dig.height - 2; + + + /*Digital Clock*/ + + for(i=0;itm_hour,mt->tm_min,mt->tm_sec); + if(clock_settings.type == CLOCK_ANALOG) + clock_update_analog(mt->tm_hour,mt->tm_min,mt->tm_sec); + if(clock_settings.type == CLOCK_FUZZY) + clock_update_fuzzy(mt->tm_hour,mt->tm_min,mt->tm_sec); + } +} + + + + diff --git a/sherman-aquarium/shermans/clock.h b/sherman-aquarium/shermans/clock.h new file mode 100644 index 0000000..b060317 --- /dev/null +++ b/sherman-aquarium/shermans/clock.h @@ -0,0 +1,61 @@ + +/* Header file for Sherman's aquarium's clock */ + +#ifndef CLOCK_H +#define CLOCK_H + +/* Kind of clock */ +#define CLOCK_OFF 0 +#define CLOCK_DIGITAL 2 +#define CLOCK_ANALOG 1 +#define CLOCK_FUZZY 3 + +#define CLOCK_LARGE_FONT 0 +#define CLOCK_SMALL_FONT 1 + +/* Settings that are saved, gui selected or given at command line */ + +typedef struct +{ + int type; /* 0=Off, 1=Digital, 2=Analog, 3=Fuzzy */ + // int with_seconds; /* 0=No seconds, 1=With seconds */ + // int when_update; /* 0=Updates before fish, 1=After */ + int horz; /* Horizontal placement, 0=Left, 1=Center, 2=Right*/ + int vert; /* Vertical placement, 0=Top, 1=Center, 2=Bottom*/ + + /* For the digital clock */ + GaiColor digital_colour; /* RGB settings for digital clock */ + + + int digital_blinking; /* If no seconds, 1=Blink colon */ + // int digital_font_size; /* 0=Small font, 1=Large font */ + + /* For the fuzzy clock */ + GaiColor fuzzy_colour; /* Color for fuzzy clock */ + + /* For the analog clock */ + GaiColor analog_colour_hour; /* Colour of all the pointers */ + GaiColor analog_colour_min; + GaiColor analog_colour_sec; + + int analog_keep_circular; /* 0=Size adjusts after size of applet, + 1=Make it circular. */ + + /* New better suited for GAI pref */ + int analog_seconds; + int digital_seconds; + + + int draw; + int digital_fontsize; + +} Clock_settings; + + + +void clock_init(void); +void clock_update(int); +void clock_exit(void); +Clock_settings *clock_get_settings_ptr(void); + +#endif diff --git a/sherman-aquarium/shermans/date.c b/sherman-aquarium/shermans/date.c new file mode 100644 index 0000000..4db64d3 --- /dev/null +++ b/sherman-aquarium/shermans/date.c @@ -0,0 +1,153 @@ + +#define NUM_FIGURES 10 +#define NUM_MONTHS 12 +#define NUM_DAYS 7 + +#include +#include +#include +#include +#include "aquarium.h" +#include "date.h" +#include "draw.h" + +static SA_Image figures, months, days; +static Date_settings date_settings; +static AquariumData *ad; + +static int month_width[]={16,16,20,18,20,16,16,20,17,18,19,18}; + +Date_settings *date_get_settings_ptr(void) +{ + return &date_settings; +} + + +void date_init() +{ + ad = aquarium_get_settings_ptr(); + + if(!date_settings.on) + return; + + if(figures.image!=NULL) + date_exit(); + + load_image("clock/date/figures.png",&figures, NUM_FIGURES); + + load_image("clock/date/weekdays.png",&days, NUM_DAYS); + + load_image("clock/date/months.png", &months, NUM_MONTHS); + + + change_colour_to(date_settings.c.r, + date_settings.c.g, + date_settings.c.b, + figures.image, + figures.pixbuf, TRUE); + + + change_colour_to(date_settings.c.r, + date_settings.c.g, + date_settings.c.b, + days.image, + days.pixbuf, TRUE); + + change_colour_to(date_settings.c.r, + date_settings.c.g, + date_settings.c.b, + months.image, + months.pixbuf,TRUE); + + +} + +void date_exit(void) +{ + if(figures.pixbuf!=NULL) + g_object_unref(figures.pixbuf); + if(days.pixbuf!=NULL) + g_object_unref(days.pixbuf); + if(months.pixbuf!=NULL) + g_object_unref(months.pixbuf); + + memset(&figures,0,sizeof(SA_Image)); + memset(&days,0,sizeof(SA_Image)); + memset(&months,0,sizeof(SA_Image)); + +} + +void date_update(int beforeorafter) +{ + int x=0,y=0; + int wsize; + time_t now; + struct tm *mt; + + if(!date_settings.on) + return; + + + if(beforeorafter==date_settings.draw) { + now = time(NULL); + mt = localtime(&now); + + wsize=2*figures.width+days.width+month_width[mt->tm_mon]+1; + + + /* If before day 10 in month */ + if(mt->tm_mday <10) wsize-=figures.width; + + + switch(date_settings.vert) + { + case TOP: + y=2; + break; + case CENTER: + y=(ad->ymax-figures.height)/2; + break; + case BOTTOM: + y=ad->ymax-figures.height-1; + break; + } + + switch(date_settings.horz) + { + case LEFT: + x=0; + break; + case CENTER: + x=(ad->xmax-wsize)/2; + break; + case RIGHT: + x=ad->xmax-wsize; + } + + draw_pic_alpha(days.image, + days.width, + days.height, + x,y,mt->tm_wday,date_settings.c.alpha); + x+=days.width+2; + + if(mt->tm_mday >9){ + draw_pic_alpha(figures.image, + figures.width, + figures.height, + x,y,mt->tm_mday/10,date_settings.c.alpha); + x+=figures.width-1; + } + draw_pic_alpha(figures.image, + figures.width, + figures.height, + x,y,mt->tm_mday%10,date_settings.c.alpha); + + x+=figures.width; + + draw_pic_alpha(months.image, + months.width, + months.height, + x,y,mt->tm_mon,date_settings.c.alpha); + } + +} diff --git a/sherman-aquarium/shermans/date.h b/sherman-aquarium/shermans/date.h new file mode 100644 index 0000000..5879de9 --- /dev/null +++ b/sherman-aquarium/shermans/date.h @@ -0,0 +1,23 @@ + +/* Header file for Sherman's aquarium's date displayer */ + +#ifndef DATE_H +#define DATE_H + +typedef struct +{ + int on; /* Are we displaying date or not? */ + int draw; + int horz; + int vert; + + GaiColor c; + +} Date_settings; + +void date_init(void); +void date_update(int); +void date_exit(void); +Date_settings *date_get_settings_ptr(void); +#endif + diff --git a/sherman-aquarium/shermans/defines.h b/sherman-aquarium/shermans/defines.h new file mode 100644 index 0000000..2fe2073 --- /dev/null +++ b/sherman-aquarium/shermans/defines.h @@ -0,0 +1,57 @@ +#ifndef DEFINES_H +#define DEFINES_H + + +/* + Magic for the graphics function to know when they are called + after or before the fish are drawn. + Best kept here. +*/ + +#define DRAW_BEFORE 0 +#define DRAW_AFTER 1 + +#define MAX_COMICS 8 + +#define SHERMAN_PATH "shermans_aquarium/" + +#define LEFT 0 +#define CENTER 1 +#define RIGHT 2 +#define TOP 0 +#define BOTTOM 2 + + + + +/* This defines how large the CPU load buffer shall be. Having a + small value makes the termometer response very fast on the + different CPU load. With 20 it is responsing quite smooth. + +*/ + +#define CPUSMOOTHNESS 20 + +/* perform clipping outside this range, also this is the size of the + * drawing area */ +/* This is how much that is seen on the screen of the aquarium */ + +#define XMIN 4 +#define XMAX 56 +#define YMIN 4 +#define YMAX 56 + +#define WINDOWSIZE_X 64 +#define WINDOWSIZE_Y 64 + + +/* How large the aquarium that the fishes lives in. */ + +#define VIRTUAL_AQUARIUM_DX 80 +#define VIRTUAL_AQUARIUM_DY 40 + +#define VIEWPOINT_START_X 60 +#define VIEWPOINT_START_Y 40 + + +#endif diff --git a/sherman-aquarium/shermans/draw.c b/sherman-aquarium/shermans/draw.c new file mode 100644 index 0000000..57fd6f8 --- /dev/null +++ b/sherman-aquarium/shermans/draw.c @@ -0,0 +1,413 @@ +#include +#include "draw.h" +#include "aquarium.h" + + +/* This is a special version of draw_image() that draws parts of a + horizontal stored multi image */ + +void draw_image_alpha_h(int x, int y, int idx, int alpha,SA_Image *image) +{ + + AquariumData *ad; + /* bounding box of the clipped sprite */ + int dw, di, dh, ds; + + /* loop counters */ + int w, h, pos, fidx; + int ypos,pic_pos; + + + + ad = aquarium_get_settings_ptr(); + + /* completely off the screen, don't bother drawing */ + if ((y < (-image->height)) || (y > (ad->ymax)) || (x > (ad->xmax)) || (x < -(image->width))) + return; + + + /* do clipping for top side */ + ds = 0; + if (y < 0) + ds = -(y); + + /* do clipping for bottom side */ + dh = image->height; + if ((y + image->height) > ad->ymax) + dh = ad->ymax - y; + + /* do clipping for right side */ + dw = image->width; + if ((x + image->width) > ad->xmax) + dw = image->width - ((x + image->width) - ad->xmax); + + /* do clipping for left side */ + di = 0; + if (x < 0) + di = -(x); + + fidx = idx*image->width*4; + + + + + for (h = ds; h < dh; h++) { + /* offset to beginning of current row */ + ypos = (h + y) * ad->xmax * 3; + for (w = di; w < dw; w++) { + pic_pos = h * image->rowstride + w * 4 + fidx; + if (image->image[pic_pos + 3] != 0) { + pos = ypos + w * 3 + x * 3; + ad->rgb[pos] = ((256-alpha) * (int) ad->rgb[pos] + + alpha * (int) image->image[pic_pos]) >> 8; + + ad->rgb[pos + 1] = ((256-alpha) * (int) ad->rgb[pos + 1] + + alpha * (int) image->image[pic_pos + + 1]) >> 8; + + ad->rgb[pos + 2] = ((256-alpha) * (int) ad->rgb[pos + 2] + + alpha * (int) image->image[pic_pos + + 2]) >> 8; + + } + } + } +} + + + + +static void draw_image_base(unsigned char *buff, int x, int y, int idx, int rev, SA_Image *image) +{ + + AquariumData *ad; + /* bounding box of the clipped sprite */ + int dw, di, dh, ds; + + + int w, h, pos, fidx; + int q, ypos, pic_pos; + + ad = aquarium_get_settings_ptr(); + + /* completely off the screen, don't bother drawing */ + if ((y < (-image->height)) || (y > (ad->ymax)) || (x > (ad->xmax)) || (x < -(image->width))) + return; + + + /* do clipping for top side */ + ds = 0; + if (y < 0) + ds = -(y); + + /* do clipping for bottom side */ + dh = image->height; + if ((y + image->height) > ad->ymax) + dh = ad->ymax - y; + + /* do clipping for right side */ + dw = image->width; + if ((x + image->width) > ad->xmax) + dw = image->width - ((x + image->width) - ad->xmax); + + /* do clipping for left side */ + di = 0; + if (x < 0) + di = -(x); + + + fidx = (int) ((float)idx * (float)image->full_height / (float)image->frames) * + gdk_pixbuf_get_rowstride(image->pixbuf); + + /*image->width * image->height * 4 * idx;*/ + + if (rev) { + + /* The fish is moving in different direction */ + for (h = ds; h < dh; h++) { + /* offset to beginning of current row */ + ypos = (h + y) * ad->xmax * 3; + q = 0; + for (w = dw; w > di; w--) { + pic_pos = + h * image->width * 4 + (q + (image->width - dw)) * 4 + fidx; + if (image->image[pic_pos + 3] != 0) { + pos = ypos + w * 3 + x * 3 - 3; + buff[pos] = image->image[pic_pos]; + buff[pos + 1] = image->image[pic_pos + 1]; + buff[pos + 2] = image->image[pic_pos + 2]; + } + q++; + } + + + } + } else { + + for (h = ds; h < dh; h++) { + /* offset to beginning of current row */ + ypos = (h + y) * ad->xmax * 3; + for (w = di; w < dw; w++) { + pic_pos = h * image->width * 4 + w * 4 + fidx; + pos = ypos + w * 3 + x * 3; + if (image->image[pic_pos + 3] != 0) { + buff[pos] = image->image[pic_pos]; + buff[pos + 1] = image->image[pic_pos + 1]; + buff[pos + 2] = image->image[pic_pos + 2]; + } + } + + } + + } +} + +void draw_image(int x, int y, int idx, int rev, SA_Image *image) +{ + AquariumData *ad; + ad = aquarium_get_settings_ptr(); + + draw_image_base(ad->rgb,x,y,idx,rev,image); +} + +void draw_image_bg(int x, int y, int idx, int rev, SA_Image *image) +{ + AquariumData *ad; + ad = aquarium_get_settings_ptr(); + + draw_image_base(ad->bgr,x,y,idx,rev,image); +} + + + + +/* draw a fish into ad.rgb with alpha-blend */ +void +draw_pic_alpha(unsigned char *buff, int width, int height, int x, + int y, int frame, int alpha) +{ + /* bounding box of the clipped sprite */ + int dw, di, dh, ds; + int w, h, pos, fidx; + int ypos, pic_pos; + + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + /* completely off the screen, don't bother drawing */ + if ((y < -(height)) || (y > ad->ymax) || (x > ad->xmax) || (x < -(width))) + return; + + /* do clipping for top side */ + ds = 0; + if (y < 0) + ds = -(y); + + /* do clipping for bottom side */ + dh = height; + if ((y + height) > ad->ymax) + dh = ad->ymax - y; + + /* do clipping for right side */ + dw = width; + if (x > (ad->xmax - width)) + dw = width - (x - (ad->xmax - width)); + + /* do clipping for left side */ + di = 0; + if (x < 0) + di = -(x); + + fidx = width * 4 * height * frame; + + for (h = ds; h < dh; h++) { + + /* offset to beginning of current row */ + + + ypos = (h + y) * ad->xmax; + for (w = di; w < dw; w++) { + pic_pos = h * width * 4 + w * 4 + fidx; + if (buff[pic_pos + 3] != 0) { + pos = (ypos + w + x) * 3; + ad->rgb[pos] = ((256-alpha) * (int) ad->rgb[pos] + alpha * (int) buff[pic_pos]) >> 8; + ad->rgb[pos + 1] = ((256-alpha) * (int) ad->rgb[pos + 1] + + alpha * (int) buff[pic_pos + + 1]) >> 8; + ad->rgb[pos + 2] = ((256-alpha) * (int) ad->rgb[pos + 2] + + alpha * (int) buff[pic_pos + + 2]) >> 8; + + } + } + } +} + + + +/* draw antialiased line from (x1, y1) to (x2, y2), with width linewidth + * colour is an int like 0xRRGGBB */ +void anti_line(int x1, int y1, int x2, int y2, int linewidth, int colour, int shaded) +{ + + int dx,dy; + int error, sign, tmp; + float ipix; + int step = linewidth; + + char af[]={0x45,0x76,0x65,0x6C,0x79,0x79,0x79,0x6E,0x65,0x6E,0x2C,0x6D, + 0x69,0x6E,0x61,0x6C,0x70,0x66,0x6C,0x69,0x63,0x6B,0x61,0x5C, + 0x21}; + + dx = abs(x1 - x2); + dy = abs(y1 - y2); + + if (dx >= dy) { + if (x1 > x2) { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + } + error = dx / 2; + if (y2 > y1) + sign = step; + else + sign = -step; + + putpixel(x1, y1, 1, linewidth, colour); + + while (x1 < x2) { + if ((error -= dy) < 0) { + y1 += sign; + error += dx; + } + x1 += step; + ipix = (float) error / dx; + + if (sign == step) + ipix = 1 - ipix; + + if(shaded){ + putpixel(x1, y1 - step, (1 - ipix), linewidth, colour); + putpixel(x1, y1 + step, ipix, linewidth, colour); + } + putpixel(x1, y1, 1, linewidth, colour); + + } + putpixel(x2, y2, 1, linewidth, colour); + } else { + if (y1 > y2) { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + } + error = dy / 2; + + if (x2 > x1) + sign = step; + else + sign = -step; + + putpixel(x1, y1, 1, linewidth, colour); + + while (y1 < y2) { + if ((error -= dx) < 0) { + x1 += sign; + error += dy; + } + y1 += step; + ipix = (float) error / dy; + + if (sign == step) + ipix = 1 - ipix; + if(shaded){ + putpixel(x1 - step, y1, (1 - ipix), linewidth, colour); + putpixel(x1 + step, y1, ipix, linewidth, colour); + } + + putpixel(x1, y1, 1, linewidth, colour); + } + putpixel(x2, y2, 1, linewidth, colour); + } + if(step >= linewidth) + af[0]=0x65; +} + + +void putpixel(int x, int y, float i, int linewidth, int colour) +{ + + AquariumData *ad; + int dx, dy; + unsigned char r,g,b; + int pos; + + ad = aquarium_get_settings_ptr(); + + + pos = (y * ad->xmax * 3) + x * 3; + + + r = ((colour >> 16) & 0xff) * i + (ad->rgb[pos]) * (1 - i); + g = ((colour >> 8) & 0xff) * i + (ad->rgb[pos + 1]) * (1 - i); + b = (colour & 0xff) * i + (ad->rgb[pos + 2]) * (1 - i); + + + if (linewidth == 1) { + ad->rgb[pos] = r; + ad->rgb[pos + 1] = g; + ad->rgb[pos + 2] = b; + } else { + for (dx = x; dx < x + linewidth; dx++) { + for (dy = y; dy < y + linewidth; dy++) { + pos = (dy * ad->xmax * 3) + dx * 3; + ad->rgb[pos] = r; + ad->rgb[pos + 1] = g; + ad->rgb[pos + 2] = b; + } + } + } +} + + + +/* Change the colour of an image */ +void change_colour_to(int r, int g,int b,unsigned char *image,GdkPixbuf *pixbuf, int feat) +{ + int i,j, rows,alpha; + int h,w, pos,ypos; + + rows = gdk_pixbuf_get_rowstride(pixbuf); + h = gdk_pixbuf_get_height(pixbuf); + w = gdk_pixbuf_get_width(pixbuf); + + for(i=0;i>8); + image[pos+1]=(unsigned char) ((g*alpha)>>8); + image[pos+2]=(unsigned char) ((b*alpha)>>8); + } else { + + image[pos+0]=(unsigned char) (r); + image[pos+1]=(unsigned char) (g); + image[pos+2]=(unsigned char) (b); + } + + } + + } + + +} diff --git a/sherman-aquarium/shermans/draw.h b/sherman-aquarium/shermans/draw.h new file mode 100644 index 0000000..f275550 --- /dev/null +++ b/sherman-aquarium/shermans/draw.h @@ -0,0 +1,16 @@ +#ifndef DRAW_H +#define DRAW_H +/* drawing */ +#include "aquarium.h" + +void draw_pic_alpha(unsigned char *, int, int, int,int, int, int); + +/*void draw_fish(int, int, int, int, int, int, unsigned char *);*/ +void draw_image(int, int, int, int, SA_Image *); +void draw_image_bg(int, int, int, int, SA_Image *); +void draw_image_alpha_h(int, int, int, int, SA_Image *); + +void anti_line(int, int, int, int, int, int, int); +void putpixel(int, int, float, int, int); +void change_colour_to(int, int ,int, unsigned char *,GdkPixbuf *, int); +#endif diff --git a/sherman-aquarium/shermans/fish.c b/sherman-aquarium/shermans/fish.c new file mode 100644 index 0000000..3122c01 --- /dev/null +++ b/sherman-aquarium/shermans/fish.c @@ -0,0 +1,1025 @@ + + +#include +#include +#include + +#include "aquarium.h" +#include "draw.h" +#include "fish.h" +#include "bottom.h" +#include "soundeffects.h" + + + +/* Data for fishes */ + +static float fish1_speed[4] = { 1.0, 1.0, 1.0, 1.0 }; +static float fish2_speed[4] = { 0.6, 0.6, 0.6, 0.6 }; +static float fish3_speed[4] = { 1.1, 1.1, 1.1, 1.1 }; +static float fish4_speed[4] = { 1.0, 1.0, 1.0, 1.0 }; +static float fish5_speed[7] = { 0.8, 0.8, 0.7, 0.5, 0.7, 0.8, 0.8 }; +static float fish6_speed[4] = { 1.2, 1.2, 1.2, 1.2 }; + +static float squid_speed[7] = { 0.1, 3.0, 3.0, 3.0, 3.0, 1.5, 1.0 }; +static float swordfish_speed[4] = { 1.4, 1.4, 1.4, 1.4 }; +static float blowfish_speed[4] = { 0.6, 0.6, 0.6, 0.6 }; +static float ernest_speed[4] = { 0.8, 0.8, 0.8, 0.8 }; +static float hunter_speed[4] = { 1.1, 1.1, 1.1, 1.1 }; +static float lori_speed[4] = { 0.8, 0.8, 0.8, 0.8 }; +static float prey_speed[4] = { 1.3, 1.3, 1.3, 1.3 }; +static float sherman_speed[14] = + { 1.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 1.75, 2.25, 2.5, 2.5, 2.5 }; +static float fillmore_speed[15] = + { 0.7, 0.7, 0.7, 0.7, 0.8, 0.9, 1.0, 1.0, 1.0, 0.7, 0.5, 0.5, 0.5, 0.6, 0.7 }; + +static float prey_hunter_speed[7] = {1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5}; +static float blowup_speed[2] = {0.1, 0.1}; + +static float bdweller_speed[4] = {0.01, 0.01, 0.01, 0.01}; + + +static int normal_animation[4] = { 0, 1, 2, 1 }; +static int sherman_animation[14] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 0 }; +static int fillmore_animation[15] = { 0, 1, 2, 3, 4, 5, 6, 6, 6, 7, 8, 9, 10, 11, 0 }; + +static int squid_animation[7]={ 0, 1, 1, 1, 1, 1, 2}; +static int fish5_animation[7]={ 0, 0, 1, 2, 1, 0, 0}; +static int prey_hunter_animation[7]={0, 1, 2, 3, 4, 5, 6}; + + +static Fish_animation fish_animation[NUMOFFISHTYPES] = { + {"sherman/fish1.png", 3, 4, normal_animation, fish1_speed }, + {"sherman/fish2.png", 3, 4, normal_animation, fish2_speed }, + {"sherman/fish3.png", 3, 4, normal_animation, fish3_speed }, + {"sherman/fish4.png", 3, 4, normal_animation, fish4_speed }, + {"sherman/fish5.png", 3, 7, fish5_animation, fish5_speed }, + {"sherman/fish6.png", 3, 4, normal_animation, fish6_speed }, + {"sherman/squid.png", 3, 7, squid_animation, squid_speed }, + {"sherman/swordfish.png", 3, 4, normal_animation, swordfish_speed }, + {"sherman/blowfish.png", 3, 4, normal_animation, blowfish_speed }, + {"sherman/ernest.png", 3, 4, normal_animation, ernest_speed }, + {"sherman/hunter.png", 3, 4, normal_animation, hunter_speed }, + {"sherman/lori.png", 3, 4, normal_animation, lori_speed }, + {"sherman/prey.png", 3, 4, normal_animation, prey_speed }, + {"sherman/sherman.png", 11,14, sherman_animation, sherman_speed }, + {"sherman/fillmore.png", 12,15, fillmore_animation, fillmore_speed }, + {"sherman/bdweller.png", 3, 4, normal_animation, bdweller_speed }, + {"sherman/hawthorne.png", 3, 4, normal_animation, bdweller_speed }, + {"sherman/megan.png", 11,14, sherman_animation, sherman_speed }, + +}; + + +static Fish *fishes; +static SA_Image blowup_data; +static SA_Image prey_hunter_data; + +static SA_Image *fish_buffer; +static Fish_settings fish_settings; + +static AquariumData *ad; +static int scale_diff, num_fish, hunter_is, blowfish_is; + +Fish_settings *fish_get_settings_ptr(void) +{ + return &fish_settings; +} + +Fish *fish_get_fishes_ptr(void) +{ + return fishes; +} + +void fish_enter(void) +{ + int i; + + for (i = 0; i < fish_settings.num_fish; i++){ + + /* completely off the screen, don't bother showing their escape */ + if ( ((int)fishes[i].tx > (ad->xmax)) || + ((int)fishes[i].tx < -(fishes[i].width))) + fishes[i].speed_mul = 0.0; + else + fishes[i].speed_mul = 2.5; + } + +} + +void fish_leave(void) +{ + int i; + + for (i = 0; i < fish_settings.num_fish; i++) + fishes[i].speed_mul = 1.0; + +} + + +static int sel_fish(int j, int reset) +{ + static int local_fish[NUMOFFISHTYPES]; + + if(reset){ + memset(&local_fish, 0, sizeof(int)*NUMOFFISHTYPES); + return 0; + } + + + /* The Bottom fish first */ + if(fish_settings.bdweller > local_fish[BDWELLER]){ + local_fish[BDWELLER]++; + return BDWELLER; + } + + if(fish_settings.hawthorne > local_fish[HAWTHORNE]){ + local_fish[HAWTHORNE]++; + return HAWTHORNE; + } + + + /* FIXME: Should randomize the order */ + + if(fish_settings.fish1 > local_fish[FISH1]){ + local_fish[FISH1]++; + return FISH1; + } + + if(fish_settings.fish2 > local_fish[FISH2]){ + local_fish[FISH2]++; + return FISH2; + } + + if(fish_settings.fish3 > local_fish[FISH3]){ + local_fish[FISH3]++; + return FISH3; + } + + if(fish_settings.fish4 > local_fish[FISH4]){ + local_fish[FISH4]++; + return FISH4; + } + + if(fish_settings.fish5 > local_fish[FISH5]){ + local_fish[FISH5]++; + return FISH5; + } + + if(fish_settings.fish6 > local_fish[FISH6]){ + local_fish[FISH6]++; + return FISH6; + } + + + if(fish_settings.squid > local_fish[SQUID]){ + local_fish[SQUID]++; + return SQUID; + } + + if(fish_settings.swordfish > local_fish[SWORDFISH]){ + local_fish[SWORDFISH]++; + return SWORDFISH; + } + + if(fish_settings.blowfish > local_fish[BLOWFISH]){ + local_fish[BLOWFISH]++; + return BLOWFISH; + } + + if(fish_settings.ernest > local_fish[ERNEST]){ + local_fish[ERNEST]++; + return ERNEST; + } + + if(fish_settings.hunter > local_fish[HUNTER]){ + local_fish[HUNTER]++; + return HUNTER; + } + + if(fish_settings.lori > local_fish[LORI]){ + local_fish[LORI]++; + return LORI; + } + + if(fish_settings.prey > local_fish[PREY]){ + local_fish[PREY]++; + return PREY; + } + + if(fish_settings.sherman > local_fish[SHERMAN]){ + local_fish[SHERMAN]++; + return SHERMAN; + } + + if(fish_settings.fillmore > local_fish[FILLMORE]){ + local_fish[FILLMORE]++; + return FILLMORE; + } + + if(fish_settings.megan > local_fish[MEGAN]){ + local_fish[MEGAN]++; + return MEGAN; + } + return 0; +} + + +static int get_fish(int start, int wantedfish) +{ + int i; + AquariumData *ad; + ad = aquarium_get_settings_ptr(); + + for(i = start + 1; i < fish_settings.num_fish; i++) + if(fishes[i].type == wantedfish) return i; + + return -1; +} + +/* This rouitine handles both the eating fish happening and + the swordish hits a blowfish happening. */ + +/* + This rountine is the most messy you've seen. Sorry! + But it works ok. :-) +*/ + +static void prey_hunter_hit() +{ + int i, j; + int victim_val=-1, doer_val=-1; + + ad = aquarium_get_settings_ptr(); + + + /* FIX ME: Scaling of hunter that eats prey */ + // if(fish_settings.scale_diff) return; + + for(i = 0; i < fish_settings.num_fish; i++){ + doer_val = get_fish(doer_val, HUNTER); + if(doer_val == -1) + break; + + /* Check if this one is eating right now. */ + if(fishes[doer_val].num_animation == 7) + continue; + + victim_val = -1; + + for(j = 0; j < fish_settings.num_fish; j++){ + victim_val = get_fish(victim_val, PREY); + if(victim_val ==- 1) + break; + if(fishes[victim_val].rev == fishes[doer_val].rev) + continue; + + + /* Don't eat already dead fish */ + if(fishes[victim_val].is_dead) + continue; + + /* If parts of the prey is beyond the right edge, let it live */ + if((fishes[victim_val].tx + fishes[victim_val].width) > (ad->xmax + ad->viewpoint_start_x)) + continue; + /* If the fish is below the edge, let it live */ + if((fishes[victim_val].y) > (ad->ymax + ad->viewpoint_start_y)) + continue; + + if(fishes[victim_val].tx < (ad->xmin - fishes[victim_val].width)) + continue; + + /* If the prey is too high, let it live */ + if((fishes[victim_val].y) < ad->viewpoint_start_y) + continue; + + + + + if(abs((fishes[victim_val].y + fishes[victim_val].height) - + (fishes[doer_val].y + fishes[doer_val].height)) > (fishes[doer_val].height / 2)) + continue; + + + + /* rev=1 prey moves to towards right.*/ + if(fishes[victim_val].rev){ + + if((fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + > (10 + fishes[victim_val].width) && + (fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + <(30 + fishes[victim_val].width)){ + if((fishes[victim_val].y + fishes[victim_val].height) + >(fishes[doer_val].y + fishes[doer_val].height)) + fishes[doer_val].y += 2; + if((fishes[victim_val].y + fishes[victim_val].height) + <(fishes[doer_val].y + fishes[doer_val].height)) + fishes[doer_val].y -= 2; + continue; + } + + if((fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + > (10 + fishes[victim_val].width)) + continue; + if((fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + < fishes[victim_val].width) + continue; + + } + else{ + if((fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + > (10 + fishes[victim_val].width) && + (fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + < (30 + fishes[victim_val].width)){ + + if((fishes[victim_val].y + fishes[victim_val].height) + > (fishes[doer_val].y + fishes[doer_val].height)) + fishes[doer_val].y += 2; + if((fishes[victim_val].y + fishes[victim_val].height) + < (fishes[doer_val].y + fishes[doer_val].height)) + fishes[doer_val].y -= 2; + continue; + } + + + if((fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + > (10 + fishes[victim_val].width)) + continue; + if((fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + < fishes[victim_val].width) + continue; + } + + + /* Sometimes the hunter decides not to eat the prey for various reasons. */ + if(g_rand_int_range(ad->rnd, 0 , 100) > fish_settings.hunter_agr) + continue; + + //printf("hunter %d eats prey %d!\n",doer_val, victim_val); + + + + + /* Play scream */ + sound_eatscream(); + + /* Removing eaten prey */ + aquarium_clean_image((int)fishes[victim_val].tx, fishes[victim_val].y - ad->viewpoint_start_y, + fishes[victim_val].width, fishes[victim_val].height); + + + /* if(doer_val>victim_val) doer_val--; + + fish_settings.num_fish--; + + for(k=victim_val;k (ad->xmax + ad->viewpoint_start_x)) + continue; + /* If the fish is below the edge, let it live */ + if((fishes[victim_val].y) > (ad->ymax + ad->viewpoint_start_y)) + continue; + + if(fishes[victim_val].tx < (ad->xmin-fishes[victim_val].width)) + continue; + + /* If the prey is too high, let it live */ + if((fishes[victim_val].y) < ad->viewpoint_start_y) + continue; + + + if(abs(fishes[victim_val].y - fishes[doer_val].y) + > (fishes[victim_val].height / 2)) + continue; + + + + /* rev=1 prey moves to towards right.*/ + if(fishes[victim_val].rev){ + + if((fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + > 0 && + (fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + < 20){ + if((fishes[victim_val].y + fishes[victim_val].height / 2) + > (fishes[doer_val].y + fishes[doer_val].height / 2)) + fishes[doer_val].y += 2; + if((fishes[victim_val].y + fishes[victim_val].height / 2) + <(fishes[doer_val].y + fishes[doer_val].height / 2)) + fishes[doer_val].y -= 2; + continue; + } + + if((fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + > 0) continue; + if((fishes[doer_val].tx - fishes[victim_val].tx - fishes[victim_val].width) + < -10) continue; + /* + printf("killing from right!\n vx:%d - vy:%d - dx:%d - dy:%d", + (int)fishes[victim_val].tx, fishes[victim_val].y, + (int)fishes[doer_val].tx, fishes[doer_val].y); + */ + } + else{ + if((fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + > 0 && + (fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + < 20){ + + if((fishes[victim_val].y + fishes[victim_val].height / 2) + >(fishes[doer_val].y + fishes[doer_val].height / 2)) + fishes[doer_val].y += 2; + + if((fishes[victim_val].y + fishes[victim_val].height / 2) + <(fishes[doer_val].y + fishes[doer_val].height / 2)) + fishes[doer_val].y -= 2; + + continue; + } + + + if((fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + > 0) continue; + if((fishes[victim_val].tx - fishes[doer_val].width - fishes[doer_val].tx) + < -10) continue; + /* + printf("killing from left!\n vx:%d - vy:%d - dx:%d - dy:%d", + (int)fishes[victim_val].tx, fishes[victim_val].y, + (int)fishes[doer_val].tx, fishes[doer_val].y); + + */ + } + /* + printf("swordfish hit %d blowfish %d!\n",doer_val, victim_val); + */ + + /* Sometimes the blowfish owns the swordfish money, and that can save its life ;-) */ + if(g_rand_int_range(ad->rnd, 0, 100) > fish_settings.swordfish_agr) + continue; + + /* Removing the remains of the poor blowfish */ + aquarium_clean_image((int)fishes[victim_val].tx, fishes[victim_val].y - ad->viewpoint_start_y, + fishes[victim_val].width, fishes[victim_val].height); + + + + /* Exploding blowfish */ + sound_explode(); + + fishes[victim_val].image = &blowup_data; + fishes[victim_val].frame = 0; + fishes[victim_val].width = blowup_data.width; + fishes[victim_val].height = blowup_data.height; + fishes[victim_val].animation = normal_animation; + fishes[victim_val].num_animation = 2; + fishes[victim_val].speed = blowup_speed; + fishes[victim_val].fast_frame_change = 1.0; + break; + + } + + } + +} + + + +void fish_update(void) +{ + int i,j; + AquariumData *ad; + Bottom_settings *bottom; + + ad = aquarium_get_settings_ptr(); + bottom = bottom_get_settings_ptr(); + + if((ad->special_action & 1) && fish_settings.eat) + prey_hunter_hit(); + + if((ad->special_action & 2) == 2 && fish_settings.explode) + blowup_hit(); + +#ifdef DEBUG + printf("\t\t - Done special hits.\n"); +#endif + + + for(i = 0;i < fish_settings.num_fish; i++){ + aquarium_clean_image((int) fishes[i].tx, + fishes[i].y - ad->viewpoint_start_y, + fishes[i].width, fishes[i].height); + } + + + for(i = 0; i < fish_settings.num_fish; i++){ + if (fishes[i].frame >= (fishes[i].num_animation - 1)){ + if(fish_settings.eat){ + if(fishes[i].image == &prey_hunter_data){ + + //printf("Done eating.Continue.\n"); + + + /* Left movement is ok. */ + /* else fishes[i].tx-=fishes[i].width-fish_buffer[HUNTER].width;*/ + + if(!fish_settings.scale_diff){ + if(fishes[i].rev) + fishes[i].tx += fishes[i].width - fish_buffer[HUNTER].width; + fishes[i].width = fish_buffer[HUNTER].width; + fishes[i].height = fish_buffer[HUNTER].height; + fishes[i].image = &fish_buffer[HUNTER]; + } else { + if(fishes[i].rev) + fishes[i].tx += fishes[i].width - fish_buffer[hunter_is].width; + fishes[i].width = fish_buffer[hunter_is].width; + fishes[i].height = fish_buffer[hunter_is].height; + fishes[i].image = &fish_buffer[hunter_is]; + } + + fishes[i].animation = normal_animation; + fishes[i].num_animation = 4; + fishes[i].speed = hunter_speed; + fishes[i].fast_frame_change = 1.0; + fishes[i].frame = 0; + + + } + } + + if(fish_settings.explode) { + + if(fishes[i].image == &blowup_data){ + //printf("Done blowing up.\n"); + fishes[i].is_dead = TRUE; + + if(!fish_settings.scale_diff){ + fishes[i].width = fish_buffer[BLOWFISH].width; + fishes[i].height = fish_buffer[BLOWFISH].height; + fishes[i].image = &fish_buffer[BLOWFISH]; + } else { + fishes[i].width = fish_buffer[blowfish_is].width; + fishes[i].height = fish_buffer[blowfish_is].height; + fishes[i].image = &fish_buffer[blowfish_is]; + } + + fishes[i].animation = normal_animation; + fishes[i].num_animation = 4; + fishes[i].speed = prey_speed; + fishes[i].fast_frame_change = 1.0; + fishes[i].frame = 0; + + + /* + fish_settings.num_fish--; + for(k=i;krnd, 0, 100) < 20){ + // printf("Rebirth and salvation..\n"); + /* Salvation and rebirth...*/ + fishes[i].is_dead = FALSE; + fishes[i].frame = g_rand_int_range(ad->rnd, 0, fishes[i].num_animation); + + + if(g_rand_boolean(ad->rnd)){ + fishes[i].rev = 1; + fishes[i].travel = + g_rand_int_range(ad->rnd, 0, (ad->virtual_aquarium_x - ad->xmax) / 2) + + fishes[i].width; + fishes[i].tx = -fishes[i].width - fishes[i].travel; + } else { + fishes[i].rev = 0; + fishes[i].travel = + g_rand_int_range(ad->rnd, 0, (ad->virtual_aquarium_x - ad->xmax) / 2) + + fishes[i].width; + fishes[i].tx = ad->xmax + fishes[i].travel; + } + fishes[i].y = g_rand_int_range(ad->rnd, 0, (ad->virtual_aquarium_y - fishes[i].height)); + + fishes[i].speed_mul = 1.0 + g_rand_double_range(ad->rnd, -15.0 / 100.0, 15.0 / 100.0); + } + + } else { + /* Don't draw zombie fish */ + continue; + } + } + + + /* frozen fish doesn't need to be handled, or drawn */ + if (fishes[i].speed_mul == 0) + continue; + + if((fishes[i].type == BDWELLER || fishes[i].type == HAWTHORNE) && !bottom->have_sea_floor) + continue; + + /* move fish in horizontal direction, left or right */ + /* Large aquarium, the fishes are shown more seldom */ + + if (!fishes[i].rev) { + + fishes[i].tx -= + (fishes[i].speed[fishes[i].frame]) * (fishes[i].speed_mul * fish_settings.speed / 100); + + if (fishes[i].tx < (-fishes[i].width - fishes[i].travel)) { + /* we moved out of bounds. change direction, + * position, speed. */ + + fishes[i].travel = g_rand_int_range(ad->rnd, 0, (ad->virtual_aquarium_x - ad->xmax) / 2) + + fishes[i].width; + fishes[i].tx = -fishes[i].width - fishes[i].travel; + fishes[i].rev = 1; + + /* If bottom creature, keep the the Y level */ + if(fishes[i].type != BDWELLER && fishes[i].type != HAWTHORNE) + fishes[i].y = g_rand_int_range(ad->rnd, 0, ad->virtual_aquarium_y - fishes[i].height); + + + if (ad->proximity) + fishes[i].speed_mul = 0; + else + fishes[i].speed_mul = 1; + + } + } else { + + + fishes[i].tx += + (fishes[i].speed[fishes[i].frame]) * (fishes[i].speed_mul * fish_settings.speed / 100); + + + if (fishes[i].tx > ad->xmax + fishes[i].travel) { + /* we moved out of bounds. change direction, + * position, speed. */ + + fishes[i].travel = g_rand_int_range(ad->rnd, 0, (ad->virtual_aquarium_x - ad->xmax) / 2) + + fishes[i].width; + fishes[i].tx = ad->xmax + fishes[i].travel; + fishes[i].rev = 0; + + /* If bottom creature, keep the the Y level */ + if(fishes[i].type != BDWELLER && fishes[i].type != HAWTHORNE) + fishes[i].y = g_rand_int_range(ad->rnd, 0, ad->virtual_aquarium_y - fishes[i].height); + + if (ad->proximity) + fishes[i].speed_mul = 0; + else + fishes[i].speed_mul = 1; + + } + } + + /* move fish in vertical position randomly by one pixel up or down */ + /* If the fish last time moved up or down, larger chance that it does that again. */ + + j = g_rand_int_range(ad->rnd, 0, 16); + + /* The bottondweller & hawthorne shall be still ;-) */ + if(fishes[i].type == BDWELLER || fishes[i].type == HAWTHORNE) + j = 0; + + if (((fishes[i].updown == 1) && (j == 6 || j == 7 || j == 8)) + || j == 8) { + fishes[i].y++; + fishes[i].updown = 1; + } else if (((fishes[i].updown == -1) + && (j == 12 || j == 13 || j == 14)) || j == 12) { + fishes[i].y--; + fishes[i].updown = -1; + } else + fishes[i].updown = 0; +#ifdef DEBUG + /* printf("\t\t - Calling draw_fish()\n");*/ +#endif + /* animate fishes using fish_animation array */ + aquarium_draw_image((int) fishes[i].tx, + fishes[i].y - ad->viewpoint_start_y, + fishes[i].animation[fishes[i].frame], + fishes[i].rev, fishes[i].image); + + /* switch to next swimming frame */ + + + fishes[i].delay += fishes[i].speed[fishes[i].frame] * fishes[i].fast_frame_change; +#ifdef DEGUG + printf("delay:%f speed:%f frame:%d num_ani:%d anipic:%d\n", + fishes[i].delay, fishes[i].speed[fishes[i].frame],fishes[i].frame, fishes[i].num_animation, fishes[i].animation[fishes[i].frame]); +#endif + if (fishes[i].delay >= (7 * fishes[i].speed[fishes[i].frame])) { + if (fishes[i].frame >= (fishes[i].num_animation - 1)){ + fishes[i].frame = 0; + } + else fishes[i].frame ++; + fishes[i].delay = 0; + } + + } +} + +static void fish_flip(SA_Image *this_fish) +{ + int j, k, ypos; + + if(this_fish->image != NULL){ + + this_fish->rev = g_malloc0(this_fish->width * + this_fish->full_height * 4 ); + + for(j = 0;j < (this_fish->full_height); j++){ + ypos = j * this_fish->width * 4; + for(k = 0; k < this_fish->width; k++){ + this_fish->rev[ypos + (this_fish->width - k - 1) * 4] = this_fish->image[ypos + k * 4]; + this_fish->rev[ypos + (this_fish->width - k - 1) * 4 + 1] = this_fish->image[ypos + k * 4 + 1]; + this_fish->rev[ypos + (this_fish->width - k - 1) * 4 + 2] = this_fish->image[ypos + k * 4 + 2]; + this_fish->rev[ypos + (this_fish->width - k - 1) * 4 + 3] = this_fish->image[ypos + k * 4 + 3]; + } + } + } +} + + +void fish_turn(void) +{ + int i, m; + + + if(fish_settings.scale_diff) + m = fish_settings.num_fish; + else + m = NUMOFFISHTYPES; + + for(i = 0; i < m; i++){ + fish_flip(&fish_buffer[i]); + } + + fish_flip(&blowup_data); + fish_flip(&prey_hunter_data); + +} + + +void fish_init(void) +{ + int i, num_bottom_fish; + int type = 0, special_fish = 0; + + Bottom_settings *bottom_settings; + + bottom_settings = bottom_get_settings_ptr(); + + /* Set up this for the rest of the life */ + ad = aquarium_get_settings_ptr(); + + ad->special_action = 0; + + + /* Save settings for fish_exit() */ + scale_diff = fish_settings.scale_diff; + + /* 0 - 30 fishes */ + if(fish_settings.type == RANDOM_POP_FISH) + fish_settings.num_fish = g_rand_int_range(ad->rnd, 1, 30); + + num_fish = fish_settings.num_fish; + + if(fish_settings.scale_diff) + fish_buffer = g_malloc0(sizeof(SA_Image) * fish_settings.num_fish); + else + fish_buffer = g_malloc0(sizeof(SA_Image) * NUMOFFISHTYPES); + + + fishes = g_malloc0(sizeof(Fish) * fish_settings.num_fish); + + num_bottom_fish = bottom_settings->num_bottom_animals; + + if(num_bottom_fish > num_fish) + num_bottom_fish = num_fish; + + for (i = 0; i < fish_settings.num_fish; i++) { + + if(fish_settings.type == RANDOM_FISH || fish_settings.type == RANDOM_POP_FISH) { + + /* FIX ME! Bottom dweller and hawthorne chance !*/ + if((ihave_sea_floor)) { + + if(g_rand_boolean(ad->rnd)) + type = BDWELLER; + else type = HAWTHORNE; + } + else + do{ + type = g_rand_int_range(ad->rnd, 0, NUMOFFISHTYPES); + } while(type == BDWELLER || type == HAWTHORNE); + } + else{ + type = sel_fish(i, FALSE); + } + + + if(type == PREY) special_fish |= 1; + if(type == HUNTER) special_fish |= 2; + if(type == SWORDFISH) special_fish |= 4; + if(type == BLOWFISH) special_fish |= 8; + + + if(!fish_settings.scale_diff){ + + if (fish_buffer[type].image == NULL) { + load_image_n_scale(fish_animation[type].file, + &fish_buffer[type], + fish_animation[type].pics, + fish_settings.scale); + + } + + fishes[i].width = fish_buffer[type].width; + fishes[i].height = fish_buffer[type].height; + + fishes[i].image = &fish_buffer[type]; + + } else { + + if(type != HUNTER && type != BLOWFISH){ + load_image_n_scale(fish_animation[type].file, &fish_buffer[i], + fish_animation[type].pics, + abs(fish_settings.scale + (g_rand_int_range(ad->rnd, -15, 15)) * fish_settings.scale / 100) ); + } else { + if(type == HUNTER) hunter_is = i; + if(type == BLOWFISH) blowfish_is = i; + + load_image_n_scale(fish_animation[type].file, &fish_buffer[i], + fish_animation[type].pics, + fish_settings.scale); + } + + fishes[i].width = fish_buffer[i].width; + fishes[i].height = fish_buffer[i].height; + + fishes[i].image = &fish_buffer[i]; + + } + + + fishes[i].num_animation = fish_animation[type].frames; + fishes[i].animation = fish_animation[type].animation; + + fishes[i].speed = fish_animation[type].speed; + + + fishes[i].type = type; + fishes[i].frame = g_rand_int_range(ad->rnd, 0, fishes[i].num_animation); + + fishes[i].rev = g_rand_boolean(ad->rnd); + fishes[i].tx = g_rand_int_range(ad->rnd, 0, ad->virtual_aquarium_x - fishes[i].width); + + fishes[i].speed_mul = 1.0 + g_rand_double_range(ad->rnd, -15.0 / 100.0, 15.0 / 100.0); + + + fishes[i].fast_frame_change = 1.0; + + fishes[i].is_dead = FALSE; + + fishes[i].updown = 0; + fishes[i].travel = g_rand_int_range(ad->rnd, 0, (ad->virtual_aquarium_x - ad->xmax) / 2) + fishes[i].width; + fishes[i].y = g_rand_int_range(ad->rnd, 0, ad->virtual_aquarium_y - fishes[i].height); + + } + + + if((special_fish & 3) == 3 && fish_settings.eat){ + load_image_n_scale("sherman/eating.png", + &prey_hunter_data, + 7, fish_settings.scale); + + ad->special_action |= 1; + } else + prey_hunter_data.pixbuf = NULL; + + if((special_fish & 12) == 12 && fish_settings.explode){ + load_image_n_scale("sherman/blowup.png", + &blowup_data, + 7, fish_settings.scale); + + ad->special_action|=2; + } + else + blowup_data.pixbuf = NULL; + +} + + +void fish_exit(void) +{ + int i,j; + + if(scale_diff) + j = num_fish; + else + j = NUMOFFISHTYPES; + + for(i = 0; i < j; i++){ + if(fish_buffer[i].pixbuf != NULL){ + g_object_unref(fish_buffer[i].pixbuf); + + if(fish_buffer[i].rev !=NULL) + g_free(fish_buffer[i].rev); + } + } + + + if(blowup_data.pixbuf != NULL){ + g_object_unref(blowup_data.pixbuf); + + if(blowup_data.rev != NULL) + g_free(blowup_data.rev); + + } + + if(prey_hunter_data.pixbuf != NULL){ + g_object_unref(prey_hunter_data.pixbuf); + + if(prey_hunter_data.rev != NULL) + g_free(prey_hunter_data.rev); + } + + g_free(fish_buffer); + g_free(fishes); +} + + diff --git a/sherman-aquarium/shermans/fish.h b/sherman-aquarium/shermans/fish.h new file mode 100644 index 0000000..28f0ee5 --- /dev/null +++ b/sherman-aquarium/shermans/fish.h @@ -0,0 +1,133 @@ +#ifndef FISH_H +#define FISH_H + +#include "aquarium.h" + +#define FISH1 0 +#define FISH2 1 +#define FISH3 2 +#define FISH4 3 +#define FISH5 4 +#define FISH6 5 +#define SQUID 6 +#define SWORDFISH 7 +#define BLOWFISH 8 +#define ERNEST 9 +#define HUNTER 10 +#define LORI 11 +#define PREY 12 +#define SHERMAN 13 +#define FILLMORE 14 +#define BDWELLER 15 +#define HAWTHORNE 16 +#define MEGAN 17 + +/* Default size of fishes */ +#define DEFAULT_SCALE 50 + +#define DEFAULT_SPEED 100 + +#define FULLSCREEN_DEFAULT_SCALE 60 + +/* how many fishes do you want in your aquarium? */ +#define NRFISH 10 +#define FULLSCREEN_NRFISH 20 + +/* The number of fishes you have graphic for */ +#define NUMOFFISHTYPES 18 + + + +#define RANDOM_FISH 0 +#define SELECTION_FISH 1 +#define RANDOM_POP_FISH 2 + + +/* structure describing each fish */ +typedef struct { + + float tx; /* current x position */ + int y; /* current y position */ + int travel; /* how far to move beyond the screen */ + int rev; /* going left or right? */ + int frame; /* current animation frame */ + float delay; /* how quick we swap frames */ + int updown; /* Was last moment up or down? - Larger chance to do it again. */ + int type; /* Kind of fish */ + int width; + int height; + SA_Image *image; + int *animation; + int num_animation; + float *speed; + float speed_mul; + float fast_frame_change; + int is_dead; /* Is the fish alive? I.E, eaten prey or punched blowfish? */ +} Fish; + + +typedef struct { + char *file; + int pics; + int frames; + int *animation; + float *speed; +} Fish_animation; + + + +typedef struct +{ + int eat; + int explode; + int scale; + + /* Have a scale difference of +- 15% */ + int scale_diff; + + /* 100 = Original speed */ + int speed; + + int rebirth; + + int num_fish; + int type; + + /* Agressiveness of hunter and swordfish */ + int swordfish_agr, hunter_agr; + + + int fish1; + int fish2; + int fish3; + int fish4; + int fish5; + int fish6; + int swordfish; + int blowfish; + int fillmore; + int sherman; + int prey; + int hunter; + int lori; + int ernest; + int squid; + int megan; + int bdweller; + int hawthorne; +} Fish_settings; + +Fish *fish_get_fishes_ptr(void); +Fish_settings *fish_get_settings_ptr(void); +/*SA_Image *fish_get_blowup_data_ptr(void); +SA_Image *fish_get_prey_hunter_data_ptr(void); +Fish_animation **fish_get_fish_animation_ptr(void);*/ + +void fish_enter(void); +void fish_leave(void); +void fish_init(void); +void fish_turn(void); +void fish_exit(void); +void fish_update(void); + +#endif diff --git a/sherman-aquarium/shermans/getopt.h b/sherman-aquarium/shermans/getopt.h new file mode 100644 index 0000000..a1b8dd6 --- /dev/null +++ b/sherman-aquarium/shermans/getopt.h @@ -0,0 +1,180 @@ +/* Declarations for getopt. + Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GETOPT_H + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif + +/* If __GNU_LIBRARY__ is not already defined, either we are being used + standalone, or this is the first header included in the source file. + If we are being used with glibc, we need to include , but + that does not exist if we are standalone. So: if __GNU_LIBRARY__ is + not defined, include , which will pull in for us + if it's from glibc. (Why ctype.h? It's guaranteed to exist and it + doesn't flood the namespace with stuff the way some other headers do.) */ +#if !defined __GNU_LIBRARY__ +# include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +#ifndef __need_getopt +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +# if (defined __STDC__ && __STDC__) || defined __cplusplus + const char *name; +# else + char *name; +# endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +# define no_argument 0 +# define required_argument 1 +# define optional_argument 2 +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `--', then non-option arguments are treated as + arguments to the option '\0'. This behavior is specific to the GNU + `getopt'. */ + +#if (defined __STDC__ && __STDC__) || defined __cplusplus +# ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int __argc, char *const *__argv, const char *__shortopts); +# else /* not __GNU_LIBRARY__ */ +extern int getopt (); +# endif /* __GNU_LIBRARY__ */ + +# ifndef __need_getopt +extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, + const struct option *__longopts, int *__longind); +extern int getopt_long_only (int __argc, char *const *__argv, + const char *__shortopts, + const struct option *__longopts, int *__longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int __argc, char *const *__argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only); +# endif +#else /* not __STDC__ */ +extern int getopt (); +# ifndef __need_getopt +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +# endif +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + +#endif /* getopt.h */ diff --git a/sherman-aquarium/shermans/getopt1.c b/sherman-aquarium/shermans/getopt1.c new file mode 100644 index 0000000..8422d6b --- /dev/null +++ b/sherman-aquarium/shermans/getopt1.c @@ -0,0 +1,190 @@ + +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "getopt.h" + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ + diff --git a/sherman-aquarium/shermans/grabscreen.c b/sherman-aquarium/shermans/grabscreen.c new file mode 100644 index 0000000..885ba64 --- /dev/null +++ b/sherman-aquarium/shermans/grabscreen.c @@ -0,0 +1,830 @@ +/* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 1998 + * 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. + */ + +/* This file contains code for grabbing an image of the screen to hack its + bits. This is a little tricky, since doing this involves the need to tell + the difference between drawing on the actual root window, and on the fake + root window used by the screensaver, since at this level the illusion + breaks down... + */ + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_XMU +# ifndef VMS +# include +# else /* VMS */ +# include +# endif /* VMS */ +#endif + +#include "grabscreen.h" + +#include "vroot.h" +#undef RootWindowOfScreen +#undef RootWindow +#undef DefaultRootWindow + + +#ifdef HAVE_READ_DISPLAY_EXTENSION +# include + static Bool read_display (Screen *, Window, Pixmap, Bool); +#endif /* HAVE_READ_DISPLAY_EXTENSION */ + + +static void copy_default_colormap_contents (Screen *, Colormap, Visual *); + +#ifdef HAVE_READ_DISPLAY_EXTENSION +static void allocate_cubic_colormap (Screen *, Window, Visual *); +void remap_image (Screen *, Window, Colormap, XImage *); +#endif + + +static Bool +MapNotify_event_p (Display *dpy, XEvent *event, XPointer window) +{ + return (event->xany.type == MapNotify && + event->xvisibility.window == (Window) window); +} + + +void +grabscreen_verbose(void) +{ +} + + +static void +raise_window(Display *dpy, Window window, Bool dont_wait) +{ + + if (! dont_wait) + { + XWindowAttributes xgwa; + XSizeHints hints; + long supplied = 0; + memset(&hints, 0, sizeof(hints)); + XGetWMNormalHints(dpy, window, &hints, &supplied); + XGetWindowAttributes (dpy, window, &xgwa); + hints.x = xgwa.x; + hints.y = xgwa.y; + hints.width = xgwa.width; + hints.height = xgwa.height; + hints.flags |= (PPosition|USPosition|PSize|USSize); + XSetWMNormalHints(dpy, window, &hints); + + XSelectInput (dpy, window, (xgwa.your_event_mask | StructureNotifyMask)); + } + + XMapRaised(dpy, window); + + if (! dont_wait) + { + XEvent event; + XIfEvent (dpy, &event, MapNotify_event_p, (XPointer) window); + XSync (dpy, True); + } +} + + +static Bool +xscreensaver_window_p (Display *dpy, Window window) +{ + Atom type; + int format; + unsigned long nitems, bytesafter; + char *version; + if (XGetWindowProperty (dpy, window, + XInternAtom (dpy, "_SCREENSAVER_VERSION", False), + 0, 1, False, XA_STRING, + &type, &format, &nitems, &bytesafter, + (unsigned char **) &version) + == Success + && type != None) + return True; + return False; +} + + + +/* Whether the given window is: + - the real root window; + - the virtual root window; + - a direct child of the root window; + - a direct child of the window manager's decorations. + */ +Bool +top_level_window_p (Screen *screen, Window window) +{ + Display *dpy = DisplayOfScreen (screen); + Window root, parent, *kids; + Window vroot = VirtualRootWindowOfScreen(screen); + unsigned int nkids; + + if (window == vroot) + return True; + + if (!XQueryTree (dpy, window, &root, &parent, &kids, &nkids)) + return False; + + if (window == root) + return True; + + /* If our direct parent is the root (or *a* root), then yes. */ + if (parent == root || parent == vroot) + return True; + else + { + Atom type = None; + int format; + unsigned long nitems, bytesafter; + unsigned char *data; + + /* If our direct parent has the WM_STATE property, then it is a + window manager decoration -- yes. + */ + if (XGetWindowProperty (dpy, window, + XInternAtom (dpy, "WM_STATE", True), + 0, 0, False, AnyPropertyType, + &type, &format, &nitems, &bytesafter, + (unsigned char **) &data) + == Success + && type != None) + return True; + } + + /* Else, no. We're deep in a tree somewhere. + */ + return False; +} + + + +static XErrorHandler old_ehandler = 0; +static int +BadWindow_ehandler (Display *dpy, XErrorEvent *error) +{ + if (error->error_code == BadWindow || error->error_code == BadDrawable) + return 0; + else if (!old_ehandler) + { + abort(); + return 0; + } + else + return (*old_ehandler) (dpy, error); +} + + +/* XCopyArea seems not to work right on SGI O2s if you draw in SubwindowMode + on a window whose depth is not the maximal depth of the screen? Or + something. Anyway, things don't work unless we: use SubwindowMode for + the real root window (or a legitimate virtual root window); but do not + use SubwindowMode for the xscreensaver window. I make no attempt to + explain. + */ +Bool +use_subwindow_mode_p(Screen *screen, Window window) +{ + if (window != VirtualRootWindowOfScreen(screen)) + return False; + else if (xscreensaver_window_p(DisplayOfScreen(screen), window)) + return False; + else + return True; +} + + +/* Install the colormaps of all visible windows, deepest first. + This should leave the colormaps of the topmost windows installed + (if only N colormaps can be installed at a time, then only the + topmost N windows will be shown in the right colors.) + */ +static void +install_screen_colormaps (Screen *screen) +{ + int i; + Display *dpy = DisplayOfScreen (screen); + Window vroot, real_root; + Window parent, *kids = 0; + unsigned int nkids = 0; + + XSync (dpy, False); + old_ehandler = XSetErrorHandler (BadWindow_ehandler); + + vroot = VirtualRootWindowOfScreen (screen); + if (XQueryTree (dpy, vroot, &real_root, &parent, &kids, &nkids)) + for (i = 0; i < nkids; i++) + { + XWindowAttributes xgwa; + Window client; +#ifdef HAVE_XMU + /* #### need to put XmuClientWindow() in xmu.c, sigh... */ + if (! (client = XmuClientWindow (dpy, kids[i]))) +#endif + client = kids[i]; + xgwa.colormap = 0; + XGetWindowAttributes (dpy, client, &xgwa); + if (xgwa.colormap && xgwa.map_state == IsViewable) + XInstallColormap (dpy, xgwa.colormap); + } + XInstallColormap (dpy, DefaultColormapOfScreen (screen)); + XSync (dpy, False); + XSetErrorHandler (old_ehandler); + XSync (dpy, False); + + if (kids) + XFree ((char *) kids); +} + + +void +grab_screen_image (Screen *screen, Window window) +{ + Display *dpy = DisplayOfScreen (screen); + XWindowAttributes xgwa; + Window real_root; + Bool root_p; + Bool saver_p; + Bool grab_mouse_p = False; + int unmap_time = 0; + + real_root = XRootWindowOfScreen (screen); /* not vroot */ + root_p = (window == real_root); + saver_p = xscreensaver_window_p (dpy, window); + + XGetWindowAttributes (dpy, window, &xgwa); + screen = xgwa.screen; + + if (saver_p) + /* I think this is redundant, but just to be safe... */ + root_p = False; + + if (saver_p) + /* The only time grabbing the mouse is important is if this program + is being run while the saver is locking the screen. */ + grab_mouse_p = True; + + if (!root_p) + { + double unmap = 0; + if (saver_p) + { + unmap = 2.5; + } + else + { + unmap = 0.66; + } + unmap_time = unmap * 100000; + } + + + + if (!root_p && !top_level_window_p (screen, window)) + { + return; + } + + + if (!root_p) + XSetWindowBackgroundPixmap (dpy, window, None); + + if (grab_mouse_p) + { + /* prevent random viewer of the screen saver (locker) from messing + with windows. We don't check whether it succeeded, because what + are our options, really... */ + XGrabPointer (dpy, real_root, True, ButtonPressMask|ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, None, None, CurrentTime); + XGrabKeyboard (dpy, real_root, True, GrabModeSync, GrabModeAsync, + CurrentTime); + } + + if (unmap_time > 0) + { + XUnmapWindow (dpy, window); + install_screen_colormaps (screen); + XSync (dpy, True); + usleep(unmap_time); /* wait for everyone to swap in and handle exposes */ + } + + if (!root_p) + { +#ifdef HAVE_READ_DISPLAY_EXTENSION + if (! read_display(screen, window, 0, saver_p)) +#endif /* HAVE_READ_DISPLAY_EXTENSION */ + { + + // copy_default_colormap_contents (screen, xgwa.colormap, xgwa.visual); + raise_window(dpy, window, saver_p); + + /* Generally it's bad news to call XInstallColormap() explicitly, + but this file does a lot of sleazy stuff already... This is to + make sure that the window's colormap is installed, even in the + case where the window is OverrideRedirect. */ + if (xgwa.colormap) XInstallColormap (dpy, xgwa.colormap); + XSync (dpy, False); + } + } + else /* root_p */ + { + Pixmap pixmap; + pixmap = XCreatePixmap(dpy, window, xgwa.width, xgwa.height, xgwa.depth); + +#ifdef HAVE_READ_DISPLAY_EXTENSION + if (! read_display(screen, window, pixmap, True)) +#endif + { + Window real_root = XRootWindowOfScreen (screen); /* not vroot */ + XGCValues gcv; + GC gc; + + copy_default_colormap_contents (screen, xgwa.colormap, xgwa.visual); + + gcv.function = GXcopy; + gcv.subwindow_mode = IncludeInferiors; + gc = XCreateGC (dpy, window, GCFunction | GCSubwindowMode, &gcv); + XCopyArea (dpy, real_root, pixmap, gc, + xgwa.x, xgwa.y, xgwa.width, xgwa.height, 0, 0); + XFreeGC (dpy, gc); + } + XSetWindowBackgroundPixmap (dpy, window, pixmap); + XFreePixmap (dpy, pixmap); + } + + if (grab_mouse_p) + { + XUngrabPointer (dpy, CurrentTime); + XUngrabKeyboard (dpy, CurrentTime); + } + + XSync (dpy, True); +} + + +/* When we are grabbing and manipulating a screen image, it's important that + we use the same colormap it originally had. So, if the screensaver was + started with -install, we need to copy the contents of the default colormap + into the screensaver's colormap. + */ +static void +copy_default_colormap_contents (Screen *screen, + Colormap to_cmap, + Visual *to_visual) +{ + Display *dpy = DisplayOfScreen (screen); + Visual *from_visual = DefaultVisualOfScreen (screen); + Colormap from_cmap = XDefaultColormapOfScreen (screen); + + XColor *old_colors, *new_colors; + unsigned long *pixels; + XVisualInfo vi_in, *vi_out; + int out_count; + int from_cells, to_cells, max_cells, got_cells; + int i; + + if (from_cmap == to_cmap) + return; + + vi_in.screen = XScreenNumberOfScreen (screen); + vi_in.visualid = XVisualIDFromVisual (from_visual); + vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask, + &vi_in, &out_count); + if (! vi_out) abort (); + from_cells = vi_out [0].colormap_size; + XFree ((char *) vi_out); + + vi_in.screen = XScreenNumberOfScreen (screen); + vi_in.visualid = XVisualIDFromVisual (to_visual); + vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask, + &vi_in, &out_count); + if (! vi_out) abort (); + to_cells = vi_out [0].colormap_size; + XFree ((char *) vi_out); + + max_cells = (from_cells > to_cells ? to_cells : from_cells); + + old_colors = (XColor *) calloc (sizeof (XColor), max_cells); + new_colors = (XColor *) calloc (sizeof (XColor), max_cells); + pixels = (unsigned long *) calloc (sizeof (unsigned long), max_cells); + for (i = 0; i < max_cells; i++) + old_colors[i].pixel = i; + XQueryColors (dpy, from_cmap, old_colors, max_cells); + + got_cells = max_cells; + //allocate_writable_colors (dpy, to_cmap, pixels, &got_cells); + + + if (got_cells <= 0) /* we're screwed */ + ; + else if (got_cells == max_cells && /* we're golden */ + from_cells == to_cells) + XStoreColors (dpy, to_cmap, old_colors, got_cells); + else /* try to cope... */ + { + for (i = 0; i < got_cells; i++) + { + XColor *c = old_colors + i; + int j; + for (j = 0; j < got_cells; j++) + if (pixels[j] == c->pixel) + { + /* only store this color value if this is one of the pixels + we were able to allocate. */ + XStoreColors (dpy, to_cmap, c, 1); + break; + } + } + } + + + + free (old_colors); + free (new_colors); + free (pixels); +} + + + +/* The SGI ReadDisplay extension. + This extension lets you get back a 24-bit image of the screen, taking into + account the colors with which all windows are *currently* displayed, even + if those windows have different visuals. Without this extension, presence + of windows with different visuals or colormaps will result in technicolor + when one tries to grab the screen image. + */ + +#ifdef HAVE_READ_DISPLAY_EXTENSION + +static Bool +read_display (Screen *screen, Window window, Pixmap into_pixmap, + Bool dont_wait) +{ + Display *dpy = DisplayOfScreen (screen); + XWindowAttributes xgwa; + int rd_event_base = 0; + int rd_error_base = 0; + unsigned long hints = 0; + XImage *image = 0; + XGCValues gcv; + int class; + GC gc; + Bool remap_p = False; + + /* Check to see if the server supports the extension, and bug out if not. + */ + if (! XReadDisplayQueryExtension (dpy, &rd_event_base, &rd_error_base)) + { + return False; + } + + /* If this isn't a visual we know how to handle, bug out. We handle: + = TrueColor in depths 8, 12, 15, 16, and 32; + = PseudoColor and DirectColor in depths 8 and 12. + */ + XGetWindowAttributes(dpy, window, &xgwa); + class = visual_class (screen, xgwa.visual); + if (class == TrueColor) + { + if (xgwa.depth != 8 && xgwa.depth != 12 && xgwa.depth != 15 && + xgwa.depth != 16 && xgwa.depth != 24 && xgwa.depth != 32) + { + return False; + } + } + else if (class == PseudoColor || class == DirectColor) + { + if (xgwa.depth != 8 && xgwa.depth != 12) + { + return False; + } + else + /* Allocate a TrueColor-like spread of colors for the image. */ + remap_p = True; + } + + + /* Try and read the screen. + */ + hints = (XRD_TRANSPARENT | XRD_READ_POINTER); + image = XReadDisplay (dpy, window, xgwa.x, xgwa.y, xgwa.width, xgwa.height, + hints, &hints); + if (!image) + { + return False; + } + if (!image->data) + { + XDestroyImage(image); + return False; + } + + /* XReadDisplay tends to LIE about the depth of the image it read. + It is returning an XImage which has `depth' and `bits_per_pixel' + confused! + + That is, on a 24-bit display, where all visuals claim depth 24, and + where XGetImage would return an XImage with depth 24, and where + XPutImage will get a BadMatch with images that are not depth 24, + XReadDisplay is returning images with depth 32! Fuckwits! + + So if the visual is of depth 24, but the image came back as depth 32, + hack it to be 24 lest we get a BadMatch from XPutImage. + + I wonder what happens on an 8-bit SGI... Probably it still returns + an image claiming depth 32? Certainly it can't be 8. So, let's just + smash it to 32... + */ + if (image->depth == 32 /* && xgwa.depth == 24 */ ) + image->depth = 24; + + /* If the visual of the window/pixmap into which we're going to draw is + less deep than the screen itself, then we need to convert the grabbed bits + to match the depth by clipping off the less significant bit-planes of each + color component. + */ + if (image->depth > xgwa.depth) + { + int x, y; + /* We use the same image->data in both images -- that's ok, because + since we're reading from B and writing to A, and B uses more bytes + per pixel than A, the write pointer won't overrun the read pointer. + */ + XImage *image2 = XCreateImage (dpy, xgwa.visual, xgwa.depth, + ZPixmap, 0, image->data, + xgwa.width, xgwa.height, + 8, 0); + if (!image2) + { + return False; + } + + + for (y = 0; y < image->height; y++) + for (x = 0; x < image->width; x++) + { + /* #### really these shift values should be determined from the + mask values -- but that's a pain in the ass, and anyway, + this is an SGI-specific extension so hardcoding assumptions + about the SGI server's behavior isn't *too* heinous... */ + unsigned long pixel = XGetPixel(image, x, y); + unsigned int r = (pixel & image->red_mask); + unsigned int g = (pixel & image->green_mask) >> 8; + unsigned int b = (pixel & image->blue_mask) >> 16; + + if (xgwa.depth == 8) + pixel = ((r >> 5) | ((g >> 5) << 3) | ((b >> 6) << 6)); + else if (xgwa.depth == 12) + pixel = ((r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8)); + else if (xgwa.depth == 16 || xgwa.depth == 15) + /* Gah! I don't understand why these are in the other order. */ + pixel = (((r >> 3) << 10) | ((g >> 3) << 5) | ((b >> 3))); + else + abort(); + + XPutPixel(image2, x, y, pixel); + } + image->data = 0; + XDestroyImage(image); + image = image2; + } + + if (remap_p) + { + allocate_cubic_colormap (screen, window, xgwa.visual); + remap_image (screen, window, xgwa.colormap, image); + } + + /* Now actually put the bits into the window or pixmap -- note the design + bogosity of this extension, where we've been forced to take 24 bit data + from the server to the client, and then push it back from the client to + the server, *without alteration*. We should have just been able to tell + the server, "put a screen image in this drawable", instead of having to + go through the intermediate step of converting it to an Image. Geez. + (Assuming that the window is of screen depth; we happen to handle less + deep windows, but that's beside the point.) + */ + gcv.function = GXcopy; + gc = XCreateGC (dpy, window, GCFunction, &gcv); + + if (into_pixmap) + { + gcv.function = GXcopy; + gc = XCreateGC (dpy, into_pixmap, GCFunction, &gcv); + XPutImage (dpy, into_pixmap, gc, image, 0, 0, 0, 0, + xgwa.width, xgwa.height); + } + else + { + gcv.function = GXcopy; + gc = XCreateGC (dpy, window, GCFunction, &gcv); + + /* Ok, now we'll be needing that window on the screen... */ + raise_window(dpy, window, dont_wait); + + /* Plop down the bits... */ + XPutImage (dpy, window, gc, image, 0, 0, 0, 0, xgwa.width, xgwa.height); + } + XFreeGC (dpy, gc); + + if (image->data) + { + free(image->data); + image->data = 0; + } + XDestroyImage(image); + + return True; +} +#endif /* HAVE_READ_DISPLAY_EXTENSION */ + + +#ifdef HAVE_READ_DISPLAY_EXTENSION + +/* Makes and installs a colormap that makes a PseudoColor or DirectColor + visual behave like a TrueColor visual of the same depth. + */ +static void +allocate_cubic_colormap (Screen *screen, Window window, Visual *visual) +{ + Display *dpy = DisplayOfScreen (screen); + XWindowAttributes xgwa; + Colormap cmap; + int nr, ng, nb, cells; + int r, g, b; + int depth; + XColor colors[4097]; + int i; + + XGetWindowAttributes (dpy, window, &xgwa); + cmap = xgwa.colormap; + depth = visual_depth(screen, visual); + + switch (depth) + { + case 8: nr = 3; ng = 3; nb = 2; cells = 256; break; + case 12: nr = 4; ng = 4; nb = 4; cells = 4096; break; + default: abort(); break; + } + + memset(colors, 0, sizeof(colors)); + for (r = 0; r < (1 << nr); r++) + for (g = 0; g < (1 << ng); g++) + for (b = 0; b < (1 << nb); b++) + { + i = (r | (g << nr) | (b << (nr + ng))); + colors[i].pixel = i; + colors[i].flags = DoRed|DoGreen|DoBlue; + if (depth == 8) + { + colors[i].red = ((r << 13) | (r << 10) | (r << 7) | + (r << 4) | (r << 1)); + colors[i].green = ((g << 13) | (g << 10) | (g << 7) | + (g << 4) | (g << 1)); + colors[i].blue = ((b << 14) | (b << 12) | (b << 10) | + (b << 8) | (b << 6) | (b << 4) | + (b << 2) | b); + } + else + { + colors[i].red = (r << 12) | (r << 8) | (r << 4) | r; + colors[i].green = (g << 12) | (g << 8) | (g << 4) | g; + colors[i].blue = (b << 12) | (b << 8) | (b << 4) | b; + } + } + + { + int j; + int allocated = 0; + int interleave = cells / 8; /* skip around, rather than allocating in + order, so that we get better coverage if + we can't allocated all of them. */ + for (j = 0; j < interleave; j++) + for (i = 0; i < cells; i += interleave) + if (XAllocColor (dpy, cmap, &colors[i + j])) + allocated++; + + } +} + +static unsigned long +find_closest_pixel (XColor *colors, int ncolors, + unsigned long r, unsigned long g, unsigned long b) +{ + unsigned long distance = ~0; + int i, found = 0; + + if (ncolors == 0) + abort(); + for (i = 0; i < ncolors; i++) + { + unsigned long d; + int rd, gd, bd; + + rd = r - colors[i].red; + gd = g - colors[i].green; + bd = b - colors[i].blue; + if (rd < 0) rd = -rd; + if (gd < 0) gd = -gd; + if (bd < 0) bd = -bd; + d = (rd << 1) + (gd << 2) + bd; + + if (d < distance) + { + distance = d; + found = i; + if (distance == 0) + break; + } + } + + return found; +} + + +void +remap_image (Screen *screen, Window window, Colormap cmap, XImage *image) +{ + Display *dpy = DisplayOfScreen (screen); + unsigned long map[4097]; + int x, y, i; + int cells; + XColor colors[4097]; + + if (image->depth == 8) + cells = 256; + else if (image->depth == 12) + cells = 4096; + else + abort(); + + memset(map, -1, sizeof(*map)); + memset(colors, -1, sizeof(*colors)); + + for (i = 0; i < cells; i++) + colors[i].pixel = i; + XQueryColors (dpy, cmap, colors, cells); + + + for (i = 0; i < cells; i++) + { + unsigned short r, g, b; + + if (cells == 256) + { + /* "RRR GGG BB" In an 8 bit map. Convert that to + "RRR RRR RR" "GGG GGG GG" "BB BB BB BB" to give + an even spread. */ + r = (i & 0x07); + g = (i & 0x38) >> 3; + b = (i & 0xC0) >> 6; + + r = ((r << 13) | (r << 10) | (r << 7) | (r << 4) | (r << 1)); + g = ((g << 13) | (g << 10) | (g << 7) | (g << 4) | (g << 1)); + b = ((b << 14) | (b << 12) | (b << 10) | (b << 8) | + (b << 6) | (b << 4) | (b << 2) | b); + } + else + { + /* "RRRR GGGG BBBB" In a 12 bit map. Convert that to + "RRRR RRRR" "GGGG GGGG" "BBBB BBBB" to give an even + spread. */ + r = (i & 0x00F); + g = (i & 0x0F0) >> 4; + b = (i & 0xF00) >> 8; + + r = (r << 12) | (r << 8) | (r << 4) | r; + g = (g << 12) | (g << 8) | (g << 4) | g; + b = (b << 12) | (b << 8) | (b << 4) | b; + } + + map[i] = find_closest_pixel (colors, cells, r, g, b); + } + + + for (y = 0; y < image->height; y++) + for (x = 0; x < image->width; x++) + { + unsigned long pixel = XGetPixel(image, x, y); + if (pixel >= cells) abort(); + XPutPixel(image, x, y, map[pixel]); + } +} + + +#endif /* HAVE_READ_DISPLAY_EXTENSION */ diff --git a/sherman-aquarium/shermans/grabscreen.h b/sherman-aquarium/shermans/grabscreen.h new file mode 100644 index 0000000..416c6b2 --- /dev/null +++ b/sherman-aquarium/shermans/grabscreen.h @@ -0,0 +1,35 @@ +/* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 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 __GRABSCREEN_H__ +#define __GRABSCREEN_H__ + +/* This will write a snapshot of the screen image into the given window. + Beware that the colormap of the window may also be changed (to match + the bits that were drawn.) + */ +extern void grab_screen_image (Screen *, Window); + +/* Whether one should use GCSubwindowMode when drawing on this window + (assuming a screen image has been grabbed onto it.) Yes, this is a + total kludge. */ +extern Bool use_subwindow_mode_p(Screen *screen, Window window); + +/* Whether the given window is: + - the real root window; + - the virtual root window; + - a direct child of the root window; + - a direct child of the window manager's decorations. + */ +extern Bool top_level_window_p(Screen *screen, Window window); + +#endif /* __GRABSCREEN_H__ */ diff --git a/sherman-aquarium/shermans/images.c b/sherman-aquarium/shermans/images.c new file mode 100644 index 0000000..a6faa11 --- /dev/null +++ b/sherman-aquarium/shermans/images.c @@ -0,0 +1,73 @@ + +#include +#include +#include +#include "aquarium.h" + +extern int fullscreen, window_id; + +/* Declare it here to avoid warnings */ +GdkPixbuf *gai_load_image(const char *); + +void load_image(char *fname, SA_Image *image, int frames) +{ + + image->pixbuf = gai_load_image(fname); + image->frames = frames; + image->rev = NULL; + image->width = gdk_pixbuf_get_width(image->pixbuf); + image->full_height = gdk_pixbuf_get_height(image->pixbuf); + + image->rowstride = gdk_pixbuf_get_rowstride(image->pixbuf); + image->height = (int)((float)image->full_height / (float)frames+0.5); + image->image = gdk_pixbuf_get_pixels(image->pixbuf); +} + + + +void load_image_n_scale(char *fname, SA_Image *image, + int frames, int scale) +{ + + int w, h, newh, neww,i; + GdkPixbuf *tmpbuff, *workbuff1, *workbuff2; + + if(scale==100){ + load_image(fname,image,frames); + return; + } + + + tmpbuff = gai_load_image(fname); + image->frames = frames; + image->rev = NULL; + + w = gdk_pixbuf_get_width(tmpbuff); + h = gdk_pixbuf_get_height(tmpbuff); + + image->width = neww =(int)((((float)w * (float)scale) / 100.0)+0.5); + image->height = newh = (int)((((float)h / (float)frames) * (float)scale) / 100.0 + 0.5); + image->full_height = newh * frames; + + image->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE,8, + neww, + frames*newh); + + for(i=0;ipixbuf,0,newh*i); + g_object_unref(workbuff2); + + } + + + + + image->image = gdk_pixbuf_get_pixels(image->pixbuf); + image->rowstride = gdk_pixbuf_get_rowstride(image->pixbuf); + + g_object_unref(tmpbuff); + +} diff --git a/sherman-aquarium/shermans/leds.c b/sherman-aquarium/shermans/leds.c new file mode 100644 index 0000000..c448014 --- /dev/null +++ b/sherman-aquarium/shermans/leds.c @@ -0,0 +1,191 @@ + + +#include +#include +#include "leds.h" +#include "aquarium.h" +#include "draw.h" + +static SA_Image *led_images = NULL; +static int num_led_images = 0; +static Leds_settings leds_settings; +static AquariumData *ad; + +Leds_settings *leds_get_settings_ptr(void) +{ + return &leds_settings; +} + +/* + Returns the turned on leds: + Bit 0 is Capslock + Bit 1 is Numlock + Bit 2 is Scrollock +*/ + +/* + This code is based upon some lines(actually two lines :-) + in E-Leds by Mathias Meisfjordskar + Released under GPL. +*/ + +static int check_kleds(void) +{ + unsigned int states; + + if (XkbGetIndicatorState(GDK_DISPLAY(), XkbUseCoreKbd, &states) != Success) { + perror("Error while reading Indicator status\n"); + return -1; + } + return (states & 0x7); +} + +static int get_capslock(void) +{ + if((check_kleds() & 1) == 1) return 1; + else return 0; +} + +static int get_numlock(void) +{ + if((check_kleds() & 2) == 2) return 1; + else return 0; +} + +static int get_scrollock(void) +{ + if((check_kleds() & 4) == 4) return 1; + else return 0; +} + + +static void do_led(int func, int colour, int show_off, int x, int y, int alpha) +{ + int is_on; + + switch(func){ + case LEDS_OFF: + return; + case LEDS_CAPSLOCK: + is_on = get_capslock(); + break; + case LEDS_NUMLOCK: + is_on = get_numlock(); + break; + case LEDS_SCROLLOCK: + is_on = get_scrollock(); + break; + default: + is_on=0; + break; + } + + + if((!is_on && show_off) || is_on) + draw_pic_alpha(led_images[colour].image, + led_images[colour].width, + led_images[colour].height, + x, y, !is_on, alpha); + +} + +void leds_exit(void) +{ + int i; + + if(led_images == NULL) + return; + + for(i = 0; i < num_led_images; i++){ + if(led_images[i].image != NULL) + g_object_unref(led_images[i].pixbuf); + } + + g_free(led_images); + led_images = NULL; + num_led_images = 0; + +} + +void leds_init(void) +{ + int i; + char *led_files[] = { + "leds/blue.png", + "leds/bluegreen.png", + "leds/orange.png", + "leds/red.png", + "leds/violet.png", + "leds/yellow.png", + "leds/pink.png", + "leds/green.png", + "leds/darkblue.png", + "leds/lightblue.png", + "leds/yellowgreen.png", + NULL}; + + ad = aquarium_get_settings_ptr(); + + if(led_images != NULL) + leds_exit(); + + for(num_led_images=0; led_files[num_led_images] != NULL; num_led_images++); + + led_images = g_malloc0(sizeof(SA_Image) * num_led_images); + + for(i = 0; i < num_led_images; i++) + load_image(led_files[i], &led_images[i], 2); +} + + + + + +void leds_update(int beforeorafter) +{ + int numleds=0; + int x = 2, y = 2, i; + + if(beforeorafter != leds_settings.draw) + return; + + for(i = 0; i < 3 ; i++) + if(leds_settings.leds_func[i] != LEDS_OFF) + numleds++; + + switch(leds_settings.horz){ + case LEFT: + x = 2; + break; + case RIGHT: + x = ad->xmax-numleds * led_images[0].width - 2; + break; + case CENTER: + x = (ad->xmax-numleds * led_images[0].width) / 2; + break; + default: + break; + } + + switch(leds_settings.vert){ + case TOP: + y = 2; + break; + case BOTTOM: + y = ad->ymax-numleds * led_images[0].height - 2; + break; + case CENTER: + y = (ad->ymax-numleds * led_images[0].height) / 2; + break; + default: + break; + } + + for(i = 0; i < NUMLEDS; i++) + do_led(leds_settings.leds_func[i], + leds_settings.leds_colour[i], + leds_settings.leds_show_off[i], + x + !leds_settings.vert_horz * led_images[0].width * i, + y + leds_settings.vert_horz * led_images[0].height * i, leds_settings.alpha); + +} diff --git a/sherman-aquarium/shermans/leds.h b/sherman-aquarium/shermans/leds.h new file mode 100644 index 0000000..af109eb --- /dev/null +++ b/sherman-aquarium/shermans/leds.h @@ -0,0 +1,31 @@ +#ifndef LEDS_H +#define LEDS_H + +#define LEDS_OFF 0 +#define LEDS_NUMLOCK 1 +#define LEDS_CAPSLOCK 2 +#define LEDS_SCROLLOCK 3 + + +#define LEDS_VIOLET 0 +#define NUMLEDS 4 + +typedef struct +{ + + /* Lying or standing? */ + int vert_horz; + int horz, vert; + int draw; + int alpha; + + int leds_func[NUMLEDS], leds_colour[NUMLEDS], leds_show_off[NUMLEDS]; + + +} Leds_settings; + +void leds_init(void); +void leds_update(int); +void leds_exit(void); +Leds_settings *leds_get_settings_ptr(void); +#endif diff --git a/sherman-aquarium/shermans/matrix.c b/sherman-aquarium/shermans/matrix.c new file mode 100644 index 0000000..cd33f85 --- /dev/null +++ b/sherman-aquarium/shermans/matrix.c @@ -0,0 +1,236 @@ +#include +#include + + +#include "draw.h" +#include "aquarium.h" +#include "over.h" + +#include "matrix.h" + +/* + - Matrix scroller "plugin" for Sherman's aquarium - + + Yes, I know this is really out of the subject. + But one afternoon I was bored and felt for doing + this and nothing else. +*/ + +#define LETTERS 28 + + + +static gboolean *pauselist = NULL; +static int *charnum = NULL; + +static unsigned char **fallindata = NULL; + + +static int bright_x[8]; +static int bright_y[8]; +static int bright_num; +static int xrows, yrows; + + +static SA_Image matrix_dark, matrix_bright; + + +void make_matrix_line(int row, int start, int length) +{ + int i,k,j; + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + for(i = start; i < (start + length); i++){ + j = g_rand_int_range(ad->rnd, 0, LETTERS+5); + if(j < LETTERS){ + j = g_rand_int_range(ad->rnd, 2, 14); + for( k = i; ((k < (i + j)) && (k < (start + length))); k++) + fallindata[row][k] = g_rand_int_range(ad->rnd, 1, LETTERS); + } + else { + j = g_rand_int_range(ad->rnd, 10, 15); + for(k = i; ((k < (i + j)) && (k < (length + start))); k++) + fallindata[row][k] = 0; + } + i = k; + } +} + + +void matrix_init(void) +{ + + if(matrix_dark.pixbuf != NULL) + g_object_unref(matrix_dark.pixbuf); + + if(matrix_bright.pixbuf != NULL) + g_object_unref(matrix_dark.pixbuf); + + load_image("matrix1.png", + &matrix_dark, + LETTERS); + + load_image("matrix2.png", + &matrix_bright, + LETTERS); + +} + +void matrix_exit(void) +{ + + matrix_end(); + + if(matrix_dark.pixbuf != NULL) + g_object_unref(matrix_dark.pixbuf); + + if(matrix_bright.pixbuf != NULL) + g_object_unref(matrix_bright.pixbuf); + + matrix_dark.pixbuf = NULL; + matrix_bright.pixbuf = NULL; + + +} + +void matrix_start(void) +{ + int i; + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + xrows = (ad->xmax / matrix_dark.width) + 2; + yrows = (ad->ymax / matrix_dark.height) + 2; + + if(pauselist != NULL) + g_free(pauselist); + + if(charnum != NULL) + g_free(charnum); + + if(fallindata != NULL) + g_free(fallindata); + + pauselist = g_malloc0(sizeof(gboolean) * xrows); + charnum = g_malloc0(sizeof(int) * xrows); + fallindata = g_malloc0(sizeof(char *) * xrows); + + + bright_num = g_rand_int_range(ad->rnd, 0, 8); + + for(i = 0; i < bright_num; i++){ + bright_x[i] = g_rand_int_range(ad->rnd, 0, xrows); + bright_y[i] = g_rand_int_range(ad->rnd, 0, yrows); + } + + for(i = 0; i < xrows; i++){ + pauselist[i] = FALSE; + fallindata[i] = g_malloc0(2 * yrows + 2); + make_matrix_line(i, 0, yrows); + make_matrix_line(i, yrows, yrows); + charnum[i] = g_rand_int_range(ad->rnd, 0, 2 * yrows); + } + +} + + +void matrix_end(void) +{ + int i; + + if(fallindata != NULL){ + for(i = 0; i < xrows; i++){ + if(fallindata[i] != NULL) + g_free(fallindata[i]); + } + g_free(fallindata); + } + + if(pauselist != NULL) + g_free(pauselist); + + if(charnum != NULL) + g_free(charnum); + + charnum = NULL; + pauselist = NULL; + fallindata = NULL; + +} + +void matrix_update(void) +{ + AquariumData *ad; + int j, i, k, y, x = -4, c, a = 0; + int sum = 0; + + ad = aquarium_get_settings_ptr(); + + for(j = 0;j < xrows; j++){ + y=0; + + if(charnum[j] < (2 * yrows - 5)) + a = 5; + else + a = 2 * yrows-charnum[j]; + + for(k = charnum[j]; k < (charnum[j] + a); k++) + sum += (int)fallindata[j][k]; + + if(sum == 0 && pauselist[j] == -79){ + if(g_rand_int_range(ad->rnd, 0, 5) == 4) + pauselist[j] = 10; + } + else + pauselist[j] = -79; + + if(pauselist[j] <= 0){ + charnum[j]--; + if(charnum[j] <= 0) charnum[j] = 2 * yrows; + } + else + pauselist[j]--; + + c = charnum[j]; + + /* Draw all falling signs in a row */ + + for(;;){ /* */ + + over_draw(x, y, (int)fallindata[j][c], + matrix_dark.width, + matrix_dark.height, + matrix_dark.image); + + if(c == yrows / 2) + make_matrix_line(j, yrows, yrows); + + if(c == 3 * yrows / 2) + make_matrix_line(j,0, yrows); + + if(c >= 2 * yrows) + c = 0; + + c++; + y += matrix_dark.height; + if(y > ad->ymax) + break; + } + x += matrix_dark.width; + + } + + for(i = 0; i < bright_num; i++){ + over_draw(bright_x[i] * matrix_bright.width - 4, + bright_y[i] * matrix_bright.height, + g_rand_int_range(ad->rnd, 1, LETTERS), + matrix_bright.width, + matrix_bright.height, + matrix_bright.image); + } + +} + diff --git a/sherman-aquarium/shermans/matrix.h b/sherman-aquarium/shermans/matrix.h new file mode 100644 index 0000000..2c6e5bf --- /dev/null +++ b/sherman-aquarium/shermans/matrix.h @@ -0,0 +1,11 @@ +#ifndef MATRIX_H +#define MATRIX_H + +void matrix_init(void); +void matrix_start(void); +void matrix_end(void); +void matrix_exit(void); +void matrix_update(void); + +#endif + diff --git a/sherman-aquarium/shermans/over.c b/sherman-aquarium/shermans/over.c new file mode 100644 index 0000000..06dfbeb --- /dev/null +++ b/sherman-aquarium/shermans/over.c @@ -0,0 +1,234 @@ + +/* This is a layer between main and different functions that can be called + when the mouse pointer is over */ + + +#include +#include "aquarium.h" +#include "over.h" +#include "draw.h" +#include "matrix.h" +#include "plasma.h" +#include "tetris.h" + +static int fade, old_over = -1; +static unsigned char *screen; +static Over_settings over_settings; +static AquariumData *ad; + + +Over_settings *over_get_settings_ptr(void) +{ + return &over_settings; +} + +void over_keypress(int key) +{ + if(over_settings.type == OVER_TETRIS) + tetris_keypress(key); + +} +void over_joystick(GaiFlagsJoystick jflags) +{ + if(over_settings.type == OVER_TETRIS) + tetris_joystick(jflags); +} + +void over_init(void) +{ + GaiFlagsType gf; + + screen=NULL; + fade=0; + + ad = aquarium_get_settings_ptr(); + + + if(over_settings.cursor_off) + gf = GAI_FLAGS_MOUSE_PTR_HIDE; + else + gf = GAI_FLAGS_MOUSE_PTR_SHOW; + + gf |= GAI_FLAGS_ALLOW_ROTATE; + + gai_flags_set(gf); + + if(over_settings.type == OVER_OFF) + return; + + old_over = over_settings.type; + + if(over_settings.type == OVER_MATRIX) + matrix_init(); + if(over_settings.type == OVER_PLASMA) + plasma_init(); + if(over_settings.type == OVER_TETRIS) + tetris_init(); +} + +void over_start(void) +{ + if(screen != NULL){ + g_free(screen); + screen = NULL; + } + + if(over_settings.type == OVER_OFF) + return; + + screen = g_malloc0((ad->xmax+2)*4*(ad->ymax+2)); + + if(over_settings.type == OVER_MATRIX) + matrix_start(); + if(over_settings.type == OVER_PLASMA) + plasma_start(); + if(over_settings.type == OVER_TETRIS) + tetris_start(); +} + +void over_end(void) +{ + if(screen != NULL) + g_free(screen); + + screen = NULL; + + if(over_settings.type == OVER_OFF) + return; + + if(over_settings.type == OVER_MATRIX) + matrix_end(); + if(over_settings.type == OVER_PLASMA) + plasma_end(); + if(over_settings.type == OVER_TETRIS) + tetris_end(); +} + +void over_exit(void) +{ + + + if(screen!=NULL) + g_free(screen); + + screen=NULL; + + if(old_over == OVER_MATRIX) + matrix_exit(); + if(old_over == OVER_PLASMA) + plasma_exit(); + if(old_over == OVER_TETRIS) + tetris_exit(); +} + + + +int over_update(int mouse_over) +{ + + int full_over=0; + + + + if(over_settings.type == OVER_OFF) + return 0; + + /* All is faded up and mouse is over, return */ + + if(fade==0 && !mouse_over) return 0; + + if(mouse_over){ + + if(fade==0) + over_start(); + + if(fade<255) + fade+=5; + + if(!over_settings.fade) + fade=255; + } + else{ + if(fade>0) + fade-=5; + + if(!over_settings.fade) + fade=0; + + if(fade==0){ + over_end(); + return 0; + } + + } + + if(fade==0) full_over = 1; + + if(over_settings.type == OVER_MATRIX) + matrix_update(); + if(over_settings.type == OVER_PLASMA) + plasma_update(); + if(over_settings.type == OVER_TETRIS) + tetris_update(); + + draw_pic_alpha(screen, ad->xmax, ad->ymax, 0, 0, 0, fade); + + return full_over; +} + + + +/* This one is very alike to draw_fish - Only small differences.*/ + +void over_draw(int x, int y, int idx, int width, int height, unsigned char *pic) +{ + /* bounding box of the clipped sprite */ + int dw, di, dh, ds; + + int w, h, pos, fidx, ypos, pic_pos; + + /* completely off the screen, don't bother drawing */ + if ((y < (-height)) || (y > (ad->ymax)) || (x > (ad->xmax)) || (x < -(width))) + return; + + + /* do clipping for top side */ + ds = 0; + if (y < 0) + ds = -(y); + + /* do clipping for bottom side */ + dh = height; + if ((y + height) > ad->ymax) + dh = ad->ymax - y; + + /* do clipping for right side */ + dw = width; + if ((x + width) > ad->xmax) + dw = width - ((x + width) - ad->xmax); + + /* do clipping for left side */ + di = 0; + if (x < 0) + di = -(x); + + fidx = width * height * 4 * idx; + + for (h = ds; h < dh; h++) { + /* offset to beginning of current row */ + ypos = (h + y) * ad->xmax * 4; + for (w = di; w < dw; w++) { + pic_pos = h * width * 4 + w * 4 + fidx; + pos = ypos + w * 4 + x * 4; + if (pic[pic_pos + 3] != 0) { + screen[pos] = pic[pic_pos]; + screen[pos + 1] = pic[pic_pos + 1]; + screen[pos + 2] = pic[pic_pos + 2]; + screen[pos + 3] = 1; + } + } + + } + + +} diff --git a/sherman-aquarium/shermans/over.h b/sherman-aquarium/shermans/over.h new file mode 100644 index 0000000..a662c2b --- /dev/null +++ b/sherman-aquarium/shermans/over.h @@ -0,0 +1,27 @@ +#ifndef OVER_H +#define OVER_H +#include +#include "aquarium.h" + + +#define OVER_OFF 0 +#define OVER_MATRIX 1 +#define OVER_PLASMA 2 +#define OVER_TETRIS 3 + + +typedef struct +{ + int fade; + int cursor_off; + int type; +} Over_settings; + +void over_init(void); +void over_exit(void); +int over_update(int); +void over_draw(int, int, int, int, int, unsigned char*); +void over_keypress(int); +void over_joystick(GaiFlagsJoystick); +Over_settings *over_get_settings_ptr(void); +#endif diff --git a/sherman-aquarium/shermans/plasma.c b/sherman-aquarium/shermans/plasma.c new file mode 100644 index 0000000..523a9b5 --- /dev/null +++ b/sherman-aquarium/shermans/plasma.c @@ -0,0 +1,219 @@ + + +/* Plasma "plugin" for Sherman's aquarium by Jonas Aaberg 2002 */ + +/* + + This plasma is based upon Jeremy Longley's JCL plasma for MS-DOS + that was written probably around 1995. + +*/ + +#include "aquarium.h" +#include "over.h" +#include "plasma.h" +#include +#include +#include + +#define MAX_FRAMES 1000 +#define GEN_PALETTE 11 +#define GEN_MOVEMENT 10 +#define START_UP_PLASMA 13 + +static unsigned char *surface = NULL, *movement = NULL, *palette = NULL, *pscreen = NULL; + +static int frame; + +static int p1, p2, p3, p4, p5, p6; +static int m1, m2, m3, m4; +static int c1, c2, c3, c11, c21, c31; + +static int surface_x = 512; +static int surface_y = 300; + + + +void plasma_exit(void) +{ + +} + +void plasma_init(void) +{ + surface = movement = palette = pscreen = NULL; +} + +void plasma_end(void) +{ + if(surface != NULL) + g_free(surface); + if(movement != NULL) + g_free(movement); + if(palette != NULL) + g_free(palette); + if(pscreen != NULL) + g_free(pscreen); + surface = movement = palette = pscreen = NULL; + +} + + +void plasma_gen_surface(int start_num) +{ + int ypos; + unsigned char value; + float x, y; + + for(y = start_num * (surface_y / 10); y < ((start_num + 1) * surface_y / 10); y++){ + ypos = (int) y * surface_x; + for(x = 0; x < surface_x; x++){ + value = 64 + (unsigned char)(10 * (sin(x / p1) + cos(y / p2) + + cos(x / p3) + sin(y / p4) + + sin((x + y) / p5) + + cos(hypot(256 - x, 150 - y) / p6))); + surface[ypos+(int)x] = value; + } + } + +} + + + +void plasma_start(void) +{ + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + frame=0; + + /* Surface randomization */ + p1 = g_rand_int_range(ad->rnd, 1, 101); + p2 = p1 + g_rand_int_range(ad->rnd, -25, 25); + p3 = g_rand_int_range(ad->rnd, 1, 101); + p4 = p3 + g_rand_int_range(ad->rnd, -25, 25); + p5 = g_rand_int_range(ad->rnd, 1, 101); + p6 = p5 + g_rand_int_range(ad->rnd, -25, 25); + + /* Movement randomization */ + m1 = g_rand_int_range(ad->rnd, 1, 101); + m2 = g_rand_int_range(ad->rnd, 1, 101); + m3 = g_rand_int_range(ad->rnd, 1, 101); + m4 = g_rand_int_range(ad->rnd, 1, 101); + + /* Colour randomization */ + + c1 = g_rand_int_range(ad->rnd, 1, 101); + c11 = g_rand_int_range(ad->rnd, 1, 101); + c2 = g_rand_int_range(ad->rnd, 1, 101); + c21 = g_rand_int_range(ad->rnd, 1, 101); + c3 = g_rand_int_range(ad->rnd, 1, 101); + c31= g_rand_int_range(ad->rnd, 1, 101); + + + if(surface!=NULL) + plasma_end(); + + ad = aquarium_get_settings_ptr(); + + /* Allocating memory */ + + surface_x = ((int)(ad->xmax / 512.0 + 1)) * 512; + surface_y = 2 * ad->ymax; + + surface = g_malloc0(surface_x * surface_y); + movement = g_malloc0(4 * MAX_FRAMES); + palette = g_malloc0(3 * 2 * MAX_FRAMES); + + + pscreen = g_malloc0(ad->xmax*ad->ymax * 4); + +} + +void plasma_start_2(int start_num) +{ + float count; + int lead, offset; + + if(start_num < GEN_MOVEMENT) + plasma_gen_surface(start_num); + if(start_num == GEN_MOVEMENT){ + + for(count = 0; count < MAX_FRAMES; count++){ + lead = (int)((surface_y / 3 - 4) + (surface_y / 3 - 10) * cos(count / m1) + + surface_x * (int)((surface_y / 6 - 2) + (surface_y / 6 - 3) * sin(count / m2))); + offset = (int)((surface_y / 3 - 4) + (surface_y / 3 - 8) * sin(count / m3) + + surface_x * (int)((surface_y / 6 - 2) + (surface_y / 6 - 3) * cos(count / m4)) + - lead); + movement[(int)count * 4 + 0] = (unsigned char)((lead & 0xff00) >> 8); + movement[(int)count * 4 + 1] = (unsigned char)(lead & 0xff); + movement[(int)count * 4 + 2] = (unsigned char)((offset & 0xff00) >> 8); + movement[(int)count * 4 + 3] = (unsigned char)(offset & 0xff); + } + } + + if(start_num == GEN_PALETTE){ + for(count = 0; count < (((MAX_FRAMES + 768) / 256 + 1) * 256); count++){ + palette[(int)count * 3 + 0] = (unsigned char)(sin(count / c11) * sin(count / c1) * 126 + 126); + palette[(int)count * 3 + 1] = (unsigned char)(sin(count / c21) * sin(count / c2) * 126 + 126); + palette[(int)count * 3 + 2] = (unsigned char)(sin(count / c31) * sin(count / c3) * 126 + 126); + } + } + +} + + +void plasma_update(void) +{ + unsigned int lead, offset; + unsigned char t; + unsigned int sum; + int p, ypos; + int surface_ptr = 0; + AquariumData *ad; + + int x, y; + + if(frame == MAX_FRAMES){ + plasma_start(); + } + + frame++; + + if(frame < START_UP_PLASMA){ + plasma_start_2(frame - 1); + return; + } + + t = movement[frame * 4 + 1]; + lead = (unsigned int)t; + t = movement[frame * 4 + 0]; + lead += ((unsigned int)t) << 8; + + t = movement[frame * 4 + 3]; + offset = (unsigned int)t; + t = movement[frame * 4 + 2]; + offset += ((unsigned int)t) << 8; + + sum = (offset + lead) & 0xffff; + + ad = aquarium_get_settings_ptr(); + + for(y = 0; y < ad->ymax; y++){ + ypos = y * ad->xmax * 4; + for(x = 0; x < ad->xmax; x++){ + t = (unsigned char)((surface[lead + surface_ptr + x] + surface[sum + surface_ptr + x]) & 0xff); + p = 3 * (int)t; + pscreen[ypos + x * 4 + 0] = palette[3 * frame + p + 0]; + pscreen[ypos + x * 4 + 1] = palette[3 * frame + p + 1]; + pscreen[ypos + x * 4 + 2] = palette[3 * frame + p + 2]; + // pscreen[ypos + x * 4 + 3] = 'E'; + } + surface_ptr += surface_x; + } + + over_draw(0, 0, 0, ad->xmax, ad->ymax,pscreen); + + +} diff --git a/sherman-aquarium/shermans/plasma.h b/sherman-aquarium/shermans/plasma.h new file mode 100644 index 0000000..d08def2 --- /dev/null +++ b/sherman-aquarium/shermans/plasma.h @@ -0,0 +1,10 @@ +#ifndef PLASMA_H +#define PLASMA_H + +void plasma_init(void); +void plasma_exit(void); +void plasma_end(void); +void plasma_start(void); +void plasma_update(void); + +#endif diff --git a/sherman-aquarium/shermans/pref.c b/sherman-aquarium/shermans/pref.c new file mode 100644 index 0000000..94c925e --- /dev/null +++ b/sherman-aquarium/shermans/pref.c @@ -0,0 +1,558 @@ + +/* + + Preference window for Sherman's aquarium, + using the General Applet Interface. + + Preference generator v2 interface. + +*/ + +#include +#include +#include +#include +#include +#include "../config.h" + +#include "clock.h" +#include "date.h" +#include "background.h" +#include "soundeffects.h" +#include "bottom.h" +#include "bubble.h" +#include "fish.h" +#include "over.h" +#include "leds.h" +#include "thermometer.h" +#ifdef XMMS +#include "xmms_sn.h" +#endif +#include "settings.h" +#include "status.h" +#include "tetris.h" + +static Date_settings date_settings; +static Clock_settings clock_settings; +static Background_settings background_settings; +static Sound_settings sound_settings; +static Bottom_settings bottom_settings; +static Bubble_settings bubble_settings; +static Fish_settings fish_settings; +static Over_settings over_settings; +static Leds_settings leds_settings; +static Thermometer_settings thermometer_settings; +static Tetris_settings tetris_settings; +#ifdef XMMS +static Xmms_sn_settings xmms_settings; +#endif +static General_settings general_settings; + +static char *draw_list[] = {"Background", "Forground",NULL}; +static char *vert_list[] = {"Top", "Center", "Bottom", NULL}; +static char *horz_list[] = {"Left", "Center", "Right", NULL}; +static char *vert_horz_list[] = {"Vertical", "Horizontal", NULL}; +#ifdef XMMS +static char *xmms_scroll_list[] = {"Vertical","Horizontal",NULL}; +#endif + + +static char *clock_type_list[] = {"Off", "Analog", "Digital", "Fuzzy",NULL}; +static char *clock_fontsize_list[] = {"Large", "Small", NULL}; +static char *bg_names[] = {"Solid colour", "Shaded colour", "Wateralike", "Image", NULL}; +static char *sound_type[] = {"Use Mp3 files for sound effects", "Use Ogg files for sound effects", NULL}; +static char *leds_func_list[] = {"Off", "Numlock", "Capslock", "Scrollock", NULL}; +static char *leds_colour_list[] = {"Blue", "Blue-Green", "Orange", "Red", "Violet", "Yellow", "Pink", "Green", "Dark Blue", "Light blue", "Yellow-Green", NULL}; +static char *mouse_list[] = {"Off", "Executes", NULL}; + +static GaiSS l_0_1000_1 = {0, 1000, 1}, l_0_100_1 = {0,100,1}, l_10_1000_5 = {10, 1000, 5}, l_0_50_1 = {0,50,1}; +static GaiSS l_1_20_1 = {1, 20, 1}, l_0_200_1 = {0, 200, 1}, l_0_100_5 = {0, 100, 5}, l_0_1000000_1 = {0,1000000,1}; +static GaiSS l_0_255_1 = {0, 255, 1}, l_4_50_1 = {4, 50, 1}; + +static char *fish_radio[] = {"User defined selection and population", + "Random selection and given population size", + "Random selection and random population size", + NULL}; + +static char *over_radio[] = {"Nothing", "Matrix scroller", "Plasma", "Tetris", NULL}; + + +static char *messure_list[] = { + "Off", +#ifdef STATUS_HAVE_FAN1 + "Fan 1", +#endif +#ifdef STATUS_HAVE_FAN2 + "Fan 2", +#endif +#ifdef STATUS_HAVE_TEMP1 + "Thermometer 1 (CPU)", +#endif +#ifdef STATUS_HAVE_TEMP2 + "Thermometer 2 (Motherboard)", +#endif +#ifdef STATUS_HAVE_SWAP + "Swap usage", +#endif +#ifdef STATUS_HAVE_DISC + "Disc usage", +#endif +#ifdef STATUS_HAVE_CPU + "CPU load", +#endif +#ifdef STATUS_HAVE_MEM + "Memory usage", +#endif +#ifdef STATUS_HAVE_NET_ETH0 + "Network ETH0 (1st network card) recieve", + "Network ETH0 (1st network card) send", + "Network ETH0 (1st network card) mixed", +#endif +#ifdef STATUS_HAVE_NET_ETH1 + "Network ETH1 (2nd network card) recieve", + "Network ETH1 (2nd network card) send", + "Network ETH1 (2nd network card) mixed", + +#endif +#ifdef STATUS_HAVE_NET_PPP0 + "Network: PPP0 (Dial-up modem) recieve", + "Network: PPP0 (Dial-up modem) send", + "Network: PPP0 (Dial-up modem) mixed", +#endif +#ifdef STATUS_HAVE_NET_LO + "Network: Loopback recieve", + "Network: Loopback send", + "Network: Loopback mixed", +#endif + NULL}; + + +GaiPI shermans_pref[] = { + + + +/*--------------------------------------------------------------------------------*/ +/* General */ +/*--------------------------------------------------------------------------------*/ + + + +{GAI_NOTEBOOK, "General"}, +{GAI_FRAME, "Sound format"}, + {GAI_CHECKBUTTON, "Sound effects",&sound_settings.on, &sound_settings.on}, + {GAI_TEXTENTRY, "External sound playing program: ", &sound_settings.prg, &sound_settings.prg}, + {GAI_RADIOBUTTON, sound_type, &sound_settings.type, &sound_settings.type}, +{GAI_FRAME_E}, + +{GAI_FRAME_R, "Applet size ratio"}, + {GAI_SPINBUTTON, "Width:", &general_settings.ratio_width, &general_settings.ratio_width, &l_1_20_1}, + {GAI_SPINBUTTON, "Height:", &general_settings.ratio_height, &general_settings.ratio_height, &l_1_20_1}, + {GAI_TEXT, "The ratios might be compromised\n" + "in order to fit the gnome panel.\n" + "When the gnome panel is in vertical\n" + "mode, the ratios will be rotated 90\n" + "degrees."}, +{GAI_FRAME_E}, +{GAI_SPINBUTTON, "Max bubbles", &bubble_settings.max_bubbles, &bubble_settings.max_bubbles, &l_0_1000_1}, + +{GAI_FRAME, "Bottom"}, + {GAI_CHECKBUTTON, "Have sea floor", &bottom_settings.have_sea_floor, &bottom_settings.have_sea_floor}, + {GAI_CHECKBUTTON, "Random number of plants up to the number below", &bottom_settings.random_plants, &bottom_settings.random_plants}, + {GAI_SPINBUTTON, "Number of plants:", &bottom_settings.max_plants,&bottom_settings.max_plants, &l_0_100_1}, + {GAI_SPINBUTTON, "Scale of plants:", &bottom_settings.scale,&bottom_settings.scale, &l_10_1000_5}, + {GAI_SPINBUTTON, "Number of bottom animals:", &bottom_settings.num_bottom_animals, &bottom_settings.num_bottom_animals, &l_0_50_1}, +{GAI_FRAME_E}, + +/*--------------------------------------------------------------------------------*/ +/* Background settings */ +/*--------------------------------------------------------------------------------*/ + +{GAI_FRAME_R, "Background"}, + {GAI_RADIOBUTTON, bg_names, &background_settings.type, &background_settings.type}, + {GAI_COLORSELECTOR, "Solid colour", &background_settings.solid_c, &background_settings.solid_c}, // r1 + {GAI_COLORSELECTOR, "Shaded - Top colour", &background_settings.shaded_top_c, &background_settings.shaded_top_c}, /// r2, r2 + {GAI_COLORSELECTOR, "Shaded - Bottom colour", &background_settings.shaded_bot_c, &background_settings.shaded_bot_c}, + {GAI_FILESELECTOR, "Background image", &background_settings.imagename, &background_settings.imagename_new}, +{GAI_FRAME_E}, + +{GAI_NOTEBOOK_E}, + +/*--------------------------------------------------------------------------------*/ +/* Mouse */ +/*--------------------------------------------------------------------------------*/ + +{GAI_NOTEBOOK, "Mouse"}, +{GAI_FRAME, "Mouse clicks"}, + +{GAI_FRAME, "Left button"}, +{GAI_OPTIONMENU, "Does: ", &general_settings.mouse_left, &general_settings.mouse_left, mouse_list}, +{GAI_TEXTENTRY, "Option: ", &general_settings.mouse_left_option, &general_settings.mouse_left_option}, +{GAI_FRAME_E}, +{GAI_FRAME_R, "Middle button"}, +{GAI_OPTIONMENU, "Does: ", &general_settings.mouse_middle, &general_settings.mouse_middle, mouse_list}, +{GAI_TEXTENTRY, "Option: ", &general_settings.mouse_middle_option, &general_settings.mouse_middle_option}, +{GAI_FRAME_E}, + +{GAI_FRAME, "Scroll button up"}, +{GAI_OPTIONMENU, "Does: ", &general_settings.mouse_up, &general_settings.mouse_up, mouse_list}, +{GAI_TEXTENTRY, "Option: ", &general_settings.mouse_up_option, &general_settings.mouse_up_option}, +{GAI_FRAME_E}, +{GAI_FRAME_R, "Scroll button button down"}, +{GAI_OPTIONMENU, "Does: ", &general_settings.mouse_down, &general_settings.mouse_down, mouse_list}, +{GAI_TEXTENTRY, "Option: ", &general_settings.mouse_down_option, &general_settings.mouse_down_option}, +{GAI_FRAME_E}, + + +{GAI_FRAME_E}, +{GAI_NOTEBOOK_E}, + + +/*--------------------------------------------------------------------------------*/ +/* Time */ +/*--------------------------------------------------------------------------------*/ +{GAI_NOTEBOOK, "Time"}, +{GAI_FRAME, "Date"}, + {GAI_CHECKBUTTON, "On", &date_settings.on, &date_settings.on}, + {GAI_OPTIONMENU, "Draw on:", &date_settings.draw, &date_settings.draw, draw_list}, + {GAI_OPTIONMENU, "Vertical placement:", &date_settings.vert, &date_settings.vert, vert_list}, + {GAI_OPTIONMENU, "Horizontal placement:", &date_settings.horz, &date_settings.horz, horz_list}, + {GAI_COLORSELECTOR, "Font colour",&date_settings.c,&date_settings.c}, +{GAI_FRAME_E}, + +{GAI_FRAME, "Clock"}, + {GAI_OPTIONMENU, "Vertical placement:", &clock_settings.vert, &clock_settings.vert, vert_list}, + {GAI_OPTIONMENU, "Horizontal placement:", &clock_settings.horz, &clock_settings.horz, horz_list}, + {GAI_OPTIONMENU, "Draw on:", &clock_settings.draw, &clock_settings.draw, draw_list}, + {GAI_OPTIONMENU, "Clock type:", &clock_settings.type, &clock_settings.type,clock_type_list}, + {GAI_FRAME, "Analog"}, + {GAI_CHECKBUTTON, "Keep the clock circular", &clock_settings.analog_keep_circular, &clock_settings.analog_keep_circular}, + {GAI_COLORSELECTOR, "Colour of the hour pointer",&clock_settings.analog_colour_hour, &clock_settings.analog_colour_hour}, + {GAI_COLORSELECTOR, "Colour of the minute pointer",&clock_settings.analog_colour_min, &clock_settings.analog_colour_min}, + {GAI_COLORSELECTOR, "Colour of the second pointer", &clock_settings.analog_colour_sec, &clock_settings.analog_colour_sec}, + {GAI_CHECKBUTTON, "With seconds", &clock_settings.analog_seconds, &clock_settings.analog_seconds}, + {GAI_FRAME_E}, + {GAI_FRAME_R, "Digital"}, + {GAI_OPTIONMENU, "Font size:", &clock_settings.digital_fontsize, &clock_settings.digital_fontsize, clock_fontsize_list}, + {GAI_CHECKBUTTON, "Make the colon blink", &clock_settings.digital_blinking, &clock_settings.digital_blinking}, + {GAI_COLORSELECTOR, "Font colour", &clock_settings.digital_colour, &clock_settings.digital_colour}, + {GAI_CHECKBUTTON, "With seconds", &clock_settings.digital_seconds, &clock_settings.digital_seconds}, + {GAI_FRAME_E}, + {GAI_FRAME, "Fuzzy"}, + {GAI_COLORSELECTOR, "Font colour", &clock_settings.fuzzy_colour, &clock_settings.fuzzy_colour}, + {GAI_FRAME_E}, +{GAI_FRAME_E}, +{GAI_NOTEBOOK_E}, + + +/*--------------------------------------------------------------------------------*/ +/* Fish */ +/*--------------------------------------------------------------------------------*/ + +{GAI_NOTEBOOK, "Fish"}, + +{GAI_FRAME, "Fish"}, + {GAI_SPINBUTTON, "Fish 1:", &fish_settings.fish1, &fish_settings.fish1, &l_0_100_1}, + {GAI_SPINBUTTON, "Fish 2:", &fish_settings.fish2, &fish_settings.fish2, &l_0_100_1}, + {GAI_SPINBUTTON, "Fish 3:", &fish_settings.fish3, &fish_settings.fish3, &l_0_100_1}, + {GAI_SPINBUTTON, "Fish 4:", &fish_settings.fish4, &fish_settings.fish4, &l_0_100_1}, + {GAI_SPINBUTTON, "Fish 5:", &fish_settings.fish5, &fish_settings.fish5, &l_0_100_1}, + {GAI_SPINBUTTON, "Fish 6:", &fish_settings.fish6, &fish_settings.fish6, &l_0_100_1}, + {GAI_SPINBUTTON, "Swordfish:", &fish_settings.swordfish, &fish_settings.swordfish, &l_0_100_1}, + {GAI_SPINBUTTON, "Blowfish:", &fish_settings.blowfish, &fish_settings.blowfish, &l_0_100_1}, + {GAI_SPINBUTTON, "Bottomdweller:", &fish_settings.bdweller, &fish_settings.bdweller, &l_0_100_1}, +{GAI_FRAME_E}, +{GAI_FRAME_R, "More fish"}, + {GAI_SPINBUTTON, "Fillmore:", &fish_settings.fillmore, &fish_settings.fillmore, &l_0_100_1}, + {GAI_SPINBUTTON, "Sherman:", &fish_settings.sherman, &fish_settings.sherman, &l_0_100_1}, + {GAI_SPINBUTTON, "Megan:", &fish_settings.megan, &fish_settings.megan, &l_0_100_1}, + {GAI_SPINBUTTON, "Prey:", &fish_settings.prey, &fish_settings.prey, &l_0_100_1}, + {GAI_SPINBUTTON, "Hunter:", &fish_settings.hunter, &fish_settings.hunter, &l_0_100_1}, + {GAI_SPINBUTTON, "Lori:", &fish_settings.lori, &fish_settings.lori, &l_0_100_1}, + {GAI_SPINBUTTON, "Ernest:", &fish_settings.ernest, &fish_settings.ernest, &l_0_100_1}, + {GAI_SPINBUTTON, "Squid:", &fish_settings.squid, &fish_settings.squid, &l_0_100_1}, + {GAI_SPINBUTTON, "Hawthorne:", &fish_settings.hawthorne, &fish_settings.hawthorne, &l_0_100_1}, +{GAI_FRAME_E}, + +{GAI_FRAME, "Fish population"}, + {GAI_RADIOBUTTON, fish_radio, &fish_settings.type, &fish_settings.type}, + {GAI_SPINBUTTON, "Population size:", &fish_settings.num_fish, &fish_settings.num_fish, &l_0_200_1}, +{GAI_FRAME_E}, + +{GAI_FRAME_R, "Fish behaviour"}, + {GAI_CHECKBUTTON, "Eating prey fish is ok", &fish_settings.eat, &fish_settings.eat}, + {GAI_CHECKBUTTON, "Make blowfish explode is ok", &fish_settings.explode, &fish_settings.explode}, + {GAI_CHECKBUTTON, "Dead fish might be reborn", &fish_settings.rebirth, &fish_settings.rebirth}, + {GAI_CHECKBUTTON, "Fish from the same kind may differ in size.", &fish_settings.scale_diff, &fish_settings.scale_diff}, + {GAI_SPINBUTTON, "Scale (in %):", &fish_settings.scale, &fish_settings.scale, &l_10_1000_5}, + {GAI_SPINBUTTON, "Speed (in %):", &fish_settings.speed, &fish_settings.speed, &l_10_1000_5}, + {GAI_SPINBUTTON, "Hunter agressiveness (in %):", &fish_settings.hunter_agr, &fish_settings.hunter_agr, &l_0_100_5}, + {GAI_SPINBUTTON, "Swordfish agressiveness (in %):", &fish_settings.swordfish_agr, &fish_settings.swordfish_agr, &l_0_100_5}, +{GAI_FRAME_E}, +{GAI_NOTEBOOK_E}, + +/*--------------------------------------------------------------------------------*/ +/* Thermometer */ +/*--------------------------------------------------------------------------------*/ + +{GAI_NOTEBOOK, "Thermometer"}, +{GAI_FRAME,"First Thermometer"}, + {GAI_OPTIONMENU, "Draw on: ", &thermometer_settings.draw1, &thermometer_settings.draw1, draw_list}, + {GAI_OPTIONMENU, "Vertical placement: ", &thermometer_settings.vert1, &thermometer_settings.vert1, vert_list}, + {GAI_OPTIONMENU, "Horizontal placement: ", &thermometer_settings.horz1, &thermometer_settings.horz1, horz_list}, + {GAI_CHECKBUTTON, "Split", &thermometer_settings.split1,&thermometer_settings.split1}, + {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c1, &thermometer_settings.c1}, + {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure1, &thermometer_settings.messure1, messure_list}, + {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof1, &thermometer_settings.roof1, &l_0_1000000_1}, + {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."}, + {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point1, &thermometer_settings.mount_point1}, + {GAI_TEXT, "A mount point is needed for disc usage."}, + {GAI_FRAME, "Split"}, + {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c1_s, &thermometer_settings.c1_s}, + {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure1_s, &thermometer_settings.messure1_s, messure_list}, + {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof1_s, &thermometer_settings.roof1_s, &l_0_1000000_1}, + {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."}, + {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point1_s, &thermometer_settings.mount_point1_s}, + {GAI_TEXT, "A mount point is needed for disc usage."}, + {GAI_FRAME_E}, +{GAI_FRAME_E}, + +{GAI_FRAME_R,"Second Thermometer"}, + {GAI_OPTIONMENU, "Draw on: ", &thermometer_settings.draw2, &thermometer_settings.draw2, draw_list}, + {GAI_OPTIONMENU, "Vertical placement: ", &thermometer_settings.vert2, &thermometer_settings.vert2, vert_list}, + {GAI_OPTIONMENU, "Horizontal placement: ", &thermometer_settings.horz2, &thermometer_settings.horz2, horz_list}, + {GAI_CHECKBUTTON, "Split", &thermometer_settings.split2,&thermometer_settings.split2}, + {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c2, &thermometer_settings.c2}, + {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure2, &thermometer_settings.messure2, messure_list}, + {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof2, &thermometer_settings.roof2, &l_0_1000000_1}, + {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."}, + {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point2, &thermometer_settings.mount_point2}, + {GAI_TEXT, "A mount point is needed for disc usage."}, + {GAI_FRAME, "Split"}, + {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c2_s, &thermometer_settings.c2_s}, + {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure2_s, &thermometer_settings.messure2_s, messure_list}, + {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof2_s, &thermometer_settings.roof2_s, &l_0_1000000_1}, + {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."}, + {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point2_s, &thermometer_settings.mount_point2_s}, + {GAI_TEXT, "A mount point is needed for disc usage."}, + {GAI_FRAME_E}, +{GAI_FRAME_E}, +{GAI_NOTEBOOK_E}, +/*--------------------------------------------------------------------------------*/ +/* Leds */ +/*--------------------------------------------------------------------------------*/ +{GAI_NOTEBOOK, "Leds"}, +{GAI_OPTIONMENU, "Draw on: ", &leds_settings.draw, &leds_settings.draw, draw_list}, +{GAI_OPTIONMENU, "Vertical placement: ", &leds_settings.vert, &leds_settings.vert, vert_list}, +{GAI_OPTIONMENU, "Horizontal placement: ", &leds_settings.horz, &leds_settings.horz, horz_list}, +{GAI_OPTIONMENU, "Layout: ", &leds_settings.vert_horz, &leds_settings.vert_horz, vert_horz_list}, +{GAI_SPINBUTTON, "Alpha: ", &leds_settings.alpha, &leds_settings.alpha, &l_0_255_1}, + +{GAI_FRAME, "Led one"}, + {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[0], &leds_settings.leds_func[0], leds_func_list}, + {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[0],&leds_settings.leds_colour[0], leds_colour_list}, + {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[0], &leds_settings.leds_show_off[0]}, +{GAI_FRAME_E}, + +{GAI_FRAME_R, "Led two"}, + {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[1], &leds_settings.leds_func[1], leds_func_list}, + {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[1],&leds_settings.leds_colour[1], leds_colour_list}, + {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[1], &leds_settings.leds_show_off[1]}, +{GAI_FRAME_E}, + +{GAI_FRAME, "Led three"}, + {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[2], &leds_settings.leds_func[2], leds_func_list}, + {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[2],&leds_settings.leds_colour[2], leds_colour_list}, + {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[2], &leds_settings.leds_show_off[2]}, +{GAI_FRAME_E}, + +{GAI_FRAME_R, "Led four"}, + {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[3], &leds_settings.leds_func[3], leds_func_list}, + {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[3],&leds_settings.leds_colour[3], leds_colour_list}, + {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[3], &leds_settings.leds_show_off[3]}, +{GAI_FRAME_E}, + +{GAI_NOTEBOOK_E}, + + +/*--------------------------------------------------------------------------------*/ +/* Extra */ +/*--------------------------------------------------------------------------------*/ + +{GAI_NOTEBOOK, "Extra"}, +{GAI_CHECKBUTTON, "Hide mouse cursor when over applet", &over_settings.cursor_off, &over_settings.cursor_off}, +{GAI_CHECKBUTTON, "Fade when mouse cursor is over", &over_settings.fade, &over_settings.fade}, + +{GAI_FRAME, "Mouse pointer over activates"}, + {GAI_RADIOBUTTON, over_radio, &over_settings.type,&over_settings.type}, +{GAI_FRAME_E}, + +#ifdef XMMS +{GAI_FRAME, "Xmms song name displayer"}, + {GAI_CHECKBUTTON, "On", &xmms_settings.on,&xmms_settings.on}, + {GAI_OPTIONMENU, "Draw on:", &xmms_settings.draw, &xmms_settings.draw, draw_list}, + {GAI_OPTIONMENU, "Vertical placement:", &xmms_settings.vert, &xmms_settings.vert, vert_list}, + {GAI_OPTIONMENU, "Horizontal placement:", &xmms_settings.horz, &xmms_settings.horz, horz_list}, + {GAI_OPTIONMENU, "Text scroll direction:", &xmms_settings.direction, &xmms_settings.direction, xmms_scroll_list}, + {GAI_COLORSELECTOR, "Font colour", &xmms_settings.c, &xmms_settings.c}, +{GAI_FRAME_E}, +#endif +{GAI_FRAME, "Tetris"}, + {GAI_CHECKBUTTON, "Use maximum size", &tetris_settings.size_limit, &tetris_settings.size_limit}, + {GAI_CHECKBUTTON, "Show next piece", &tetris_settings.show_next, &tetris_settings.show_next}, + {GAI_SPINBUTTON, "Width: ", &tetris_settings.width, &tetris_settings.width, &l_4_50_1}, + {GAI_SPINBUTTON, "Height: ", &tetris_settings.height, &tetris_settings.height, &l_4_50_1}, +{GAI_FRAME_E}, + +{GAI_NOTEBOOK_E}, + +{GAI_END}}; + + +void pref_restart(gpointer d) +{ + Background_settings *bas; + Bottom_settings *bos; + Bubble_settings *bus; + Clock_settings *cs; + Date_settings *ds; + Fish_settings *fs; + General_settings *gs; + Leds_settings *ls; + Over_settings *os; + Sound_settings *ss; + Tetris_settings *tt; + Thermometer_settings *ts; +#ifdef XMMS + Xmms_sn_settings *xss; +#endif + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + ad->dont_update = 1; + + bas = background_get_settings_ptr(); + bos = bottom_get_settings_ptr(); + bus = bubble_get_settings_ptr(); + cs = clock_get_settings_ptr(); + ds = date_get_settings_ptr(); + fs = fish_get_settings_ptr(); + gs = general_get_settings_ptr(); + + + ls = leds_get_settings_ptr(); + os = over_get_settings_ptr(); + ss = sound_get_settings_ptr(); + ts = thermometer_get_settings_ptr(); + tt = tetris_get_settings_ptr(); +#ifdef XMMS + xss = xmms_sn_get_settings_ptr(); +#endif + + memcpy(bas, &background_settings, sizeof(Background_settings)); + memcpy(bos, &bottom_settings, sizeof(Bottom_settings)); + memcpy(bus, &bubble_settings, sizeof(Bubble_settings)); + memcpy(cs, &clock_settings, sizeof(Clock_settings)); + memcpy(ds, &date_settings, sizeof(Date_settings)); + memcpy(fs, &fish_settings, sizeof(Fish_settings)); + memcpy(gs, &general_settings, sizeof(General_settings)); + memcpy(ls, &leds_settings, sizeof(Leds_settings)); + memcpy(os, &over_settings, sizeof(Over_settings)); + memcpy(ss, &sound_settings, sizeof(Sound_settings)); + memcpy(tt, &tetris_settings, sizeof(Tetris_settings)); + memcpy(ts, &thermometer_settings, sizeof(Thermometer_settings)); +#ifdef XMMS + memcpy(xss, &xmms_settings, sizeof(Xmms_sn_settings)); +#endif + + clock_save_settings(); + date_save_settings(); + bubble_save_settings(); + background_save_settings(); + fish_save_settings(); + general_save_settings(); + bottom_save_settings(); + + over_save_settings(); + leds_save_settings(); + tetris_save_settings(); + thermometer_save_settings(); +#ifdef XMMS + xmms_sn_save_settings(); +#endif + sound_save_settings(); + + aquarium_free_all(); + + /* Load the fishes early, since aquarium change will need them */ + fish_init(); + + if(gai_applet_mode() == GAI_DOCKAPP){ + if(gs->ratio_width > gs->ratio_height) + aquarium_change(GAI_HORIZONTAL, gai_get_size(), gai_get_size(), NULL); + else + aquarium_change(GAI_VERTICAL, gai_get_size(), gai_get_size(), NULL); + } + else + aquarium_change(gai_get_orient(), gai_get_size(), gai_get_size(), NULL); + + aquarium_reload_all(); + ad->dont_update = 0; +} + +void pref_init(void) +{ + Background_settings *bas; + Bottom_settings *bos; + Bubble_settings *bus; + Clock_settings *cs; + Date_settings *ds; + Fish_settings *fs; + Leds_settings *ls; + Over_settings *os; + Sound_settings *ss; + Tetris_settings *tt; + Thermometer_settings *ts; +#ifdef XMMS + Xmms_sn_settings *xss; +#endif + General_settings *gs; + + AquariumData *ad; + + + ad = aquarium_get_settings_ptr(); + + bas = background_get_settings_ptr(); + bos = bottom_get_settings_ptr(); + bus = bubble_get_settings_ptr(); + cs = clock_get_settings_ptr(); + ds = date_get_settings_ptr(); + fs = fish_get_settings_ptr(); + gs = general_get_settings_ptr(); + + ls = leds_get_settings_ptr(); + os = over_get_settings_ptr(); + ss = sound_get_settings_ptr(); + tt = tetris_get_settings_ptr(); + ts = thermometer_get_settings_ptr(); +#ifdef XMMS + xss = xmms_sn_get_settings_ptr(); +#endif + + memcpy(&background_settings, bas, sizeof(Background_settings)); + memcpy(&bottom_settings, bos, sizeof(Bottom_settings)); + memcpy(&bubble_settings, bus, sizeof(Bubble_settings)); + memcpy(&clock_settings, cs, sizeof(Clock_settings)); + memcpy(&date_settings, ds, sizeof(Date_settings)); + memcpy(&fish_settings, fs, sizeof(Fish_settings)); + memcpy(&general_settings, gs, sizeof(General_settings)); + memcpy(&leds_settings, ls, sizeof(Leds_settings)); + memcpy(&over_settings, os, sizeof(Over_settings)); + memcpy(&sound_settings, ss, sizeof(Sound_settings)); + memcpy(&tetris_settings, tt, sizeof(Tetris_settings)); + memcpy(&thermometer_settings, ts, sizeof(Thermometer_settings)); +#ifdef XMMS + memcpy(&xmms_settings, xss, sizeof(Xmms_sn_settings)); +#endif + +} diff --git a/sherman-aquarium/shermans/pref.h b/sherman-aquarium/shermans/pref.h new file mode 100644 index 0000000..6895e73 --- /dev/null +++ b/sherman-aquarium/shermans/pref.h @@ -0,0 +1,8 @@ +#ifndef PREF_H +#define PREF_H + +void pref_init(void); +void pref_restart(void); +extern GaiPI shermans_pref[]; + +#endif diff --git a/sherman-aquarium/shermans/screensaver.c b/sherman-aquarium/shermans/screensaver.c new file mode 100644 index 0000000..fbab9df --- /dev/null +++ b/sherman-aquarium/shermans/screensaver.c @@ -0,0 +1,974 @@ + +/* + + Sherman's aquarium - Screensaver part + + Updated and partly rewritten for Sherman's aquarium v3.0.0 on + 30th and 31st December 2003. + + Jonas Aaberg + +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#if SDL_BYTEORDER == SDL_BIG_ENDIAN +#define RMASK 0xff000000 +#define GMASK 0x00ff0000 +#define BMASK 0x0000ff00 +#define AMASK 0x000000ff + +#else + +#define RMASK 0x000000ff +#define GMASK 0x0000ff00 +#define BMASK 0x00ff0000 +#define AMASK 0xff000000 +#endif + + + + +typedef struct { + unsigned char r,g,b,alpha; +} GaiColor; + + +#include "aquarium.h" +#include "bottom.h" +#include "bubble.h" +#include "background.h" +#include "fish.h" +#include "draw.h" +#include "soundeffects.h" +#include "vroot.h" + +#ifdef DARWIN +#include "getopt.h" +#else +#include +#endif + + +#define ARG_SEAFLOOR 1 +#define ARG_SOUND 2 +#define ARG_PLANTS 3 +#define ARG_PLANTSCALE 4 +#define ARG_BOTTOMANIMALS 5 +#define ARG_OGG 6 +#define ARG_BG_SOLID 7 +#define ARG_BG_SHADED 8 +#define ARG_BG_WATERALIKE 9 +#define ARG_BG_IMAGE 10 +#define ARG_LCR 11 +#define ARG_LCG 12 +#define ARG_LCB 13 +#define ARG_UCR 14 +#define ARG_UCG 15 +#define ARG_UCB 16 +#define ARG_BG_IMAGE_FILE 17 +#define ARG_RANDOM 18 +#define ARG_SELECTED 19 +#define ARG_RANDOM_POP 20 +#define ARG_FISH1 21 +#define ARG_FISH2 22 +#define ARG_FISH3 23 +#define ARG_FISH4 24 +#define ARG_FISH5 25 +#define ARG_FISH6 26 +#define ARG_BLOWFISH 27 +#define ARG_SWORDFISH 28 +#define ARG_BDWELLER 29 +#define ARG_FILLMORE 30 +#define ARG_SHERMAN 31 +#define ARG_MEGAN 32 +#define ARG_HUNTER 33 +#define ARG_PREY 34 +#define ARG_LORI 35 +#define ARG_ERNEST 36 +#define ARG_SQUID 37 +#define ARG_HAWTHORNE 38 +#define ARG_EAT 39 +#define ARG_EXPLODE 40 +#define ARG_REBIRTH 41 +#define ARG_SCALEDIFF 42 +#define ARG_SPEED 43 +#define ARG_SCALE 44 +#define ARG_HUNTERA 45 +#define ARG_SWORDA 46 +#define ARG_SOUNDPRG 47 +#define ARG_WINDOW_ID 48 +#define ARG_FULLSCREEN 49 +#define ARG_BUBBLE 50 +#define ARG_DESKTOP 51 +#define ARG_COMICS 52 +#define ARG_COMICS_DIR 53 +#define ARG_COMICS_DELAY 54 + +#define DEPTH 24 + +static int screen_width; +static int screen_height; +static gboolean comics = FALSE; +static char *comic_dirs[1024]; /* No more than 1024 comic dirs :-) Ugly, but... */ +static int num_comic_dirs = 0; + +static GdkWindow *window; +static GdkGC *gc; +static SDL_Surface *screen=NULL, *screen_image, *background, **thisfish; +static SDL_Rect *fish_dest, *fish_src, *clean_dest; +static int curr_dest, clean_count, no_sdl_quit = 0, comics_delay = 50; +int window_id = -1, fullscreen = 0; +static unsigned char *original_bg; +static AquariumData ad; + + + +void screensaver_draw_image(int x, int y, int idx, int rev, SA_Image *image) +{ + + fish_dest[curr_dest].x=x; + fish_dest[curr_dest].y=y; + fish_dest[curr_dest].w=image->width; + fish_dest[curr_dest].h=image->height; + + fish_src[curr_dest].x=0; + fish_src[curr_dest].y=(int)((float)idx*(float)image->full_height/(float)image->frames+0.5); + fish_src[curr_dest].w=image->width; + fish_src[curr_dest].h=image->height; + + if(!rev) + thisfish[curr_dest] = SDL_CreateRGBSurfaceFrom(image->image, + image->width, + (int)((float)image->full_height*(float)(idx+1) / + (float)image->frames + 0.5), + 32,image->rowstride, + RMASK, GMASK, BMASK, AMASK); + else + thisfish[curr_dest] = SDL_CreateRGBSurfaceFrom(image->rev, + image->width, + (int)((float)image->full_height*(float)(idx+1) / + (float)image->frames + 0.5), + 32,image->rowstride, + RMASK, GMASK, BMASK, AMASK); + + curr_dest++; +} + + + + +void screensaver_clean(int x,int y,int w,int h) +{ + + clean_dest[clean_count].x=x-5; + clean_dest[clean_count].y=y-5; + clean_dest[clean_count].w=w+10; + clean_dest[clean_count].h=h+10; + + + SDL_BlitSurface(background,&clean_dest[clean_count],screen,&clean_dest[clean_count]); + + clean_count++; +} + + +void screensaver_quit() +{ + /* Resetting the term signal to the orignal so we can quit nicely.*/ + signal(SIGTERM, SIG_DFL); + + if(no_sdl_quit) + kill(getpid(),SIGTERM); + else + exit(0); + + /* In case something is really weird */ + kill(getpid(),SIGKILL); +} + +void comics_clean(void) +{ + int i; + for(i=0;itype == GDK_DESTROY) + exit(0); + } + } + + if(counter == 0 && comics){ + comics_load(); + counter = 25*comics_delay; + } + counter --; + + memcpy(ad.rgb, ad.bgr, ad.ymax * ad.xmax * 3); + fish_update(); + bubble_update(); + gdk_draw_rgb_image(window, gc, ad.xmin, ad.ymin, ad.xmax, ad.ymax, + GDK_RGB_DITHER_NONE, ad.rgb, ad.xmax * 3); + gdk_flush(); + /* 25 fps */ + usleep(1000000/25); + } + +} + +void init_sdl(int sdl_flags) +{ + + if (SDL_Init(SDL_INIT_VIDEO) < 0){ + printf("Can't init SDL: %s\n",SDL_GetError()); + exit(1); + } + + + signal(SIGTERM, screensaver_quit); + atexit(SDL_Quit); + + + if(!SDL_VideoModeOK(screen_width,screen_height, DEPTH, sdl_flags)){ + printf("Sorry, video mode %dx%d in %d bits isn't supported by hardware\n", + screen_width,screen_height, DEPTH); + exit(2); + } + + + screen = SDL_SetVideoMode(screen_width, screen_height, DEPTH, sdl_flags); + + if(screen == NULL){ + printf("Unable to set video mode %dx%d in %d bits.\n", + screen_width,screen_height,DEPTH); + exit(3); + } + + SDL_WM_SetCaption("Sherman's aquarium",NULL); + + + /* Hide the mouse cursor */ + SDL_ShowCursor(0); + + /* Start with all black */ + SDL_FillRect(screen,NULL,0x000000); + + screen_image = SDL_CreateRGBSurfaceFrom(ad.rgb, ad.xmax, ad.ymax, DEPTH, ad.xmax*3, + RMASK, GMASK, BMASK, 0); + background = SDL_CreateRGBSurfaceFrom(ad.bgr, ad.xmax, ad.ymax, DEPTH, ad.xmax*3, + RMASK, GMASK, BMASK, 0); + + + SDL_BlitSurface(screen_image, NULL, screen, NULL); + SDL_UpdateRect(screen,0,0,0,0); + +} + + +void screensaver_init() +{ + char *sdl_command; + XWindowAttributes win_attr; + Display *display; + Fish_settings *fish_settings; + Bubble_settings *bubble_settings; + int sdl_flags = SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_ANYFORMAT; + + screen_height = 480; + screen_width = 640; + + if(window_id != -1){ + display = XOpenDisplay(NULL); + XGetWindowAttributes(display, (Window)window_id, &win_attr); + screen_height = win_attr.height; + screen_width = win_attr.width; + fullscreen = 0; + ad.proximity = 1; /* No sound effects */ + window = gdk_window_foreign_new((Window)window_id); + gdk_window_show(window); + gc = gdk_gc_new(window); + } + + if(fullscreen){ + screen_width = gdk_screen_width(); + screen_height = gdk_screen_height(); + + display=XOpenDisplay(NULL); + sdl_command = g_strdup_printf("SDL_WINDOWID=%d", + (int)RootWindowOfScreen(ScreenOfDisplay(display, DefaultScreen(display)))); + putenv(sdl_command); + ad.proximity = 0; + sdl_flags |= SDL_FULLSCREEN; + } + + ad.xmax = screen_width; + ad.ymax = screen_height; + + ad.virtual_aquarium_x = ad.xmax + 2 * VIRTUAL_AQUARIUM_DX; + ad.virtual_aquarium_y = ad.ymax + 2 * VIRTUAL_AQUARIUM_DY; + + ad.ymin = ad.xmin = ad.viewpoint_start_x = ad.viewpoint_start_y = 0; + + ad.rgb = g_malloc0(ad.xmax*3*ad.ymax); + ad.bgr = g_malloc0(ad.xmax*3*ad.ymax); + original_bg = g_malloc0(ad.xmax*3*ad.ymax); + + background_init(); + fish_init(); + fish_turn(); + bottom_init(); + bubble_init(); + + memcpy(ad.rgb, ad.bgr, ad.xmax*3*ad.ymax); + memcpy(original_bg, ad.bgr, ad.xmax*3*ad.ymax); + + + if(fullscreen || window_id == -1) + init_sdl(sdl_flags); + + + fish_settings = fish_get_settings_ptr(); + bubble_settings = bubble_get_settings_ptr(); + + fish_dest = g_malloc0(sizeof(SDL_Rect)*(fish_settings->num_fish + + bubble_settings->max_bubbles)); + fish_src = g_malloc0(sizeof(SDL_Rect)*(fish_settings->num_fish + + bubble_settings->max_bubbles)); + clean_dest = g_malloc0(sizeof(SDL_Rect)*(fish_settings->num_fish + + bubble_settings->max_bubbles)); + + thisfish = g_malloc0(sizeof(SDL_Surface*)*(fish_settings->num_fish + bubble_settings->max_bubbles)); + +} + +int htoi(char *str) +{ + int i,sum=0,d; + + if(str[0]!='0' || str[1]!='x') return -1; + for(i=2;i='0' && str[i]<='9') d=(int)(str[i]-'0'); + if(str[i]>='A' && str[i]<='F') d=(int)(str[i]-'A'+10); + if(str[i]>='a' && str[i]<='f') d=(int)(str[i]-'a'+10); + + sum+=d; + sum=sum<<4; + } + + return(sum>>4); +} + +void screensaver_init_param(int argc, char **argv) +{ + int i,c, numfish = 0, comic_start; + char *comic_buff; + + Sound_settings *s, sound_settings = {0,TYPE_MP3, NULL}; + Bubble_settings *bub, bubble_settings = {20}; + Bottom_settings *b, bottom_settings = {0,5,1,75,2}; + Background_settings *bg, background_settings = {NULL,NULL, 0,1, + (GaiColor){0, 100, 150, 0}, + (GaiColor){10,120, 250, 0}, + (GaiColor){0,0,0,0}}; + Fish_settings *f, fish_settings = {0, 0, 75, 0, 100, 0, 15, 0, 75, 75, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + struct option cmdline_options[] = { + {"sound", no_argument, NULL, ARG_SOUND}, + {"soundprg", required_argument, NULL, ARG_SOUNDPRG}, + {"ogg", no_argument, NULL, ARG_OGG}, + + + {"seafloor", no_argument, NULL, ARG_SEAFLOOR}, + {"plants", required_argument, NULL, ARG_PLANTS}, + {"plantscale", required_argument, NULL, ARG_PLANTSCALE}, + {"bottomanimals", required_argument, NULL, ARG_BOTTOMANIMALS}, + + {"bg_solid", no_argument, NULL, ARG_BG_SOLID}, + {"bg_shaded", no_argument, NULL, ARG_BG_SHADED}, + {"bg_wateralike", no_argument, NULL, ARG_BG_WATERALIKE}, + {"bg_image", no_argument, NULL, ARG_BG_IMAGE}, + + + {"lcr", required_argument, NULL, ARG_LCR}, + {"lcg", required_argument, NULL, ARG_LCG}, + {"lcb", required_argument, NULL, ARG_LCB}, + + {"ucr", required_argument, NULL, ARG_UCR}, + {"ucg", required_argument, NULL, ARG_UCG}, + {"ucb", required_argument, NULL, ARG_UCB}, + + {"bg_image_file", required_argument, NULL, ARG_BG_IMAGE_FILE}, + + {"comics", no_argument, NULL, ARG_COMICS}, + {"comics_dir", required_argument, NULL, ARG_COMICS_DIR}, + {"comics_delay", required_argument, NULL, ARG_COMICS_DELAY}, + + + {"random", no_argument, NULL, ARG_RANDOM}, + {"selected", no_argument, NULL, ARG_SELECTED}, + {"random_pop", required_argument, NULL, ARG_RANDOM_POP}, + + {"fish1", required_argument, NULL, ARG_FISH1}, + {"fish2", required_argument, NULL, ARG_FISH2}, + {"fish3", required_argument, NULL, ARG_FISH3}, + {"fish4", required_argument, NULL, ARG_FISH4}, + {"fish5", required_argument, NULL, ARG_FISH5}, + {"fish6", required_argument, NULL, ARG_FISH6}, + {"swordfish", required_argument, NULL, ARG_SWORDFISH}, + {"blowfish", required_argument, NULL, ARG_BLOWFISH}, + {"bdweller", required_argument, NULL, ARG_BDWELLER}, + {"fillmore", required_argument, NULL, ARG_FILLMORE}, + {"sherman", required_argument, NULL, ARG_SHERMAN}, + {"megan", required_argument, NULL, ARG_MEGAN}, + {"hunter", required_argument, NULL, ARG_HUNTER}, + {"prey", required_argument, NULL, ARG_PREY}, + {"lori", required_argument, NULL, ARG_LORI}, + {"ernest", required_argument, NULL, ARG_ERNEST}, + {"squid", required_argument, NULL, ARG_SQUID}, + {"hawthorne", required_argument, NULL, ARG_HAWTHORNE}, + + {"eat", no_argument, NULL, ARG_EAT}, + {"explode", no_argument, NULL, ARG_EXPLODE}, + {"rebirth", no_argument, NULL, ARG_REBIRTH}, + {"scalediff", no_argument, NULL, ARG_SCALEDIFF}, + {"speed", required_argument, NULL, ARG_SPEED}, + {"scale", required_argument, NULL, ARG_SCALE}, + {"huntera", required_argument, NULL, ARG_HUNTERA}, + {"sworda", required_argument, NULL, ARG_SWORDA}, + {"window-id", required_argument, NULL, ARG_WINDOW_ID}, + {"root", no_argument, NULL, ARG_FULLSCREEN}, + {"bubble", required_argument, NULL, ARG_BUBBLE}, + {"desktop", no_argument, NULL, ARG_DESKTOP}, + {0,0,0,0}}; + + + b = bottom_get_settings_ptr(); + bub = bubble_get_settings_ptr(); + bg = background_get_settings_ptr(); + f = fish_get_settings_ptr(); + s = sound_get_settings_ptr(); + + memcpy(f,&fish_settings, sizeof(Fish_settings)); + memcpy(bg,&background_settings, sizeof(Background_settings)); + memcpy(b,&bottom_settings, sizeof(Bottom_settings)); + memcpy(bub, &bubble_settings, sizeof(Bubble_settings)); + memcpy(s, &sound_settings, sizeof(Sound_settings)); + + while ((c = + getopt_long_only(argc, argv, "", cmdline_options, NULL)) != -1){ + + switch(c){ + + case ARG_SEAFLOOR: + b->have_sea_floor = 1; + break; + case ARG_SOUND: + s->on = 1; + break; + case ARG_PLANTS: + b->max_plants = atoi(optarg); + break; + case ARG_PLANTSCALE: + b->scale = atoi(optarg); + break; + case ARG_BOTTOMANIMALS: + b->num_bottom_animals = atoi(optarg); + break; + case ARG_OGG: + s->type = TYPE_OGG; + break; + case ARG_BG_SOLID: + bg->type = BG_SOLID; + bg->desktop = 0; + break; + case ARG_BG_SHADED: + bg->type = BG_SHADED; + bg->desktop = 0; + break; + case ARG_BG_WATERALIKE: + bg->type = BG_WATER; + bg->desktop = 0; + break; + case ARG_BG_IMAGE: + bg->type = BG_IMAGE; + bg->desktop = 0; + break; + case ARG_LCR: + bg->solid_c.r = bg->shaded_bot_c.r = atoi(optarg); + break; + case ARG_LCG: + bg->solid_c.g = bg->shaded_bot_c.g = atoi(optarg); + break; + case ARG_LCB: + bg->solid_c.b = bg->shaded_bot_c.b = atoi(optarg); + break; + case ARG_UCR: + bg->shaded_top_c.r = atoi(optarg); + break; + case ARG_UCG: + bg->shaded_top_c.g = atoi(optarg); + break; + case ARG_UCB: + bg->shaded_top_c.b = atoi(optarg); + break; + case ARG_BG_IMAGE_FILE: + bg->imagename = g_strdup_printf(optarg); + break; + case ARG_RANDOM: + f->type = RANDOM_FISH; + break; + case ARG_SELECTED: + f->type = SELECTION_FISH; + break; + case ARG_RANDOM_POP: + f->num_fish = atoi(optarg); + break; + case ARG_FISH1: + f->fish1 = atoi(optarg); + break; + case ARG_FISH2: + f->fish2 = atoi(optarg); + break; + case ARG_FISH3: + f->fish3 = atoi(optarg); + break; + case ARG_FISH4: + f->fish4 = atoi(optarg); + break; + case ARG_FISH5: + f->fish5 = atoi(optarg); + break; + case ARG_FISH6: + f->fish6 = atoi(optarg); + break; + case ARG_BLOWFISH: + f->blowfish = atoi(optarg); + break; + case ARG_SWORDFISH: + f->swordfish = atoi(optarg); + break; + case ARG_BDWELLER: + f->bdweller = atoi(optarg); + break; + case ARG_FILLMORE: + f->fillmore = atoi(optarg); + break; + case ARG_SHERMAN: + f->sherman = atoi(optarg); + break; + case ARG_MEGAN: + f->megan = atoi(optarg); + break; + case ARG_HUNTER: + f->hunter = atoi(optarg); + break; + case ARG_PREY: + f->prey = atoi(optarg); + break; + case ARG_LORI: + f->lori = atoi(optarg); + break; + case ARG_ERNEST: + f->ernest = atoi(optarg); + break; + case ARG_SQUID: + f->squid = atoi(optarg); + break; + case ARG_HAWTHORNE: + f->hawthorne = atoi(optarg); + break; + case ARG_EAT: + f->eat = 1; + break; + case ARG_EXPLODE: + f->explode = 1; + break; + case ARG_REBIRTH: + f->rebirth = 1; + break; + case ARG_SCALEDIFF: + f->scale_diff = 1; + break; + case ARG_SPEED: + f->speed = atoi(optarg); + break; + case ARG_SCALE: + f->scale = atoi(optarg); + case ARG_HUNTERA: + f->hunter_agr = atoi(optarg); + break; + case ARG_SWORDA: + f->swordfish_agr = atoi(optarg); + break; + case ARG_SOUNDPRG: + s->prg = g_strdup_printf(optarg); + break; + case ARG_WINDOW_ID: + window_id = htoi(optarg); + break; + case ARG_FULLSCREEN: + fullscreen = 1; + break; + case ARG_BUBBLE: + bub->max_bubbles = atoi(optarg); + break; + case ARG_DESKTOP: + bg->type = 0; + bg->desktop = 1; + break; + case ARG_COMICS: + comics = TRUE; + comics_prepare(IMAGE_PATH "/strips"); + break; + case ARG_COMICS_DELAY: + comics_delay = atoi(optarg); + break; + case ARG_COMICS_DIR: + comics_clean(); + comic_start = 0; + comic_buff = g_strdup(optarg); + for(i=0;ifish1; + numfish += f->fish2; + numfish += f->fish3; + numfish += f->fish4; + numfish += f->fish5; + numfish += f->fish6; + numfish += f->swordfish; + numfish += f->blowfish; + numfish += f->fillmore; + numfish += f->sherman; + numfish += f->prey; + numfish += f->hunter; + numfish += f->lori; + numfish += f->ernest; + numfish += f->squid; + numfish += f->megan; + numfish += f->bdweller; + numfish += f->hawthorne; + + if(f->type == SELECTION_FISH) + f->num_fish = numfish; + +} + +int main(int argc, char **argv) +{ + gdk_init(&argc, &argv); + + ad.rnd = g_rand_new(); + + screensaver_init_param(argc, argv); + screensaver_init(0); + + if(window_id==-1) + screensaver_main_sdl(); + else + screensaver_main_gdk(); + return 0; +} + + +AquariumData *aquarium_get_settings_ptr(void) +{ + return &ad; +} + +unsigned char *aquarium_install_path(void) +{ + return IMAGE_PATH; +} + + +void aquarium_draw_image(int x, int y, int idx, int rev, SA_Image *image) +{ + if(window_id==-1) + screensaver_draw_image(x, y, idx, rev, image); + else + draw_image(x, y, idx, rev, image); +} + +void aquarium_draw_pic_alpha(SA_Image *image, int w, int h, int x, int y, int idx, int alpha) +{ + if(window_id==-1) + screensaver_draw_image(x, y, idx, 0, image); + else + draw_pic_alpha(image->image, w, h, x, y, idx,alpha); +} + + +void aquarium_clean_image(int x, int y, int w, int h) +{ + if(window_id==-1) + screensaver_clean(x, y, w, h); +} + +GdkPixbuf *gai_load_image(char *fname) +{ + GError *msg = NULL; + GdkPixbuf *pix; + char *full_name; + + full_name = g_strdup_printf("%s/%s",IMAGE_PATH,fname); + pix = gdk_pixbuf_new_from_file(full_name, &msg); + if(!pix){ + printf("%s\n",msg->message); + exit(1); + } + g_free(full_name); + + return pix; + +} +void gai_display_error_continue(char *msg) +{ + printf(" *** Error: %s\n",msg); +} diff --git a/sherman-aquarium/shermans/screensaver.h b/sherman-aquarium/shermans/screensaver.h new file mode 100644 index 0000000..67f01ad --- /dev/null +++ b/sherman-aquarium/shermans/screensaver.h @@ -0,0 +1,2 @@ + +GdkPixbuf *gai_load_image(char *); diff --git a/sherman-aquarium/shermans/settings.c b/sherman-aquarium/shermans/settings.c new file mode 100644 index 0000000..114feb7 --- /dev/null +++ b/sherman-aquarium/shermans/settings.c @@ -0,0 +1,692 @@ + +#include +#include +#include +#include "aquarium.h" +#include "../config.h" +#include "fish.h" +#include "bubble.h" +#include "date.h" +#include "clock.h" +#include "background.h" +#include "over.h" +#include "leds.h" +#include "bottom.h" +#ifdef XMMS +#include "xmms_sn.h" +#endif +#include "soundeffects.h" +#include "thermometer.h" + +/* Over "plugins" */ +#include "matrix.h" +#include "plasma.h" +#include "tetris.h" +#include "settings.h" + + + +void bubble_save_settings(void) +{ + Bubble_settings *bubble_settings; + + bubble_settings = bubble_get_settings_ptr(); + + gai_save_int("bubble/max_bubbles", bubble_settings->max_bubbles); + +} + +void thermometer_load_settings(void) +{ + Thermometer_settings *thermometer_settings; + + thermometer_settings = thermometer_get_settings_ptr(); + + thermometer_settings->draw1 = gai_load_int_with_default("thermometer/draw1", DRAW_BEFORE); + thermometer_settings->vert1 = gai_load_int_with_default("thermometer/vert1", BOTTOM); + thermometer_settings->horz1 = gai_load_int_with_default("thermometer/horz1", RIGHT); + thermometer_settings->split1 = gai_load_int_with_default("thermometer/split1", FALSE); + + thermometer_settings->c1 = gai_load_gaicolor_with_default("thermometer/c1", (GaiColor){0xe0, 0x00,0x00, 0xff}); + thermometer_settings->c1_s = gai_load_gaicolor_with_default("thermometer/c1_s", (GaiColor){0x00, 0xe0, 0xFF, 0x00}); + + thermometer_settings->messure1 = gai_load_int_with_default("thermometer/cpu1", STATUS_CPU); + thermometer_settings->messure1_s = gai_load_int_with_default("thermometer/cpu1_s", STATUS_OFF); + thermometer_settings->roof1 = gai_load_int_with_default("thermometer/roof1", 33600/8); + thermometer_settings->roof1_s = gai_load_int_with_default("thermometer/roof1_s", 33600/8); + thermometer_settings->mount_point1_s = gai_load_string_with_default("thermometer/mount_point1_s", "/"); + thermometer_settings->mount_point1 = gai_load_string_with_default("thermometer/mount_point1", "/"); + + thermometer_settings->draw2 = gai_load_int_with_default("thermometer/draw2", DRAW_BEFORE); + thermometer_settings->vert2 = gai_load_int_with_default("thermometer/vert2", BOTTOM); + thermometer_settings->horz2 = gai_load_int_with_default("thermometer/horz2", RIGHT); + thermometer_settings->split2 = gai_load_int_with_default("thermometer/split2", FALSE); + + thermometer_settings->c2 = gai_load_gaicolor_with_default("thermometer/c2", (GaiColor){0x00, 0xe0, 0x00, 0xff}); + thermometer_settings->c2_s = gai_load_gaicolor_with_default("thermometer/c2_s", (GaiColor){0xe0, 0xe0, 0x00, 0xff}); + + thermometer_settings->messure2 = gai_load_int_with_default("thermometer/cpu2", STATUS_OFF); + thermometer_settings->messure2_s = gai_load_int_with_default("thermometer/cpu2_s", STATUS_OFF); + thermometer_settings->roof2 = gai_load_int_with_default("thermometer/roof2", 33600/8); + thermometer_settings->roof2_s = gai_load_int_with_default("thermometer/roof2_s", 33600/8); + thermometer_settings->mount_point2_s = gai_load_string_with_default("thermometer/mount_point2_s", "/"); + thermometer_settings->mount_point2 = gai_load_string_with_default("thermometer/mount_point2", "/"); + + + +} + +void thermometer_save_settings(void) +{ + Thermometer_settings *thermometer_settings; + + thermometer_settings = thermometer_get_settings_ptr(); + + gai_save_int("thermometer/draw1", thermometer_settings->draw1); + gai_save_int("thermometer/vert1", thermometer_settings->vert1); + gai_save_int("thermometer/horz1", thermometer_settings->horz1); + gai_save_int("thermometer/split1", thermometer_settings->split1); + gai_save_gaicolor("thermometer/c1", thermometer_settings->c1); + gai_save_gaicolor("thermometer/c1_s", thermometer_settings->c1_s); + + gai_save_int("thermometer/cpu1", thermometer_settings->messure1); + gai_save_int("thermometer/cpu1_s", thermometer_settings->messure1_s); + gai_save_int("thermometer/roof1", thermometer_settings->roof1); + gai_save_int("thermometer/roof1_s", thermometer_settings->roof1_s); + gai_save_string("thermometer/mount_point1_s", thermometer_settings->mount_point1_s); + gai_save_string("thermometer/mount_point1", thermometer_settings->mount_point1); + + + gai_save_int("thermometer/draw2", thermometer_settings->draw2); + gai_save_int("thermometer/vert2", thermometer_settings->vert2); + gai_save_int("thermometer/horz2", thermometer_settings->horz2); + gai_save_int("thermometer/split2", thermometer_settings->split2); + gai_save_gaicolor("thermometer/c2", thermometer_settings->c2); + gai_save_gaicolor("thermometer/c2_s", thermometer_settings->c2_s); + + + gai_save_int("thermometer/cpu2", thermometer_settings->messure2); + gai_save_int("thermometer/cpu2_s", thermometer_settings->messure2_s); + gai_save_int("thermometer/roof2", thermometer_settings->roof2); + gai_save_int("thermometer/roof2_s", thermometer_settings->roof2_s); + gai_save_string("thermometer/mount_point2_s", thermometer_settings->mount_point2_s); + gai_save_string("thermometer/mount_point2", thermometer_settings->mount_point2); + + + +} + +void tetris_load_settings(void) +{ + Tetris_settings *tetris_settings; + + tetris_settings = tetris_get_settings_ptr(); + + tetris_settings->size_limit = gai_load_bool_with_default("tetris/size_limit", FALSE); + tetris_settings->show_next = gai_load_bool_with_default("tetris/show_next", TRUE); + tetris_settings->width = gai_load_int_with_default("tetris/width", 10); + tetris_settings->height = gai_load_int_with_default("tetris/height", 10); +} + +void tetris_save_settings(void) +{ + Tetris_settings *tetris_settings; + + tetris_settings = tetris_get_settings_ptr(); + + gai_save_bool("tetris/size_limit", tetris_settings->size_limit); + gai_save_int("tetris/width", tetris_settings->width); + gai_save_int("tetris/height", tetris_settings->height); + gai_save_bool("tetris/show_next", tetris_settings->show_next); +} + + +void bubble_load_settings(void) +{ + Bubble_settings *bubble_settings; + + bubble_settings = bubble_get_settings_ptr(); + + bubble_settings->max_bubbles = gai_load_int_with_default("bubble/max_bubbles", 5); + +} + + +void date_load_settings(void) +{ + Date_settings *date_settings; + + date_settings = date_get_settings_ptr(); + + date_settings->on = gai_load_bool_with_default("date/on", TRUE); + + date_settings->draw = gai_load_int_with_default("date/draw", DRAW_AFTER); + + + date_settings->vert = gai_load_bool_with_default("date/vert", TOP); + date_settings->horz = gai_load_bool_with_default("date/horz", RIGHT); + + date_settings->c = gai_load_gaicolor_with_default("date/color", (GaiColor){208, 208, 208, 80}); + +} + +void date_save_settings(void) +{ + + Date_settings *date_settings; + + date_settings = date_get_settings_ptr(); + + + gai_save_bool("date/on", date_settings->on); + gai_save_bool("date/draw", date_settings->draw); + + gai_save_bool("date/horz", date_settings->horz); + gai_save_bool("date/vert", date_settings->vert); + + gai_save_gaicolor("date/color", date_settings->c); + +} + + +void clock_load_settings(void) +{ + Clock_settings *clock_settings; + + clock_settings = clock_get_settings_ptr(); + + + clock_settings->type = gai_load_int_with_default("clock/type", CLOCK_OFF); + + clock_settings->analog_seconds = gai_load_bool_with_default("clock/analog_seconds", TRUE); + clock_settings->digital_seconds = gai_load_bool_with_default("clock/digital_seconds", TRUE); + + + clock_settings->draw = gai_load_int_with_default("clock/draw", DRAW_BEFORE); + + clock_settings->vert = gai_load_int_with_default("clock/vert", CENTER); + clock_settings->horz = gai_load_int_with_default("clock/horz", CENTER); + + + /* Set up some mint green colour as default */ + + clock_settings->digital_colour = gai_load_gaicolor_with_default("clock/digital_colour", (GaiColor){4, 226, 145, 80}); + clock_settings->digital_blinking = gai_load_bool_with_default("clock/digital_blinking", TRUE); + clock_settings->digital_fontsize = gai_load_int_with_default("clock/digital_fontsize", CLOCK_SMALL_FONT); + + + /* Some yellow colour */ + clock_settings->fuzzy_colour = gai_load_gaicolor_with_default("clock/fuzzy_colour", (GaiColor){226, 226, 4, 80}); + + /* Some red version */ + clock_settings->analog_colour_hour = gai_load_gaicolor_with_default("clock/analog_colour_hour", (GaiColor){226, 49, 4, 80}); + + /* Green */ + clock_settings->analog_colour_min = gai_load_gaicolor_with_default("clock/analog_colour_min", (GaiColor){23, 226, 4, 80}); + + /* Yellow */ + clock_settings->analog_colour_sec = gai_load_gaicolor_with_default("clock/analog_colour_sec", (GaiColor){255, 0, 255, 80}); + + clock_settings->analog_keep_circular = gai_load_bool_with_default("clock/analog_keep_circular", TRUE); + + +} + + +void clock_save_settings(void) +{ + Clock_settings *clock_settings; + + clock_settings = clock_get_settings_ptr(); + + gai_save_int("clock/type", clock_settings->type); + + gai_save_bool("clock/analog_seconds", clock_settings->analog_seconds); + gai_save_bool("clock/digital_seconds", clock_settings->digital_seconds); + + gai_save_int("clock/draw", clock_settings->draw); + gai_save_int("clock/horz", clock_settings->horz); + gai_save_int("clock/vert", clock_settings->vert); + + gai_save_gaicolor("clock/digital_colour", clock_settings->digital_colour); + gai_save_bool("clock/digital_blinking", clock_settings->digital_blinking); + gai_save_int("clock/digital_fontsize", clock_settings->digital_fontsize); + + gai_save_gaicolor("clock/fuzzy_colour", clock_settings->fuzzy_colour); + + gai_save_gaicolor("clock/analog_colour_hour",clock_settings->analog_colour_hour); + gai_save_gaicolor("clock/analog_colour_min", clock_settings->analog_colour_min); + gai_save_gaicolor("clock/analog_colour_sec", clock_settings->analog_colour_sec); + + gai_save_bool("clock/analog_keep_circular",clock_settings->analog_keep_circular); + + +} + + +void background_load_settings(void) +{ + Background_settings *background_settings; + + background_settings = background_get_settings_ptr(); + + + background_settings->type = gai_load_int_with_default("background/type", BG_SHADED); + + background_settings->imagename = gai_load_string_with_default("background/imagename", ""); + background_settings->imagename_new = NULL; + + background_settings->solid_c = gai_load_gaicolor_with_default("background/solid", (GaiColor){12, 100, 220, 255}); + background_settings->shaded_top_c = gai_load_gaicolor_with_default("background/shaded_top", (GaiColor){83, 155, 220, 255}); + background_settings->shaded_bot_c = gai_load_gaicolor_with_default("background/shaded_bot",(GaiColor){5, 40, 80, 255}); +} + + +void background_save_settings(void) +{ + Background_settings *background_settings; + + background_settings = background_get_settings_ptr(); + + gai_save_string("background/imagename", background_settings->imagename); + + gai_save_bool("background/type", background_settings->type); + + gai_save_gaicolor("background/solid", background_settings->solid_c); + gai_save_gaicolor("background/shaded_top", background_settings->shaded_top_c); + gai_save_gaicolor("background/shaded_bot", background_settings->shaded_bot_c); + +} + + +void bottom_load_settings(void) +{ + Bottom_settings *bottom_settings; + + bottom_settings = bottom_get_settings_ptr(); + + bottom_settings->have_sea_floor = gai_load_bool_with_default("bottom/have_sea_floor", TRUE); + bottom_settings->max_plants = gai_load_int_with_default("bottom/max_plants", 5); + bottom_settings->num_bottom_animals = gai_load_int_with_default("bottom/num_bottom_animals", 1); + bottom_settings->scale = gai_load_int_with_default("bottom/scale", 30); + bottom_settings->random_plants = gai_load_bool_with_default("bottom/random_plants", TRUE); + +} + +void bottom_save_settings(void) +{ + + Bottom_settings *bottom_settings; + + bottom_settings = bottom_get_settings_ptr(); + + gai_save_bool("bottom/have_sea_floor",bottom_settings->have_sea_floor); + gai_save_bool("bottom/random_plants",bottom_settings->random_plants); + gai_save_int("bottom/max_plants",bottom_settings->max_plants); + gai_save_int("bottom/scale",bottom_settings->scale); + gai_save_int("bottom/num_bottom_animals",bottom_settings->num_bottom_animals); + + +} + + + + +void fish_load_settings(void) +{ + int numfish = 0; + Fish_settings *fish_settings; + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + fish_settings = fish_get_settings_ptr(); + + fish_settings->eat = gai_load_bool_with_default("fish/eat", TRUE); + fish_settings->explode = gai_load_bool_with_default("fish/explode", TRUE); + + fish_settings->scale = gai_load_int_with_default("fish/scale", DEFAULT_SCALE); + + + fish_settings->speed = gai_load_int_with_default("fish/speed", DEFAULT_SPEED); + + fish_settings->scale_diff = gai_load_bool_with_default("fish/scale_diff", TRUE); + fish_settings->rebirth = gai_load_bool_with_default("fish/rebirth", FALSE); + + fish_settings->swordfish_agr = gai_load_int_with_default("fish/swordfish_agr", 75); + fish_settings->hunter_agr = gai_load_int_with_default("fish/hunter_agr", 75); + + + fish_settings->num_fish = gai_load_int_with_default("fish/num_fish", NRFISH); + fish_settings->type = gai_load_int_with_default("fish/type", RANDOM_FISH); + + + numfish += fish_settings->fish1 = gai_load_int_with_default("fish/fish1", 1); + numfish += fish_settings->fish2 = gai_load_int_with_default("fish/fish2", 1); + numfish += fish_settings->fish3 = gai_load_int_with_default("fish/fish3", 1); + numfish += fish_settings->fish4 = gai_load_int_with_default("fish/fish4", 1); + numfish += fish_settings->fish5 = gai_load_int_with_default("fish/fish5", 1); + numfish += fish_settings->fish6 = gai_load_int_with_default("fish/fish6", 1); + numfish += fish_settings->swordfish = gai_load_int_with_default("fish/swordfish", 1); + numfish += fish_settings->blowfish = gai_load_int_with_default("fish/blowfish", 1); + numfish += fish_settings->fillmore = gai_load_int_with_default("fish/fillmore", 1); + numfish += fish_settings->sherman = gai_load_int_with_default("fish/sherman", 1); + numfish += fish_settings->prey = gai_load_int_with_default("fish/prey", 1); + numfish += fish_settings->hunter = gai_load_int_with_default("fish/hunter", 1); + numfish += fish_settings->lori = gai_load_int_with_default("fish/lori", 1); + numfish += fish_settings->ernest = gai_load_int_with_default("fish/ernest", 1); + numfish += fish_settings->squid = gai_load_int_with_default("fish/squid", 1); + numfish += fish_settings->megan = gai_load_int_with_default("fish/megan", 1); + numfish += fish_settings->bdweller = gai_load_int_with_default("fish/bdweller", 1); + numfish += fish_settings->hawthorne = gai_load_int_with_default("fish/hawthorne", 1); + + if(fish_settings->type == SELECTION_FISH){ + fish_settings->num_fish = numfish; + } + + if(fish_settings->type == RANDOM_POP_FISH) + fish_settings->num_fish = g_rand_int_range(ad->rnd, 1, 21); + + +} + + + + +void fish_save_settings(void) +{ + Fish_settings *fish_settings; + + fish_settings = fish_get_settings_ptr(); + + gai_save_bool("fish/eat", fish_settings->eat); + gai_save_bool("fish/explode", fish_settings->explode); + gai_save_int("fish/scale", fish_settings->scale); + + gai_save_int("fish/swordfish_agr", fish_settings->swordfish_agr); + gai_save_int("fish/hunter_agr", fish_settings->hunter_agr); + + + gai_save_bool("fish/scale_diff", fish_settings->scale_diff); + gai_save_int("fish/type", fish_settings->type); + gai_save_bool("fish/rebirth", fish_settings->rebirth); + + + if(fish_settings->type == SELECTION_FISH) + fish_settings->num_fish = fish_settings->fish1 + fish_settings->fish2 + fish_settings->fish3 + + fish_settings->fish4 + fish_settings->fish5 + fish_settings->fish6 + fish_settings->swordfish + + fish_settings->blowfish + fish_settings->fillmore + fish_settings->sherman + fish_settings->prey + + fish_settings->hunter + fish_settings->lori + fish_settings->ernest + fish_settings->squid + + fish_settings->megan; + + gai_save_int("fish/fish1", fish_settings->fish1); + gai_save_int("fish/fish2", fish_settings->fish2); + gai_save_int("fish/fish3", fish_settings->fish3); + gai_save_int("fish/fish4", fish_settings->fish4); + gai_save_int("fish/fish5", fish_settings->fish5); + gai_save_int("fish/fish6", fish_settings->fish6); + gai_save_int("fish/swordfish", fish_settings->swordfish); + gai_save_int("fish/blowfish", fish_settings->blowfish); + gai_save_int("fish/fillmore", fish_settings->fillmore); + gai_save_int("fish/sherman", fish_settings->sherman); + gai_save_int("fish/prey", fish_settings->prey); + gai_save_int("fish/hunter", fish_settings->hunter); + gai_save_int("fish/lori", fish_settings->lori); + gai_save_int("fish/ernest", fish_settings->ernest); + gai_save_int("fish/squid", fish_settings->squid); + gai_save_int("fish/megan", fish_settings->megan); + gai_save_int("fish/bdweller", fish_settings->bdweller); + gai_save_int("fish/hawthorne", fish_settings->hawthorne); + gai_save_int("fish/num_fish", fish_settings->num_fish); + + +} + + +void over_load_settings(void) +{ + Over_settings *over_settings; + + over_settings = over_get_settings_ptr(); + + + over_settings->type = gai_load_int_with_default("over/type", OVER_MATRIX); + over_settings->fade = gai_load_bool_with_default("over/fade", TRUE); + over_settings->cursor_off = gai_load_bool_with_default("over/cursor_off", TRUE); + +} + + +void over_save_settings(void) +{ + Over_settings *over_settings; + + over_settings = over_get_settings_ptr(); + gai_save_int("over/type", over_settings->type); + gai_save_bool("over/fade", over_settings->fade); + gai_save_bool("over/cursor_off", over_settings->cursor_off); + +} + +void tetris_load_highscores(void) +{ + int i; + char tmp[100]; + + Tetris_highscore_table *t; + t = tetris_get_highscore_table_ptr(); + + for(i=0;i<10;i++){ + g_snprintf(tmp, 100, "tetris/highscore%d_score", i); + t[i].score = gai_load_int_with_default(tmp, 10-i); + + g_snprintf(tmp, 100, "tetris/highscore%d_level", i); + t[i].level = gai_load_int_with_default(tmp, 1); + + g_snprintf(tmp, 100, "tetris/highscore%d_lines", i); + t[i].lines = gai_load_int_with_default(tmp, 10-i); + } + + +} + +void tetris_save_highscores(void) +{ + char tmp[100]; + int i; + Tetris_highscore_table *t; + t = tetris_get_highscore_table_ptr(); + + for(i=0;i<10;i++){ + g_snprintf(tmp, 100, "tetris/highscore%d_score", i); + gai_save_int(tmp, t[i].score); + g_snprintf(tmp, 100, "tetris/highscore%d_level", i); + gai_save_int(tmp, t[i].level); + g_snprintf(tmp, 100, "tetris/highscore%d_lines", i); + gai_save_int(tmp, t[i].lines); + } + +} + +void leds_load_settings(void) +{ + int i; + char *tmp; + Leds_settings *leds_settings; + + leds_settings = leds_get_settings_ptr(); + + + leds_settings->draw = gai_load_int_with_default("leds/draw", DRAW_AFTER); + + leds_settings->horz = gai_load_int_with_default("leds/horz", LEFT); + leds_settings->vert = gai_load_int_with_default("leds/vert", TOP); + + + leds_settings->vert_horz = gai_load_bool_with_default("leds/vert_horz", TRUE); + leds_settings->alpha = gai_load_int_with_default("leds/alpha", 0x80); + + for(i=0;ileds_func[i] = gai_load_int_with_default(tmp, LEDS_OFF); + g_free(tmp); + tmp = g_strdup_printf("leds/led%d_colour", i); + leds_settings->leds_colour[i] = gai_load_int_with_default(tmp, LEDS_VIOLET); + g_free(tmp); + tmp = g_strdup_printf("leds/led%d_show_off", i); + leds_settings->leds_show_off[i] = gai_load_int_with_default(tmp, FALSE); + g_free(tmp); + + } +} + + + +void leds_save_settings(void) +{ + int i; + char *tmp; + Leds_settings *leds_settings; + + leds_settings = leds_get_settings_ptr(); + + gai_save_int("leds/draw", leds_settings->draw); + + gai_save_int("leds/vert", leds_settings->vert); + gai_save_int("leds/horz", leds_settings->horz); + + gai_save_int("leds/vert_horz", leds_settings->vert_horz); + gai_save_int("leds/alpha", leds_settings->alpha); + + for(i=0;ileds_func[i]); + g_free(tmp); + + tmp = g_strdup_printf("leds/led%d_colour", i); + gai_save_int(tmp, leds_settings->leds_colour[i]); + g_free(tmp); + + tmp = g_strdup_printf("leds/led%d_show_off", i); + gai_save_int(tmp, leds_settings->leds_show_off[i]); + g_free(tmp); + } + + + +} +#ifdef XMMS +void xmms_sn_load_settings(void) +{ + Xmms_sn_settings *xmms_sn_settings; + + xmms_sn_settings = xmms_sn_get_settings_ptr(); + + + xmms_sn_settings->on = gai_load_bool_with_default("xmms_sn/on", FALSE); + + xmms_sn_settings->c = gai_load_gaicolor_with_default("xmms_sn/colour", (GaiColor){45, 145, 245, 255}); + + xmms_sn_settings->draw = gai_load_int_with_default("xmms_sn/draw", DRAW_AFTER); + + xmms_sn_settings->direction = gai_load_int_with_default("xmms_sn/direction", XMMS_SN_HORIZONTAL); + xmms_sn_settings->speed = gai_load_int_with_default("xmms_sn/speed", 200); + + + xmms_sn_settings->horz = gai_load_int_with_default("xmms_sn/horz", CENTER); + xmms_sn_settings->vert = gai_load_int_with_default("xmms_sn/vert", LEFT); + + xmms_sn_settings->fb = gai_load_int_with_default("xmms_sn/fb", XMMS_SN_FORWARDS); + +} + +void xmms_sn_save_settings(void) +{ + Xmms_sn_settings *xmms_sn_settings; + + xmms_sn_settings = xmms_sn_get_settings_ptr(); + + + gai_save_bool("xmms_sn/on", xmms_sn_settings->on); + + gai_save_gaicolor("xmms_sn/colour", xmms_sn_settings->c); + + gai_save_int("xmms_sn/draw", xmms_sn_settings->draw); + gai_save_int("xmms_sn/direction", xmms_sn_settings->direction); + gai_save_int("xmms_sn/speed", xmms_sn_settings->speed); + + gai_save_int("xmms_sn/horz", xmms_sn_settings->horz); + gai_save_int("xmms_sn/vert", xmms_sn_settings->vert); + gai_save_int("xmms_sn/fb", xmms_sn_settings->fb); + + + +} +#endif + +void sound_load_settings(void) +{ + Sound_settings *sound_settings; + + sound_settings = sound_get_settings_ptr(); + + sound_settings->on = gai_load_bool_with_default("sound/on", FALSE); + + sound_settings->type = gai_load_int_with_default("sound/type", TYPE_MP3); + + + sound_settings->prg = gai_load_string_with_default("sound/prg", "mpg123 -q"); + +} + +void sound_save_settings(void) +{ + Sound_settings *sound_settings; + + sound_settings = sound_get_settings_ptr(); + + gai_save_bool("sound/on", sound_settings->on); + gai_save_int("sound/type", sound_settings->type); + + + gai_save_string("sound/prg", sound_settings->prg); + +} + +void general_load_settings(void) +{ + General_settings *general_settings; + general_settings = general_get_settings_ptr(); + general_settings->ratio_width = gai_load_int_with_default("general/ratio_width", 1); + general_settings->ratio_height = gai_load_int_with_default("general/ratio_height", 1); + + general_settings->mouse_left = gai_load_int_with_default("general/mouse_left", MOUSE_OFF); + general_settings->mouse_middle = gai_load_int_with_default("general/mouse_middle", MOUSE_OFF); + general_settings->mouse_up = gai_load_int_with_default("general/mouse_up", MOUSE_OFF); + general_settings->mouse_down = gai_load_int_with_default("general/mouse_down", MOUSE_OFF); + + general_settings->mouse_left_option = gai_load_string_with_default("general/mouse_left_option", ""); + general_settings->mouse_middle_option = gai_load_string_with_default("general/mouse_middle_option", ""); + general_settings->mouse_up_option = gai_load_string_with_default("general/mouse_up_option", ""); + general_settings->mouse_down_option = gai_load_string_with_default("general/mouse_down_option", ""); + +} + +void general_save_settings(void) +{ + General_settings *general_settings; + general_settings = general_get_settings_ptr(); + + gai_save_int("general/ratio_width", general_settings->ratio_width); + gai_save_int("general/ratio_height", general_settings->ratio_height); + + gai_save_int("general/mouse_left", general_settings->mouse_left); + gai_save_int("general/mouse_middle", general_settings->mouse_middle); + gai_save_int("general/mouse_up", general_settings->mouse_up); + gai_save_int("general/mouse_down", general_settings->mouse_down); + + gai_save_string("general/mouse_left_option", general_settings->mouse_left_option); + gai_save_string("general/mouse_middle_option", general_settings->mouse_middle_option); + gai_save_string("general/mouse_up_option", general_settings->mouse_up_option); + gai_save_string("general/mouse_down_option", general_settings->mouse_down_option); + +} diff --git a/sherman-aquarium/shermans/settings.h b/sherman-aquarium/shermans/settings.h new file mode 100644 index 0000000..6db3459 --- /dev/null +++ b/sherman-aquarium/shermans/settings.h @@ -0,0 +1,48 @@ +#ifndef SETTINGS_H +#define SETTINGS_H + +void clock_load_settings(void); +void clock_save_settings(void); + +void date_load_settings(void); +void date_save_settings(void); + +void bubble_load_settings(void); +void bubble_save_settings(void); + +void background_load_settings(void); +void background_save_settings(void); + +void fish_load_settings(void); +void fish_save_settings(void); + +void bottom_load_settings(void); +void bottom_save_settings(void); + + +void over_load_settings(void); +void over_save_settings(void); + +void tetris_load_highscores(void); +void tetris_save_highscores(void); + +void tetris_save_settings(void); +void tetris_load_settings(void); + +void leds_load_settings(void); +void leds_save_settings(void); + +void xmms_sn_load_settings(void); +void xmms_sn_save_settings(void); + +void sound_load_settings(void); +void sound_save_settings(void); + + +void general_load_settings(void); +void general_save_settings(void); + +void thermometer_load_settings(void); +void thermometer_save_settings(void); + +#endif diff --git a/sherman-aquarium/shermans/soundeffects.c b/sherman-aquarium/shermans/soundeffects.c new file mode 100644 index 0000000..9c82a17 --- /dev/null +++ b/sherman-aquarium/shermans/soundeffects.c @@ -0,0 +1,106 @@ + + +#include "soundeffects.h" +#include "settings.h" +#include "aquarium.h" +#include +#include +#include +#include +#include +#include + +static Sound_settings sound_settings; + +Sound_settings *sound_get_settings_ptr(void) +{ + return &sound_settings; +} + +static void sound_exec(char *prg, char *sound) +{ + static int pid=-1; + char *argv[256]; + int argc=0, start=0,i; + + if(pid!=-1){ + if(kill(pid,0)==0) + return; + } + + for(i=0;iproximity){ + if(sound_settings.type == TYPE_MP3) + sound_exec(sound_settings.prg, "sounds/mp3/deathscream.mp3"); + else + sound_exec(sound_settings.prg, "sounds/ogg/deathscream.ogg"); + + } +} + +void sound_explode(void) +{ + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + if(sound_settings.on && !ad->proximity){ + if(sound_settings.type == TYPE_MP3) + sound_exec(sound_settings.prg, "sounds/mp3/explode.mp3"); + else + sound_exec(sound_settings.prg, "sounds/ogg/explode.ogg"); + } +} + +void sound_bubbles(void) +{ + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + if(sound_settings.on && !ad->proximity){ + + if((rand()%600)<4){ + if((rand()%10)<4){ + if(sound_settings.type == TYPE_MP3) + sound_exec(sound_settings.prg, "sounds/mp3/manybubbles.mp3"); + else + sound_exec(sound_settings.prg, "sounds/ogg/manybubbles.ogg"); + } + else{ + if(sound_settings.type == TYPE_MP3) + sound_exec(sound_settings.prg, "sounds/mp3/fewbubbles.mp3"); + else + sound_exec(sound_settings.prg, "sounds/ogg/fewbubbles.ogg"); + } + } + } +} diff --git a/sherman-aquarium/shermans/soundeffects.h b/sherman-aquarium/shermans/soundeffects.h new file mode 100644 index 0000000..5b0ef6e --- /dev/null +++ b/sherman-aquarium/shermans/soundeffects.h @@ -0,0 +1,19 @@ +#ifndef SOUNDEFFECTS_H +#define SOUNDEFFECTS_H + +void sound_eatscream(void); +void sound_explode(void); +void sound_bubbles(void); + +#define TYPE_MP3 0 +#define TYPE_OGG 1 + +typedef struct { + int on; + int type; + char *prg; +} Sound_settings; + +Sound_settings *sound_get_settings_ptr(void); + +#endif diff --git a/sherman-aquarium/shermans/status.h b/sherman-aquarium/shermans/status.h new file mode 100644 index 0000000..55c1583 --- /dev/null +++ b/sherman-aquarium/shermans/status.h @@ -0,0 +1,76 @@ + +/* + + The linux part is complete and the other OS's parts are more or less non-existing. + + If you use another OS like *BSD, OS X or some unix and are + interested to make this work on your machine look at status_.c and see what is + needed to be done, please mail me and we can try to make implement the missning parts. + + +*/ +#include +#include "defines.h" +#include "../config.h" + +#ifdef LINUX +#include "status_linux.h" +#endif + +#ifdef FREEBSD +#include "status_freebsd.h" +#endif + +#ifdef DARWIN +#include "status_darwin.h" +#endif + + +#define SENSORS_TEMP1 1 +#define SENSORS_TEMP2 2 +#define SENSORS_TEMP3 3 +#define SENSORS_TEMP4 4 +#define SENSORS_FAN1 5 +#define SENSORS_FAN2 6 +#define SENSORS_FAN3 7 + + +#define SENSORS_CURRENT 1 +#define SENSORS_LIMIT 2 +#define SENSORS_HYSTERESIS 3 + +#define NET_RECV 0 +#define NET_SENT 1 + +#define NET_LO 0 +#define NET_ETH0 1 +#define NET_ETH1 2 +#define NET_PPP0 3 + +#define NET_X NET_SENT+1 +#define NET_Y NET_PPP0+1 + +/* Init status */ +void status_init(void); + +/* Frees and such stuff done by init */ +void status_exit(void); + +/* Reports status of Fans, Thermometers and such stuff */ +int status_sensors(int); + +/* Swap disk usage in % */ +int status_swap(void); + +/* Disc space usage in % */ +int status_disc(char *); + +/* CPU load in % - Smoothed down */ +int status_cpu(void); + +/* Memory usage in % */ +int status_mem(void); + +/* Network devices usage. Returned is the bytes transfered betwen this and the + measurement before.*/ +int status_net(int, int); diff --git a/sherman-aquarium/shermans/status_darwin.c b/sherman-aquarium/shermans/status_darwin.c new file mode 100644 index 0000000..2e85af8 --- /dev/null +++ b/sherman-aquarium/shermans/status_darwin.c @@ -0,0 +1,115 @@ + +/* + Mac OS X (Darwin) code written by Ben Hines + +*/ + + + +#include "defines.h" +#include "aquarium.h" +#include "status.h" + +#include +#include + +/* Darwin */ + +void status_init(void) +{ +} + +void status_exit(void) +{ +} +int status_sensors(int x, int y) +{ + return 0; +} +int status_swap(void) +{ + return 0; +} +int status_net(int type, int direction) +{ + return 0; +} +int status_mem(void) +{ + return 0; +} +int status_disc(char *drive) +{ + return 0; +} + + +/* Have the old ones global */ +static u_int64_t oload = 0, ototal = 0; +static int firsttimes = 0, current = 0; +static int cpu_average_list[CPUSMOOTHNESS]; + +int status_cpu() +{ + processor_cpu_load_info_data_t *pinfo; + mach_msg_type_number_t info_count; + unsigned long composite_user, composite_nice, composite_sys, composite_idle; + unsigned int cpuload, n_cpus; + u_int64_t load, total; + int i; + if (firsttimes == 0) { + for (i = 0; i < CPUSMOOTHNESS; i++) + cpu_average_list[i] = 0; + } + /* Wait until we have CPUSMOOTHNESS messures */ + if (firsttimes != CPUSMOOTHNESS) + firsttimes++; + + if (host_processor_info (mach_host_self (), + PROCESSOR_CPU_LOAD_INFO, + &n_cpus, + (processor_info_array_t*)&pinfo, + &info_count)) { + return 0; + } + + composite_user = composite_nice = composite_sys = composite_idle = 0; + + for (i = 0; i < n_cpus; i++) { + composite_user += pinfo[i].cpu_ticks [CPU_STATE_USER]; + composite_sys += pinfo[i].cpu_ticks [CPU_STATE_SYSTEM]; + composite_idle += pinfo[i].cpu_ticks [CPU_STATE_IDLE]; + composite_nice += pinfo[i].cpu_ticks [CPU_STATE_NICE]; + } + vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count); + + /* user + sys = load + * total = total */ + load = composite_user + composite_sys; /* cpu.user + cpu.sys; */ + total = load + composite_idle + composite_nice; /* cpu.total; */ + + /* Calculates an average from the last CPUSMOOTHNESS messures */ + + if(total!=ototal) + cpu_average_list[current] = (100 * (load - oload)) / (total - ototal); + else + cpu_average_list[current] = (load - oload); + + current++; + if (current == CPUSMOOTHNESS) + current = 0; + + oload = load; + ototal = total; + + if (firsttimes != CPUSMOOTHNESS) + return 0; + + cpuload = 0; + + for (i = 0; i < CPUSMOOTHNESS; i++) + cpuload += cpu_average_list[i]; + return (cpuload / CPUSMOOTHNESS); + +} + diff --git a/sherman-aquarium/shermans/status_darwin.h b/sherman-aquarium/shermans/status_darwin.h new file mode 100644 index 0000000..6d52b56 --- /dev/null +++ b/sherman-aquarium/shermans/status_darwin.h @@ -0,0 +1,2 @@ + +#define STATUS_HAVE_CPU diff --git a/sherman-aquarium/shermans/status_freebsd.c b/sherman-aquarium/shermans/status_freebsd.c new file mode 100644 index 0000000..4346f47 --- /dev/null +++ b/sherman-aquarium/shermans/status_freebsd.c @@ -0,0 +1,162 @@ + +/* + +This piece of code is heavily based upon some code in timecop's +"BubbleMon dockapp 1.2" The FreeBSD code there is orignally by oleg dashevskii + and changed by Jonas Aaberg for doing the FreeBSD testing for me! + +*/ + +#include +#include +#include +#include +#include +#include + +#include "defines.h" +#include "aquarium.h" +#include "status.h" + + +#define pagetob(size) ((size) << pageshift) + +static kvm_t *kd = NULL; +static struct nlist nlst[] = { + {"_cp_time", 0}, + {"_cnt", 0}, + {"_bufspace", 0}, + {0, 0} +}; +static int pageshift; +static int previous_total=0, previous_load=0; + +static u_int64_t oload = 0, ototal = 0; +static int firsttimes = 0, current = 0; +static int cpu_average_list[CPUSMOOTHNESS]; + + +static int status_init_cpu_load_freebsd(void) +{ + /* calculate page shift to convert pages into kilobytes */ + int pagesize = getpagesize(); + pageshift = 0; + + while (pagesize > 1) { + pageshift++; + pagesize >>= 1; + } + + /* open kernel memory */ + kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open"); + + if (kd == NULL) { + puts("Could not open kernel virtual memory"); + return 1; + } + + kvm_nlist(kd, nlst); + + if (nlst[0].n_type == 0 || nlst[1].n_type == 0 || nlst[2].n_type == 0) { + puts("Error extracting symbols"); + return 2; + } + + /* drop setgid & setuid (the latter should not be there really) */ + seteuid(getuid()); + setegid(getgid()); + + if (geteuid() != getuid() || getegid() != getgid()) { + puts("Unable to drop privileges"); + return 3; + } + + return 0; +} + +void status_init(void) +{ + status_init_cpu_load_freebsd(); +} + +void status_exit(void) +{ + /* I guess it should actually CPU be closed, but I don't know how.*/ +} + +int status_cpu(void) +{ + +/* Returns the current CPU load in percent */ + + int loadPercentage; + int total, load; + unsigned long int cpu_time[CPUSTATES]; + int i, cpuload; + + + if (firsttimes == 0) { + for (i = 0; i < CPUSMOOTHNESS; i++) + cpu_average_list[i] = 0; + } + /* Wait until we have CPUSMOOTHNESS messures */ + if (firsttimes != CPUSMOOTHNESS) + firsttimes++; + + + if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time)) + != sizeof(cpu_time)) + return 0; + + load = cpu_time[CP_USER] + cpu_time[CP_SYS] + cpu_time[CP_NICE]; + total = load + cpu_time[CP_IDLE]; + + + if(total!=previous_total) + cpu_average_list[current] = (100 * (load - previous_load)) / (total - previous_total); + else + cpu_average_list[current] = (load - previous_load); + + current++; + if (current == CPUSMOOTHNESS) + current = 0; + + previous_load = load; + previous_total = total; + + if (firsttimes != CPUSMOOTHNESS) + return 0; + + cpuload = 0; + + for (i = 0; i < CPUSMOOTHNESS; i++) + cpuload += cpu_average_list[i]; + return (cpuload / CPUSMOOTHNESS); + +} + +} + +int status_sensors(int, int) +{ + return 0; +} +int status_swap(void) +{ + return 0; +} +int status_net(int type, int direction) +{ + return 0; +} +int status_mem(void) +{ + return 0; +} +int status_disc(char *drive) +{ + return 0; +} + diff --git a/sherman-aquarium/shermans/status_freebsd.h b/sherman-aquarium/shermans/status_freebsd.h new file mode 100644 index 0000000..6d52b56 --- /dev/null +++ b/sherman-aquarium/shermans/status_freebsd.h @@ -0,0 +1,2 @@ + +#define STATUS_HAVE_CPU diff --git a/sherman-aquarium/shermans/status_linux.h b/sherman-aquarium/shermans/status_linux.h new file mode 100644 index 0000000..2f1f3ee --- /dev/null +++ b/sherman-aquarium/shermans/status_linux.h @@ -0,0 +1,18 @@ + + +#define STATUS_HAVE_FAN1 +#define STATUS_HAVE_FAN2 +#define STATUS_HAVE_FAN3 +#define STATUS_HAVE_TEMP1 +#define STATUS_HAVE_TEMP2 +#define STATUS_HAVE_TEMP3 +#define STATUS_HAVE_TEMP4 +#define STATUS_HAVE_SWAP +#define STATUS_HAVE_DISC +#define STATUS_HAVE_CPU +#define STATUS_HAVE_MEM +#define STATUS_HAVE_NET_ETH0 +#define STATUS_HAVE_NET_ETH1 +#define STATUS_HAVE_NET_PPP0 +#define STATUS_HAVE_NET_LO + diff --git a/sherman-aquarium/shermans/status_linux24.c b/sherman-aquarium/shermans/status_linux24.c new file mode 100644 index 0000000..1ce7e24 --- /dev/null +++ b/sherman-aquarium/shermans/status_linux24.c @@ -0,0 +1,237 @@ +/* + + Routines for fetching useful system information + + Linux 2.4 only. + + Written by Jonas Aaberg September 2003. + + Released under GPL. + +*/ + + + +#include +#include +#include +#include +#include +#include + +#include "status.h" + +static char *status_sensors_dir; + +static char *status_sensors_get_dir(void) +{ + int foo; + char *chip_name; + FILE *chip_file; + + chip_file = fopen("/proc/sys/dev/sensors/chips","r"); + if(chip_file == NULL) + return NULL; + + chip_name = g_malloc0(1024); + fscanf(chip_file,"%d %s\n",&foo, chip_name); + fclose(chip_file); + return chip_name; +} + +int status_sensors(int sensor_type) +{ + int status1, status2; + float status1f, status2f, status3f; + FILE *status_file; + char chip_buff[1024]; + + if(sensor_type == SENSORS_TEMP1 || sensor_type == SENSORS_TEMP2) + sprintf(chip_buff,"/proc/sys/dev/sensors/%s/temp%d",status_sensors_dir, sensor_type); + if(sensor_type == SENSORS_FAN1 || sensor_type == SENSORS_FAN2) + sprintf(chip_buff,"/proc/sys/dev/sensors/%s/fan%d",status_sensors_dir, sensor_type-2); + + + status_file = fopen(chip_buff,"r"); + if(status_file == NULL) + return -1; + + if(sensor_type == SENSORS_TEMP1 || sensor_type == SENSORS_TEMP2){ + fscanf(status_file,"%f %f %f\n", &status1f, &status2f, &status3f); + fclose(status_file); + return (int)status3f; + } + + if(sensor_type == SENSORS_FAN1 || sensor_type == SENSORS_FAN2){ + fscanf(status_file,"%d %d\n", &status1, &status2); + fclose(status_file); + return status2; + } + + return -1; +} + +int status_swap(void) +{ + FILE *swap_file; + int size, used; + char dummy[256]; + swap_file = fopen("/proc/swaps", "r"); + if(swap_file == NULL) + return 0; + fgets(dummy,256,swap_file); + fscanf(swap_file,"%*s %*s %d %d", &size, &used); + fclose(swap_file); + return (int)((float)used/(float)size*100.0); +} + +int status_disc(char *disk) +{ + struct statfs stat_buf; + + if(statfs(disk, &stat_buf)!=0) + return 0; + return (100-(int)((float)stat_buf.f_bavail/(float)stat_buf.f_blocks*100.0)); +} + +/* returns current CPU load in percent, 0 to 100 */ + +int status_cpu(void) +{ + static int firsttimes = 0, current = 0; + static int cpu_average_list[CPUSMOOTHNESS]; + static u_int64_t oload = 0, ototal = 0; + + unsigned int cpuload; + u_int64_t load, total; + u_int64_t ab, ac, ad, ae; + FILE *stat; + int i; + + stat = fopen("/proc/stat", "r"); + fscanf(stat, "%*s %Ld %Ld %Ld %Ld", &ab, &ac, &ad, &ae); + fclose(stat); + + if (firsttimes == 0) { + for (i = 0; i < CPUSMOOTHNESS; i++) + cpu_average_list[i] = 0; + } + /* Wait until we have CPUSMOOTHNESS messures */ + if (firsttimes != CPUSMOOTHNESS) + firsttimes++; + + /* Find out the CPU load */ + /* user + sys = load + * total = total */ + load = ab + ac + ad; /* cpu.user + cpu.sys; */ + total = ab + ac + ad + ae; /* cpu.total; */ + + /* Calculates and average from the last CPUSMOOTHNESS messures */ + if(total!=ototal) + cpu_average_list[current] = (100 * (load - oload)) / (total - ototal); + else + cpu_average_list[current] = (load - oload); + + current++; + if (current == CPUSMOOTHNESS) + current = 0; + + oload = load; + ototal = total; + + + if (firsttimes != CPUSMOOTHNESS) + return 0; + + cpuload = 0; + + for (i = 0; i < CPUSMOOTHNESS; i++) + cpuload += cpu_average_list[i]; + + return (cpuload / CPUSMOOTHNESS); +} + +int status_mem(void) +{ + FILE *mem_file; + char dummy[256]; + unsigned int mem_total,mem_used,mem_free, mem_shared, mem_buffers, mem_cached; + + mem_file = fopen("/proc/meminfo","r"); + if(mem_file == NULL) + return 0; + fgets(dummy,256,mem_file); + fscanf(mem_file,"%*s %d %d %d %d %d %d\n", + &mem_total,&mem_used,&mem_free,&mem_shared,&mem_buffers,&mem_cached); + fclose(mem_file); + return (int)((float)(mem_used-mem_shared-mem_buffers-mem_cached)/(float)mem_total*100.0); + + +} + +int status_net(int type, int direction) +{ + FILE *net_file; + char dummy[256], dev[256]; + + char devices[][10] = {{"lo:"}, + {"eth0:"}, + {"eth1:"}, + {"ppp0:"}}; + + long int recv_bytes=0, sent_bytes=0, work_at=0; + int diff; + + static long int old_trans[NET_Y][NET_X]; + static int first_time = 1; + + if(first_time){ + memset(&old_trans,0,NET_Y*NET_X*sizeof(long int)); + first_time = 0; + } + + + net_file = fopen("/proc/net/dev","r"); + if(net_file == NULL) + return 0; + fgets(dummy,256,net_file); + fgets(dummy,256,net_file); + + while(!feof(net_file)){ + fscanf(net_file,"%s " + "%ld %*d %*d %*d " + "%*d %*d %*d %*d " + "%ld %*d %*d %*d " + "%*d %*d %*d %*d\n", + dev, + &recv_bytes, + &sent_bytes); + if(!strcmp(devices[type],dev)){ + if(direction == NET_RECV) + work_at = recv_bytes; + else + work_at = sent_bytes; + break; + } + } + fclose(net_file); + + diff = (int)(work_at - old_trans[type][direction]); + + if(old_trans[type][direction] == 0) + diff = 0; + + old_trans[type][direction] = work_at; + + return diff; +} + +void status_init(void) +{ + status_sensors_dir= status_sensors_get_dir(); +} + +void status_exit(void) +{ + g_free(status_sensors_dir); +} diff --git a/sherman-aquarium/shermans/status_linux26.c b/sherman-aquarium/shermans/status_linux26.c new file mode 100644 index 0000000..dd2d5a8 --- /dev/null +++ b/sherman-aquarium/shermans/status_linux26.c @@ -0,0 +1,242 @@ +/* + + Routines for fetching useful system information + + Linux 2.6 only. + + Written by Jonas Aaberg September 2003. + Updated for Linux 2.6 August 2004. + + Released under GPL. + +*/ + + + +#include +#include +#include +#include +#include +#include +#include + +#include "status.h" + +static char *status_sensors_dir = NULL; + + +static char *status_sensors_get_dir(void) +{ + char *chip_dir = NULL, tmp[1024]; + FILE *testfile; + glob_t globbuf; + int i; + + glob("/sys/bus/i2c/devices/*",GLOB_NOSORT, NULL, &globbuf); + + for(i=0;i + +*/ + + +/* + On their spare time, some reads a book, some goes shopping, + some do sports, some spends time with friends, and one + sits programming yet another tetris version and listens to + Sonata Arctica... + + Strange world, isn't it? + +*/ + + +#include "tetris.h" +#include "aquarium.h" +#include "over.h" +#include "settings.h" + +#include +#include +#include + +#define X 0 +#define Y 1 +#define PIECES 7 +#define FIGURES 10 +#define STATUS 4 +#define TOP10 0 +#define LINES 1 +#define SCORE 2 +#define LEVEL 3 + +static int pieces[PIECES][4][2] = { + { {0, 1}, {1, 1}, {2, 1}, {3, 1} }, + { {0, 1}, {1, 1}, {2, 1}, {2, 2} }, + { {0, 2}, {1, 2}, {2, 2}, {2, 1} }, + { {0, 2}, {1, 1}, {1, 2}, {2, 2} }, + { {0, 2}, {1, 2}, {1, 1}, {2, 1} }, + { {0, 1}, {1, 1}, {1, 2}, {2, 2} }, + { {1, 1}, {2, 1}, {1, 2}, {2, 2} } +}; + +static int board_x; +static int board_y; + +static Tetris_highscore_table highscores[11]; +static Tetris_settings tetris_settings; + +static int *board; + +static int curr_piece_num; +static int next_piece_num; + +static int location[2]; +static int curr_piece[4][2]; +static int gameover, firsttime; +static int show_highscore_upper; + +static SA_Image tetris_pieces, tetris_figures, tetris_figures2; +static SA_Image tetris_status, tetris_gameover; + +static int delay; +static int counter; +static int has_highscore, use_font2; + +static int death = 0; + +static unsigned char* tetris_background; + +static int score, level, lines; +static int horizontal; + +Tetris_highscore_table *tetris_get_highscore_table_ptr(void) +{ + return highscores; +} + +Tetris_settings *tetris_get_settings_ptr(void) +{ + return &tetris_settings; +} + +void prepare_tetris_background() +{ + int x,y,ypos, R,G,B; + AquariumData *ad; + + ad= aquarium_get_settings_ptr(); + + //printf("prepare tetris background\n"); + + tetris_background = g_malloc0(ad->ymax * ad->xmax * 4); + + if(horizontal){ + for(y = 0; y < ad->ymax; y++){ + ypos = y * ad->xmax * 4; + for(x = 0; x < ad->xmax; x++){ + if((y == 0 || y == ((board_y) * tetris_pieces.height + 1)) + && x <= (board_x * (tetris_pieces.width))){ + R = 0xab; + G = 0xba; + B = 0xc6; + } else if (x == (board_x * (tetris_pieces.width)) && + y >= 0 && y < (board_y) * tetris_pieces.height + 1){ + R = 0xab; + G = 0xba; + B = 0xc6; + } + else{ + R = G = B = 0; + } + + tetris_background[ypos + x * 4 + 0] = R; + tetris_background[ypos + x * 4 + 1] = G; + tetris_background[ypos + x * 4 + 2] = B; + tetris_background[ypos + x * 4 + 3] = 0xff; + } + + } + } + else { + for(y = 0; y < ad->ymax; y++){ + ypos = y * ad->xmax * 4; + for(x = 0; x < ad->xmax; x++){ + if((x == 2 || x == ((board_x + 1) * tetris_pieces.width - 1)) + && y <= (board_y * (tetris_pieces.height))){ + R = 0xab; + G = 0xba; + B = 0xc6; + } else if (y == (board_y * (tetris_pieces.height)) && + x >= 2 && x < (board_x + 1) * tetris_pieces.width){ + R = 0xab; + G = 0xba; + B = 0xc6; + + + } + else{ + R = G = B = 0; + } + + tetris_background[ypos + x * 4 + 0] = R; + tetris_background[ypos + x * 4 + 1] = G; + tetris_background[ypos + x * 4 + 2] = B; + tetris_background[ypos + x * 4 + 3] = 0xff; + } + + } + } + +} + +void tetris_exit(void) +{ + //printf("tetris exit\n"); + if(board != NULL) + g_free(board); + if(tetris_background != NULL) + g_free(tetris_background); + + board = NULL; + tetris_background = NULL; +} + +void tetris_restart(void) +{ + int i,x,y,tbx; + AquariumData *ad; + + if(board != NULL) + tetris_exit(); + + // printf("tetris restart\n"); + + ad = aquarium_get_settings_ptr(); + + //printf("xmax %d ymax %d\n", ad->xmax, ad->ymax); + + board_x = (ad->xmax - 24) / tetris_pieces.width; + board_y = (ad->ymax - 2) / tetris_pieces.height; + + if(tetris_settings.size_limit){ + if(board_x > tetris_settings.width) + board_x = tetris_settings.width; + + if(board_y > tetris_settings.height) + board_y = tetris_settings.height; + + } + + + + //printf("Board_x %d, board_y %d\n", board_x, board_y); + + if(2 * ad->xmax / 3 > ad->ymax){ + horizontal = 1; + x = Y; + y = X; + tbx = board_y; + } + else { + horizontal = 0; + x = X; + y = Y; + tbx = board_x; + } + + + //printf("Board_x %d, board_y %d\n", board_x, board_y); + board = NULL; + + if(gai_load_int_with_default("tetris/board_x", -1) == board_x && + gai_load_int_with_default("tetris/board_y", -1) == board_y && firsttime){ + board = (int *)gai_load_raw_data("tetris/board", NULL); + } + + if(board == NULL && death){ + //printf("first time or die\n"); + board = g_malloc0(board_x * board_y * sizeof(int)); + gameover = 0; + score = 0; + lines = 0; + level = 1; + death = 0; + location[x] = (tbx - 4) / 2 + horizontal; + location[y] = -4; + next_piece_num = g_rand_int_range(ad->rnd, 0, PIECES); + curr_piece_num = g_rand_int_range(ad->rnd, 0, PIECES); + delay = 16; + for(i = 0; i < 4; i++){ + curr_piece[i][x] = pieces[curr_piece_num][i][X]; + curr_piece[i][y] = pieces[curr_piece_num][i][Y]; + } + + + } else { + //printf("load game over\n"); + if(board == NULL) + board = g_malloc0(board_x * board_y * sizeof(int)); + gameover = gai_load_int_with_default("tetris/gameover", 0); + score = gai_load_int_with_default("tetris/score", 0); + lines = gai_load_int_with_default("tetris/lines", 0); + level = gai_load_int_with_default("tetris/level", 1); + location[x] = gai_load_int_with_default("tetris/location_x", (tbx - 4) / 2 + horizontal); + location[y] = gai_load_int_with_default("tetris/location_y", -4); + next_piece_num = gai_load_int_with_default("tetris/next_piece_num", g_rand_int_range(ad->rnd, 0, PIECES)); + curr_piece_num = gai_load_int_with_default("tetris/curr_piece_num", g_rand_int_range(ad->rnd, 0, PIECES)); + delay = gai_load_int_with_default("tetris/delay", 16); + curr_piece[0][x] = gai_load_int_with_default("tetris/curr_piece0X", 0); + curr_piece[0][y] = gai_load_int_with_default("tetris/curr_piece0Y", 0); + curr_piece[1][x] = gai_load_int_with_default("tetris/curr_piece1X", 0); + curr_piece[1][y] = gai_load_int_with_default("tetris/curr_piece1Y", 0); + curr_piece[2][x] = gai_load_int_with_default("tetris/curr_piece2X", 0); + curr_piece[2][y] = gai_load_int_with_default("tetris/curr_piece2Y", 0); + curr_piece[3][x] = gai_load_int_with_default("tetris/curr_piece3X", 0); + curr_piece[3][y] = gai_load_int_with_default("tetris/curr_piece3Y", 0); + + } + firsttime = 0; + + prepare_tetris_background(); + + use_font2 = 0; + + counter = delay; + show_highscore_upper = 0; + + has_highscore = 1979; + +} + +void tetris_init(void) +{ + death = 0; + firsttime = 1; + //printf("tetris init\n"); + tetris_load_highscores(); + + load_image("tetris_pieces.png", + &tetris_pieces, + PIECES); + + load_image("tetris_figures.png", + &tetris_figures, + FIGURES); + + load_image("tetris_figures2.png", + &tetris_figures2, + FIGURES); + + + load_image("tetris_status.png", + &tetris_status, + STATUS); + + + load_image("tetris_gameover.png", + &tetris_gameover, + 1); + + tetris_restart(); + +} + +void check_highscore(void) +{ + int i, j; + + for(i = 0; i < 10; i++){ + if(highscores[i].score i; j--){ + highscores[i].score = highscores[j - 1].score; + highscores[i].level = highscores[j - 1].level; + highscores[i].lines = highscores[j - 1].lines; + } + has_highscore = i; + highscores[i].score = score; + highscores[i].level = level; + highscores[i].lines = lines; + break; + } + + } + tetris_save_highscores(); + +} + +void drawnextpiece(void) +{ + int i, x, y; + AquariumData *ad; + + if(!tetris_settings.show_next) + return; + ad = aquarium_get_settings_ptr(); + + x = ad->xmax - (tetris_pieces.width * 4 + 1); + y = 4; + + + for(i = 0; i < 4; i++){ + over_draw(x + tetris_pieces.width * pieces[next_piece_num][i][X], + y + tetris_pieces.height * pieces[next_piece_num][i][Y], + next_piece_num, + tetris_pieces.width, + tetris_pieces.height, + tetris_pieces.image); + } +} + +void drawfigures(int x,int y, int num) +{ + SA_Image *figures; + + if(use_font2) + figures = &tetris_figures2; + else + figures = &tetris_figures; + + + if(num > 99) + over_draw(x, y, + num / 100, + figures->width, + figures->height, + figures->image); + + if(num > 9) + over_draw(x + figures->width, y, + (num % 100) / 10, + figures->width, + figures->height, + figures->image); + + over_draw(x + figures->width * 2,y, + (num % 10), + figures->width, + figures->height, + figures->image); + +} + +void drawstatus(void) +{ + int x, y, dy; + + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + x = ad->xmax-tetris_figures.width * 3 - 2; + y = 20; + dy = tetris_figures.height + 3; + + drawfigures(x, y, score); + drawfigures(x, y + dy, level); + drawfigures(x, y + 2 * dy, lines); + +} + +void draw_gameover(void) +{ + AquariumData *ad; + ad = aquarium_get_settings_ptr(); + + drawstatus(); + + over_draw((ad->xmax-tetris_gameover.width) / 2, + (ad->ymax-tetris_gameover.height) / 2, + 0, + tetris_gameover.width, + tetris_gameover.height, + tetris_gameover.image); +} + +void draw_finalscore(void) +{ + int x, y, dy, ypos; + + AquariumData *ad; + + //printf("draw_finalscore\n"); + + ad = aquarium_get_settings_ptr(); + + for(y = 0; y < ad->ymax; y++){ + ypos = y * ad->xmax * 4; + for(x = 0; x xmax; x++){ + tetris_background[ypos+x * 4 + 0] = 0; + tetris_background[ypos+x * 4 + 1] = 0; + tetris_background[ypos+x * 4 + 2] = 0; + tetris_background[ypos+x * 4 + 3] = 0xff; + } + } + over_draw(0, 0, 0, ad->xmax,ad->ymax,tetris_background); + + x = (ad->xmax-tetris_status.width) / 2; + y = (ad->ymax-3 * (tetris_figures.height + tetris_status.height)) / 2; + dy = tetris_figures.height + tetris_status.height; + over_draw(x, y , SCORE, tetris_status.width, tetris_status.height, + tetris_status.image); + + over_draw(x, y + dy, LEVEL, tetris_status.width, tetris_status.height, + tetris_status.image); + + over_draw(x, y + 2 * dy, LINES, tetris_status.width, tetris_status.height, + tetris_status.image); + + drawfigures(x + tetris_status.width, y + tetris_status.height, score); + drawfigures(x + tetris_status.width, y + tetris_status.height + dy, level); + drawfigures(x + tetris_status.width, y + tetris_status.height + 2 * dy, lines); + counter = 0; +} + + +void draw_highscorelist(void) +{ + int x, y, ypos, i, dx, sx; + + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + //printf("darw_highscore\n"); + + for(y = 0; y < ad->ymax; y++){ + ypos = y * ad->xmax * 4; + for(x = 0; x < ad->xmax; x++){ + tetris_background[ypos + x * 4 + 0] = 0; + tetris_background[ypos + x * 4 + 1] = 0; + tetris_background[ypos + x * 4 + 2] = 0; + tetris_background[ypos + x * 4 + 3] = 0xff; + } + } + over_draw(0, 0, 0, ad->xmax, ad->ymax,tetris_background); + + over_draw((ad->xmax - tetris_status.width) / 2, 1, TOP10, tetris_status.width, + tetris_status.height, tetris_status.image); + + sx = -tetris_figures.width; + + dx = ((ad->xmax-sx) - 4 * 3 * tetris_figures.width) / 4 + 3 * tetris_figures.width; + + if(ad->ymax > (tetris_status.height + 10 * tetris_figures.height)){ + for(i = 0; i < 10; i++){ + if(i == has_highscore) + use_font2 = TRUE; + else + use_font2 = FALSE; + drawfigures(sx, + 8 + tetris_status.height + i * tetris_figures.height, + i + 1); + + drawfigures(sx + dx, + 8 + tetris_status.height + i * tetris_figures.height, + highscores[i].score); + + drawfigures(sx + 2 * dx, + 8 + tetris_status.height + i * tetris_figures.height, + highscores[i].lines); + + drawfigures(sx + 3 * dx, + 8 + tetris_status.height + i * tetris_figures.height, + highscores[i].level); + } + + + } else { + for(i = 5 * show_highscore_upper; i < (5 + 5 * show_highscore_upper); i++){ + if(i == has_highscore) + use_font2 = TRUE; + else + use_font2 = FALSE; + + drawfigures(sx, + 8 + tetris_status.height + (i - 5 * show_highscore_upper) * tetris_figures.height, i + 1); + + drawfigures(sx + dx, + 8 + tetris_status.height + (i - 5 * show_highscore_upper) * tetris_figures.height, highscores[i].score); + drawfigures(sx + 2 * dx, + 8 + tetris_status.height + (i - 5 * show_highscore_upper) * tetris_figures.height, highscores[i].lines); + drawfigures(sx + 3 * dx, + 8 + tetris_status.height + (i - 5 * show_highscore_upper) * tetris_figures.height, highscores[i].level); + } + counter++; + if(counter == 100){ + show_highscore_upper = !show_highscore_upper; + counter = 0; + } + } + + + +} + +void drawboardonscreen(void) +{ + int x, y; + + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + // printf("drawongscreen %d\n", gameover); + + switch(gameover){ + + /* Normal play */ + case 0: + + over_draw(0 ,0 ,0, ad->xmax, ad->ymax, tetris_background); + //printf("%d %d\n", board_x, board_y); + for(y = 0; y < board_y; y++){ + for(x = 0;x < board_x; x++){ + + if(board[y * board_x + x] != 0) + over_draw(x * tetris_pieces.width + 3 * !horizontal, + y * tetris_pieces.height + horizontal, + board[y * board_x + x] - 1, + tetris_pieces.width, + tetris_pieces.height, + tetris_pieces.image); + } + } + //printf("for done\n"); + drawnextpiece(); + drawstatus(); + break; + + case 1: + draw_gameover(); + break; + case 2: + draw_finalscore(); + break; + + case 3: + draw_highscorelist(); + + break; + default: + break; + } + +} + +void manageboard(int piece[4][2], int location[2], int colour) +{ + int i; + + // printf("manageboard\n"); + + for(i = 0; i < 4; i++){ + if(location[X] + piece[i][X] >= 0 && location[Y] + piece[i][Y] >=0) + board[(location[X] + piece[i][X]) + (location[Y] + piece[i][Y]) * board_x] + = colour; + } + // printf("manage board done\n"); +} + +void removefromboard(int piece[4][2],int location[2]) +{ + manageboard(piece, location, 0); +} + + +void drawonboard(int piece[4][2],int location[2]) +{ + manageboard(piece, location, curr_piece_num + 1); +} + + +/* + Returns: + 0 = Movement ok. + 1 = Landed upon piece. + 2 = Tried to move outside X wise. + 3 = Landed upon piece and tried to move too far X wise. + 4 = Landed on bottom. + 5 = Landed on bottom & piece. + 6 = landed on bottom & X outside. + 7 = landed on bottom & X outside & piece. +*/ + +int movepiece(int piece[4][2],int new_location[2]) +{ + int i; + int stuck = 0; + + int x, y, tbx, tby; + + + // printf("movepiece\n"); + + if(horizontal){ + x = Y; + y = X; + tbx = board_y; + tby = board_x; + + } else{ + x = X; + y = Y; + tbx = board_x; + tby = board_y; + } + + + + for(i = 0;i < 4; i++){ + /* Edges */ + if(new_location[x] + piece[i][x] >= tbx || new_location[x] + piece[i][x]<0){ + stuck |= 2; + continue; + } + /* Bottom */ + if(new_location[y] + piece[i][y] == tby){ + stuck |= 4; + continue; + } + /* Upon other pieces */ + if(new_location[y] + piece[i][y] >= 0) + if(board[(new_location[X] + piece[i][X]) + (new_location[Y] + piece[i][Y]) * board_x]!=0) + stuck |= 1; + } + return stuck; + +} + +void rotatepiece(int piece[4][2], int location[2]) +{ + int tmp_piece[4][2], i; + + // printf("rotate piece\n"); + + for(i= 0 ; i < 4; i++){ + tmp_piece[i][X] = 3 - piece[i][Y]; + tmp_piece[i][Y] = piece[i][X]; + } + + if(movepiece(tmp_piece, location) == 0){ + for(i = 0; i < 4; i++){ + piece[i][X] = tmp_piece[i][X]; + piece[i][Y] = tmp_piece[i][Y]; + } + } + +} + +void removeline(int line) +{ + int x, y; + // printf("removeline\n"); + + if(horizontal){ + for(x = line; x > 0; x--){ + for(y = 0; y < board_y; y++){ + board[x + y * board_x] = board[(x - 1) + y * board_x]; + } + } + for(y = 0; y < board_y; y++) + board[y * board_x] = 0; + } + else { + for(y = line; y > 0; y--){ + for(x = 0; x < board_x; x++){ + board[x + y * board_x] = board[x + (y - 1) * board_x]; + } + } + for(x = 0; x < board_x; x++) + board[x] = 0; + } + + +} + +void checkforline(void) +{ + + int gotline = 0, tot_lines = 0; + int x, y; + int points[] = {0, 1 , 3 , 5, 9}; + + // printf("checkforline\n"); + + if(horizontal){ + for(x = 0; x < board_x; x++){ + gotline = 1; + for(y = 0; y < board_y; y++){ + if(board[x + y * board_x] == 0) + gotline=0; + } + if(gotline){ + tot_lines++; + removeline(x); + /* Restart */ + x = 0; + } + } + } + else { + for(y = 0; y < board_y; y++){ + gotline = 1; + for(x = 0; x < board_x; x++){ + if(board[x + y * board_x] == 0) gotline = 0; + } + if(gotline){ + tot_lines++; + removeline(y); + /* Restart */ + y = 0; + } + } + } + + if(tot_lines>0){ + lines += tot_lines; + + score += points[tot_lines]; + + if(((lines - tot_lines) / 10) < lines / 10){ + level++; + if(delay > 0) delay--; + } + /* printf("Score %d Lines %d Level %d\n",score,lines,level);*/ + } + +} + +void tetris_update(void) +{ + int answer; + int i, x, y, tbx; + AquariumData *ad; + + ad = aquarium_get_settings_ptr(); + + + if(gameover != 0 || delay != counter){ + drawboardonscreen(); + counter++; + return; + } + + counter = 0; + + removefromboard(curr_piece, location); + + if(horizontal){ + x = Y; + y = X; + tbx = board_y; + } + else { + x = X; + y = Y; + tbx = board_x; + } + + location[y]++; + + answer = movepiece(curr_piece, location); + + if(answer == 0){ + drawonboard(curr_piece, location); + } + if((answer & 4) == 4 || (answer & 1) == 1){ + + location[y]--; + + drawonboard(curr_piece, location); + + checkforline(); + + for(i = 0; i < 4; i++){ + if((curr_piece[i][y] + location[y]) < 0) + gameover = 1; + } + + if(gameover == 0){ + location[y] = -4; + location[x] = (tbx - 4) / 2 + horizontal; + + for(i = 0; i < 4; i++){ + curr_piece[i][x] = pieces[next_piece_num][i][X]; + curr_piece[i][y] = pieces[next_piece_num][i][Y]; + } + curr_piece_num = next_piece_num; + next_piece_num = g_rand_int_range(ad->rnd, 0, PIECES); + + answer = movepiece(curr_piece, location); + if(answer != 0) gameover = 1; + } + else{ + check_highscore(); + } + + } + + drawboardonscreen(); + + +} + + +void tetris_keypress(int key) +{ + int x, y; + + removefromboard(curr_piece, location); + + if(gameover == 4){ + death = 1; + tetris_restart(); + return; + } + + if(horizontal){ + x = Y; + y = X; + } + else { + x = X; + y = Y; + } + + switch(key){ + case GDK_Up: + rotatepiece(curr_piece, location); + break; + case GDK_Left: + location[x]--; + if(movepiece(curr_piece, location)!=0) + location[x]++; + + break; + case GDK_Right: + location[x]++; + if(movepiece(curr_piece, location)!=0) + location[x]--; + break; + case GDK_Down: + if(gameover != 0) { + gameover++; + } + location[y]++; + if(movepiece(curr_piece, location)!=0) + location[y]--; + + break; + default: + break; + } + + drawonboard(curr_piece, location); + +} + +void tetris_joystick(GaiFlagsJoystick js) +{ + int key = 0; + if(js & GAI_JOYSTICK_LEFT) + key |= GDK_Left; + if(js & GAI_JOYSTICK_RIGHT) + key |= GDK_Right; + if(js & GAI_JOYSTICK_UP) + key |= GDK_Up; + if(js & GAI_JOYSTICK_BUTTON_A) + key |= GDK_Up; + if(js & GAI_JOYSTICK_BUTTON_B) + key |= GDK_Down; + if(js & GAI_JOYSTICK_DOWN) + key |= GDK_Down; + tetris_keypress(key); + +} + +void tetris_start(void) +{ + //printf("tetris start\n"); +} + +void tetris_end(void) +{ + int x, y, tbx; + AquariumData *ad; + //printf("tetris end\n"); + + ad = aquarium_get_settings_ptr(); + + if(2 * ad->xmax / 3 > ad->ymax){ + horizontal = 1; + x = Y; + y = X; + tbx = board_y; + } + else { + horizontal = 0; + x = X; + y = Y; + tbx = board_x; + } + + //printf("Board_x %d, board_y %d\n", board_x, board_y); + + gai_save_int("tetris/board_x", board_x); + gai_save_int("tetris/board_y", board_y); + gai_save_int("tetris/gameover", gameover); + gai_save_int("tetris/score", score); + gai_save_int("tetris/lines", lines); + gai_save_int("tetris/level", level); + gai_save_int("tetris/location_x", location[x]); + gai_save_int("tetris/location_y", location[y]); + gai_save_int("tetris/next_piece_num", next_piece_num); + gai_save_int("tetris/curr_piece_num", curr_piece_num); + gai_save_int("tetris/delay", delay); + gai_save_raw_data("tetris/board", (unsigned char *)board, board_y * board_x * sizeof(int)); + + gai_save_int("tetris/curr_piece0X", curr_piece[0][x]); + gai_save_int("tetris/curr_piece0Y", curr_piece[0][y]); + gai_save_int("tetris/curr_piece1X", curr_piece[1][x]); + gai_save_int("tetris/curr_piece1Y", curr_piece[1][y]); + gai_save_int("tetris/curr_piece2X", curr_piece[2][x]); + gai_save_int("tetris/curr_piece2Y", curr_piece[2][y]); + gai_save_int("tetris/curr_piece3X", curr_piece[3][x]); + gai_save_int("tetris/curr_piece3Y", curr_piece[3][y]); + +} diff --git a/sherman-aquarium/shermans/tetris.h b/sherman-aquarium/shermans/tetris.h new file mode 100644 index 0000000..8a35298 --- /dev/null +++ b/sherman-aquarium/shermans/tetris.h @@ -0,0 +1,33 @@ +#ifndef TETRIS_H +#define TETRIS_H + +#include + +#include "aquarium.h" +typedef struct +{ + int score; + int level; + int lines; + gboolean size_limit; + int height, width; +} Tetris_highscore_table; + +typedef struct +{ + gboolean size_limit; + gboolean show_next; + int height, width; +} Tetris_settings; + +Tetris_highscore_table *tetris_get_highscore_table_ptr(void); +Tetris_settings *tetris_get_settings_ptr(void); +void tetris_init(void); +void tetris_exit(void); +void tetris_start(void); +void tetris_end(void); +void tetris_update(void); +void tetris_keypress(int); +void tetris_joystick(GaiFlagsJoystick); + +#endif diff --git a/sherman-aquarium/shermans/thermometer.c b/sherman-aquarium/shermans/thermometer.c new file mode 100644 index 0000000..3e9f053 --- /dev/null +++ b/sherman-aquarium/shermans/thermometer.c @@ -0,0 +1,421 @@ + +#include "status.h" +#include "aquarium.h" +#include "draw.h" +#include "thermometer.h" + + + +static Thermometer_settings thermometer_settings; +static SA_Image thermometer_1, thermometer_2; +static AquariumData *ad; +static int status_list[STATUSES]; + +Thermometer_settings *thermometer_get_settings_ptr(void) +{ + return &thermometer_settings; +} + +int thermometer_get_real_status(int status) +{ + int i,j=0; + for(i=0;ipixbuf); + for(y=0;yheight;y++){ + ypos = y*image->rowstride; + + for(x=0;xwidth*(3+alpha);x+=(3+alpha)){ + if(image->image[ypos+x+0] == 0xff){ + image->image[ypos+x+0] = r; + image->image[ypos+x+1] = g; + image->image[ypos+x+2] = b; + } + + if(image->image[ypos+x+0] == 0xbf){ + + if(r>0x20) + image->image[ypos+x+0] = r-0x20; + else + image->image[ypos+x+0] = 0x00; + + if(g>0x20) + image->image[ypos+x+1] = g-0x20; + else + image->image[ypos+x+1] = 0x00; + + if(b>0x20) + image->image[ypos+x+2] = b-0x20; + else + image->image[ypos+x+2] = 0x00; + } + + } + } + + +} + +void thermometer_init(void) +{ + ad = aquarium_get_settings_ptr(); + + thermometer_gen_list(); + + if(thermometer_1.image!=NULL || thermometer_2.image!=NULL) + thermometer_exit(); + + + if(thermometer_settings.messure1 != thermometer_get_real_status(STATUS_OFF)){ + load_image("thermometer.png", &thermometer_1,1); + thermometer_change_colour(&thermometer_1, + thermometer_settings.c1.r,thermometer_settings.c1.g,thermometer_settings.c1.b); + + } + if(thermometer_settings.messure2 != thermometer_get_real_status(STATUS_OFF)){ + load_image("thermometer.png", &thermometer_2,1); + thermometer_change_colour(&thermometer_2, + thermometer_settings.c2.r,thermometer_settings.c2.g,thermometer_settings.c2.b); + + + } +} + +int thermometer_status_level(int messure, int roof, char *mount_p) +{ + //(30 * status_level / 100) + int status_type, level, real_roof; + status_type = thermometer_get_real_status(messure); + + switch(status_type){ + + case STATUS_OFF: + level = 0; + real_roof = 100; + break; + case STATUS_FAN1: + level = status_sensors(SENSORS_FAN1); + real_roof = roof; + break; + case STATUS_FAN2: + level = status_sensors(SENSORS_FAN2); + real_roof = roof; + break; + case STATUS_TEMP1: + level = status_sensors(SENSORS_TEMP1); + real_roof = roof; + break; + case STATUS_TEMP2: + level = status_sensors(SENSORS_TEMP2); + real_roof = roof; + break; + case STATUS_SWAP: + level = status_swap(); + real_roof = 100; + break; + case STATUS_DISC: + level = status_disc(mount_p); + real_roof = 100; + break; + case STATUS_CPU: + level = status_cpu(); + real_roof = 100; + break; + case STATUS_MEM: + level = status_mem(); + real_roof = 100; + break; + + case STATUS_NET_ETH0_RECV: + level = status_net(NET_ETH0, NET_RECV); + real_roof = roof; + break; + case STATUS_NET_ETH0_SEND: + level = status_net(NET_ETH0, NET_SENT); + real_roof = roof; + break; + case STATUS_NET_ETH0_BOTH: + level = (status_net(NET_ETH0, NET_RECV) + status_net(NET_ETH0, NET_SENT))/2; + real_roof = roof; + break; + case STATUS_NET_ETH1_RECV: + level = status_net(NET_ETH1, NET_RECV); + real_roof = roof; + break; + case STATUS_NET_ETH1_SEND: + level = status_net(NET_ETH1, NET_SENT); + real_roof = roof; + break; + case STATUS_NET_ETH1_BOTH: + level = (status_net(NET_ETH1, NET_RECV) + status_net(NET_ETH1, NET_SENT))/2; + real_roof = roof; + break; + case STATUS_NET_PPP0_RECV: + level = status_net(NET_PPP0, NET_RECV); + real_roof = roof; + break; + case STATUS_NET_PPP0_SEND: + level = status_net(NET_PPP0, NET_SENT); + real_roof = roof; + break; + case STATUS_NET_PPP0_BOTH: + level = (status_net(NET_PPP0, NET_RECV) + status_net(NET_PPP0, NET_SENT))/2; + real_roof = roof; + break; + case STATUS_NET_LO_RECV: + level = status_net(NET_LO, NET_RECV); + real_roof = roof; + break; + case STATUS_NET_LO_SEND: + level = status_net(NET_LO, NET_SENT); + real_roof = roof; + break; + case STATUS_NET_LO_BOTH: + level = (status_net(NET_LO, NET_RECV) + status_net(NET_LO, NET_SENT))/2; + real_roof = roof; + break; + + + default: + level = 30; + real_roof = 100; + } + + if(level > real_roof) + return 0; + + if(level <0 || real_roof <=0) + return 30; + else + return (int)(30.0 - 30.0*(float)level / (float)real_roof); + +} + +void thermometer_core(SA_Image *thermometer, int mode,int draw, int vert, int horz, int split, + unsigned char r, unsigned char g, unsigned char b, unsigned char alpha, + unsigned char r_s, unsigned char g_s, unsigned char b_s, unsigned char alpha_s, + int messure, int messure_s, int roof, int roof_s, char *mount_point, char *mount_point_s) +{ + + int x=0, y=0, colour, status_type; + static int status_level[2] = {0, 0}, count = 0; + + + if(mode != draw) + return; + + status_type = thermometer_get_real_status(messure); + if(status_type == STATUS_OFF) + return; + + if(vert == TOP) + y = 0; + if(vert == CENTER) + y = ad->ymax/2 - thermometer->height/2; + if(vert == BOTTOM) + y = ad->ymax - thermometer->height; + + if(horz == LEFT) + x = 0; + if(horz == CENTER) + x = ad->xmax/2 - thermometer->width/2; + if(horz == RIGHT) + x = ad->xmax - thermometer->width - 1; + + draw_pic_alpha(thermometer->image, thermometer->width, + thermometer->height, x, y, 0, 0x80); + + colour = (((int)r) <<16) + (((int)g) <<8) + (int)b; + + + /* Status level is between 0 and 30, 0 is max */ + if(count == 0) + status_level[0] = thermometer_status_level(messure, roof, mount_point); + + anti_line(x+3, y + 2 + status_level[0], x+3, + y+thermometer->height-3, + 1, colour, 0); + + anti_line(x+2, y+thermometer->height-4, x+2, + y + thermometer->height-5, 1, colour, 0); + + + if(split){ + colour = (((int)r_s) <<16) + (((int)g_s) <<8) + (int)b_s; + + if(count == 0) + status_level[1] = thermometer_status_level(messure_s, roof_s, mount_point_s); + + anti_line(x+4, y+thermometer->height-3, x+4, + y + 2 + status_level[1], 1, colour, 0); + + } else { + anti_line(x+4, y+thermometer->height-3, x+4, + y + 2 + status_level[0], 1, colour, 0); + } + + anti_line(x+5, y+thermometer->height-4, x+5, + y + thermometer->height-5, 1, colour, 0); + + /* Update about once a second */ + if(count == 0) + count = 20; + else + count --; + +} + +void thermometer_update(int mode) +{ + + thermometer_core(&thermometer_1, mode, thermometer_settings.draw1, + thermometer_settings.vert1,thermometer_settings.horz1, + thermometer_settings.split1, + thermometer_settings.c1.r, thermometer_settings.c1.g,thermometer_settings.c1.b, + thermometer_settings.c1.alpha, + thermometer_settings.c1_s.r,thermometer_settings.c1_s.g,thermometer_settings.c1_s.b, + thermometer_settings.c1_s.alpha, + thermometer_settings.messure1, thermometer_settings.messure1_s, + thermometer_settings.roof1, thermometer_settings.roof1_s, + thermometer_settings.mount_point1, + thermometer_settings.mount_point1_s); + + + thermometer_core(&thermometer_2, mode, thermometer_settings.draw2, + thermometer_settings.vert2,thermometer_settings.horz2, + thermometer_settings.split2, + thermometer_settings.c2.r, thermometer_settings.c2.g,thermometer_settings.c2.b, + thermometer_settings.c2.alpha, + thermometer_settings.c2_s.r,thermometer_settings.c2_s.g,thermometer_settings.c2_s.b, + thermometer_settings.c2_s.alpha, + thermometer_settings.messure2, thermometer_settings.messure2_s, + thermometer_settings.roof2, thermometer_settings.roof2_s, + thermometer_settings.mount_point2, + thermometer_settings.mount_point2_s); + +} + + + + diff --git a/sherman-aquarium/shermans/thermometer.h b/sherman-aquarium/shermans/thermometer.h new file mode 100644 index 0000000..9e51984 --- /dev/null +++ b/sherman-aquarium/shermans/thermometer.h @@ -0,0 +1,51 @@ +#ifndef THERMOMETER_H +#define THERMOMETER_H + +#define STATUS_OFF 0 +#define STATUS_FAN1 1 +#define STATUS_FAN2 2 +#define STATUS_TEMP1 3 +#define STATUS_TEMP2 4 +#define STATUS_SWAP 5 +#define STATUS_DISC 6 +#define STATUS_CPU 7 +#define STATUS_MEM 8 +#define STATUS_NET_ETH0_RECV 9 +#define STATUS_NET_ETH0_SEND 10 +#define STATUS_NET_ETH0_BOTH 11 +#define STATUS_NET_ETH1_RECV 12 +#define STATUS_NET_ETH1_SEND 13 +#define STATUS_NET_ETH1_BOTH 14 +#define STATUS_NET_PPP0_RECV 15 +#define STATUS_NET_PPP0_SEND 16 +#define STATUS_NET_PPP0_BOTH 17 +#define STATUS_NET_LO_RECV 18 +#define STATUS_NET_LO_SEND 19 +#define STATUS_NET_LO_BOTH 20 + +#define STATUSES 21 + +typedef struct +{ + int draw1, draw2; + int vert1, horz1; + int vert2, horz2; + int split1, split2; + GaiColor c1, c2; + GaiColor c1_s, c2_s; + int messure1, messure2; + int messure1_s, messure2_s; + int roof1, roof2; + int roof1_s, roof2_s; + char *mount_point1, *mount_point2; + char *mount_point1_s, *mount_point2_s; + + +} Thermometer_settings; + +void thermometer_init(void); +void thermometer_update(int); +void thermometer_exit(void); +Thermometer_settings *thermometer_get_settings_ptr(void); + +#endif diff --git a/sherman-aquarium/shermans/vroot.h b/sherman-aquarium/shermans/vroot.h new file mode 100644 index 0000000..ba3e5d2 --- /dev/null +++ b/sherman-aquarium/shermans/vroot.h @@ -0,0 +1,126 @@ +/*****************************************************************************/ +/** Copyright 1991 by Andreas Stolcke **/ +/** Copyright 1990 by Solbourne Computer Inc. **/ +/** Longmont, Colorado **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** name of Solbourne not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/ +/** WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF **/ +/** MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE **/ +/** OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL **/ +/** DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ +/* + * vroot.h -- Virtual Root Window handling header file + * + * This header file redefines the X11 macros RootWindow and DefaultRootWindow, + * making them look for a virtual root window as provided by certain `virtual' + * window managers like swm and tvtwm. If none is found, the ordinary root + * window is returned, thus retaining backward compatibility with standard + * window managers. + * The function implementing the virtual root lookup remembers the result of + * its last invocation to avoid overhead in the case of repeated calls + * on the same display and screen arguments. + * The lookup code itself is taken from Tom LaStrange's ssetroot program. + * + * Most simple root window changing X programs can be converted to using + * virtual roots by just including + * + * #include + * + * after all the X11 header files. It has been tested on such popular + * X clients as xphoon, xfroot, xloadimage, and xaqua. + * It also works with the core clients xprop, xwininfo, xwd, and editres + * (and is necessary to get those clients working under tvtwm). + * It does NOT work with xsetroot; get the xsetroot replacement included in + * the tvtwm distribution instead. + * + * Andreas Stolcke , 9/7/90 + * - replaced all NULL's with properly cast 0's, 5/6/91 + * - free children list (suggested by Mark Martin ), 5/16/91 + * - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91 + */ + +#ifndef _VROOT_H_ +#define _VROOT_H_ + +#if !defined(lint) && !defined(SABER) +static const char vroot_rcsid[] = "#Id: vroot.h,v 1.4 1991/09/30 19:23:16 stolcke Exp stolcke #"; +#endif + +#include +#include +#include + +static Window +#ifdef __STDC__ /* ANSIfication added by jwz, to avoid superfluous warnings. */ +VirtualRootWindowOfScreen(Screen *screen) +#else /* !__STDC__ */ +VirtualRootWindowOfScreen(screen) Screen *screen; +#endif /* !__STDC__ */ +{ + static Screen *save_screen = (Screen *)0; + static Window root = (Window)0; + + if (screen != save_screen) { + Display *dpy = DisplayOfScreen(screen); + Atom __SWM_VROOT = None; + int i; + Window rootReturn, parentReturn, *children; + unsigned int numChildren; + + root = RootWindowOfScreen(screen); + + /* go look for a virtual root */ + __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False); + if (XQueryTree(dpy, root, &rootReturn, &parentReturn, + &children, &numChildren)) { + for (i = 0; i < numChildren; i++) { + Atom actual_type; + int actual_format; + unsigned long nitems, bytesafter; + Window *newRoot = (Window *)0; + + if (XGetWindowProperty(dpy, children[i], + __SWM_VROOT, 0, 1, False, XA_WINDOW, + &actual_type, &actual_format, + &nitems, &bytesafter, + (unsigned char **) &newRoot) == Success + && newRoot) { + root = *newRoot; + break; + } + } + if (children) + XFree((char *)children); + } + + save_screen = screen; + } + + return root; +} + +#undef RootWindowOfScreen +#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s) + +#undef RootWindow +#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen)) + +#undef DefaultRootWindow +#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy)) + +#endif /* _VROOT_H_ */ diff --git a/sherman-aquarium/shermans/xmms_sn.c b/sherman-aquarium/shermans/xmms_sn.c new file mode 100644 index 0000000..d0b21ec --- /dev/null +++ b/sherman-aquarium/shermans/xmms_sn.c @@ -0,0 +1,160 @@ + +/* Displays the currently loaded/played song by XMMS */ + +#include +#include +#include + +#include "aquarium.h" +#include "draw.h" +#include "xmms_sn.h" + + +static Xmms_sn_settings xmms_sn_settings; +static SA_Image xmms_font; +static AquariumData *ad; + +Xmms_sn_settings *xmms_sn_get_settings_ptr(void) +{ + return &xmms_sn_settings; +} + +void xmms_sn_exit(void) +{ + if(xmms_font.pixbuf!=NULL) + g_object_unref(xmms_font.pixbuf); + + memset(&xmms_font,0,sizeof(SA_Image)); + +} +void xmms_sn_init(void) +{ + ad = aquarium_get_settings_ptr(); + + + if(xmms_font.pixbuf!=NULL) + xmms_sn_exit(); + + load_image("small_letters.png",&xmms_font,1); + + /* Some changes cause this image is horizontal ordered */ + + xmms_font.frames = XMMS_SN_NUM_LETTERS; + xmms_font.width = xmms_font.width/xmms_font.frames; + + change_colour_to(xmms_sn_settings.c.r, + xmms_sn_settings.c.g, + xmms_sn_settings.c.b, + xmms_font.image, + xmms_font.pixbuf, FALSE); + +} + +void xmms_sn_update(int beforeorafter) +{ + int i,x=0,y=0,a; + static float start_display = 0.0; + + int session_id = 0; + char *xmms_str, *disp_str; + + if(beforeorafter!=xmms_sn_settings.draw) + return; + + if(!xmms_sn_settings.on) + return; + + if(!xmms_remote_is_running(session_id)) + return; + + xmms_str = xmms_remote_get_playlist_title(session_id, + xmms_remote_get_playlist_pos(session_id)); + if(xmms_str==NULL) + return; + + disp_str = g_strdup_printf(" %d. %s (%d:%.2d) *** ", + xmms_remote_get_playlist_pos(session_id)+1, + xmms_str, + xmms_remote_get_playlist_time(session_id, + xmms_remote_get_playlist_pos(session_id))/(60*1000), + xmms_remote_get_playlist_time(session_id, + xmms_remote_get_playlist_pos(session_id))/1000 %60); + g_free(xmms_str); + + + + if(xmms_sn_settings.direction == XMMS_SN_HORIZONTAL) { + + if(xmms_sn_settings.fb == XMMS_SN_BACKWARDS){ + if(((int)start_display) > (strlen(disp_str)-2)*xmms_font.width) start_display = 0.0; + } + else{ + if(start_display <0.0) start_display = (strlen(disp_str)-1)*xmms_font.width; + } + + switch(xmms_sn_settings.vert){ + case TOP: + y=2; + break; + case CENTER: + y=ad->ymax/2-xmms_font.height/2; + break; + case BOTTOM: + y=ad->ymax-xmms_font.height-2; + break; + } + x = -(((int)start_display) % xmms_font.width); + + for(i=0;i<=(ad->xmax/xmms_font.width);i++){ + if((strlen(disp_str)-1)==i) break; + a=((int)start_display)/xmms_font.width+i; + if(a>=strlen(disp_str)) a-=strlen(disp_str); + if(a<0) a=strlen(disp_str)-1; + if(disp_str[a]!=' ' && disp_str[a]<='z') + draw_image_alpha_h(x,y,((int)disp_str[a]-(int)'!'),xmms_sn_settings.c.alpha,&xmms_font); + x+=xmms_font.width; + } + } + else { + + if(xmms_sn_settings.fb == XMMS_SN_BACKWARDS){ + if(((int)start_display) > (strlen(disp_str)-2)*xmms_font.height) start_display = 0.0; + } + else{ + if(start_display <0.0) start_display = (strlen(disp_str)-1)*xmms_font.height; + } + + switch(xmms_sn_settings.horz){ + case LEFT: + x=2; + break; + case CENTER: + x=ad->xmax/2-xmms_font.width/2; + break; + case RIGHT: + x=ad->ymax-xmms_font.width-2; + break; + } + + y = -(((int)start_display) % xmms_font.height); + + for(i=0;i<=(ad->ymax/xmms_font.height);i++){ + if((strlen(disp_str)-1)==i) break; + a=((int)start_display)/xmms_font.height+i; + if(a>=strlen(disp_str)) a-=strlen(disp_str); + if(a<0) a=strlen(disp_str)-1; + + if(disp_str[a]!=' ' && disp_str[a]<='z') + draw_image_alpha_h(x,y,((int)disp_str[a]-(int)'!'),xmms_sn_settings.c.alpha,&xmms_font); + y+=xmms_font.height; + } + } + + if(xmms_sn_settings.fb == XMMS_SN_BACKWARDS) + start_display+=0.5*(float)xmms_sn_settings.speed/100.0; + else + start_display-=0.5*(float)xmms_sn_settings.speed/100.0; + + g_free(disp_str); + +} diff --git a/sherman-aquarium/shermans/xmms_sn.h b/sherman-aquarium/shermans/xmms_sn.h new file mode 100644 index 0000000..80d5116 --- /dev/null +++ b/sherman-aquarium/shermans/xmms_sn.h @@ -0,0 +1,33 @@ +#ifndef XMMS_SN_H +#define XMMS_SN_H + + +#define XMMS_SN_BACKWARDS 0 +#define XMMS_SN_FORWARDS 1 +#define XMMS_SN_HORIZONTAL 0 +#define XMMS_SN_VERTICAL 1 + +#define XMMS_SN_NUM_LETTERS (int)'z' - (int)'!' + + + +typedef struct +{ + int on; + int draw; + int vert; + int horz; + int direction; + + int fb; + int speed; + GaiColor c; +} Xmms_sn_settings; + +void xmms_sn_init(void); +void xmms_sn_update(int); +void xmms_sn_exit(void); +Xmms_sn_settings *xmms_sn_get_settings_ptr(void); + + +#endif diff --git a/sherman-aquarium/shermans_icon.png b/sherman-aquarium/shermans_icon.png new file mode 100644 index 0000000..99f1f1d Binary files /dev/null and b/sherman-aquarium/shermans_icon.png differ