diff options
author | cos <cos> | 2013-05-19 16:11:32 +0200 |
---|---|---|
committer | cos <cos> | 2013-05-19 16:11:32 +0200 |
commit | cd481a01174468188d23b9d544cb738471c7fb52 (patch) | |
tree | f84d9595128f5542a8a1b83d8a65ad7fcd1bc183 | |
parent | 43ad739ad0bc13c4be46ca1982a41acaa8b106a5 (diff) | |
download | ratpoison-cr/implement_gnumber_uglyhack.zip |
Obsoleted branch.cr/implement_gnumber_uglyhack
Please look at cr/implement_gnumber_hack instead.
113 files changed, 0 insertions, 35015 deletions
diff --git a/.dir-locals.el b/.dir-locals.el deleted file mode 100644 index 8b1908f..0000000 --- a/.dir-locals.el +++ /dev/null @@ -1,2 +0,0 @@ -((c-mode . ((indent-tabs-mode . nil) - (c-file-style . "gnu")))) diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index b6e183f..0000000 --- a/AUTHORS +++ /dev/null @@ -1,55 +0,0 @@ -Shawn Betts (sabetts at vcn bc ca) - -Shawn is the original author and former maintainer for -ratpoison. Sickened by the rat and the trend in window managers, he -sat down one evening and pulled an all-nighter writing the first -version of ratpoison. - -Ryan Yeske (rcyeske at vcn bc ca) - -Ryan doesn't commit much code these days, but that's not because he -doesn't want to, its just that he forgot his cvs ssh password. -Meanwhile, the patches are piling up. - -Jeremie Courreges-Anglas (jca+ratpoison at wxcvbn dot org) - -Current maintainer. - -Other Contributors: - -Ben Leslie <benno at sesgroup dot net> -Chr. v. Stuckrad <stucki at math dot fu-berlin dot de> -Dan Aloni <da-x at gmx dot net> -Doug Kearns <djkea2 at mugc dot its dot monash dot edu dot au> -Gergely Nagy <algernon at debian dot org> -Henrik Enberg <henrik at enberg dot org> -Jonathan Walther <krooger at debian dot org> -Martin Samuelsson <rp-contrib at cos dot user dot lysator dot liu dot se> -Mike Meyer <mwm at mired dot org> -Nicklas Lindgren <nili at lysator dot liu dot se> -Pasi Kallinen <pkalli at cs dot joensuu dot fi> -Rupert <rupert dot debian at hotpop dot com> -Tim Goodwin <tjg at star dot le dot ac dot uk> -Joshua Neuheisel <jneuheisel at msn dot com> -Thien-Thi Nguyen <ttn at surf dot glug dot org> -Joshua Neuheisel <jneuheisel at msn dot com> -Sylvain BEUCLER <beuc at beuc dot net> -Cameron Patrick <cameron at patrick dot wattle dot id dot au> -Trent Buck <fubarbaz at bigpond dot com> -jesus c. meyendriesch <jesus at qplay dot org> -Bernhard R. Link <brlink at debian dot org> -Tobias C. Rittweiler <tcr at freebits dot de> -Antti Nykänen <aon at iki dot fi> -rubikitch <rubikitch at ruby-lang dot org> -Florian E.J. Fruth <fejf at rommel stw uni-erlangen dot de> -Tim Cooijmans <tim at aapopfiets dot nl> -Andreas Seltenreich <uwi7 at rz dot uni-karlsruhe dot de> -Steve Folta <steve at folta dot net> -Midare Kiyura <puce at gmx dot com> -Joshua Neuheisel -Philip Hudson <phil.hudson at iname dot com> -Ali Gholami Rudi <aliqrudi at gmail dot com> -Hatem Nassrat <hnassrat at gmail dot com> -J.R. Mauro <jrm8005 at gmail dot com> -Kipling Inscore <k at bijna dot net> -Rob Paisley <paisley at www rpaisley dot com> diff --git a/COPYING b/COPYING deleted file mode 100644 index d60c31a..0000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - 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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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) year 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. - - <signature of Ty Coon>, 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/ChangeLog b/ChangeLog deleted file mode 100644 index 7a44d16..0000000 --- a/ChangeLog +++ /dev/null @@ -1,7178 +0,0 @@ -commit 37fc06213b65b9b8ced68f08697608632be91de0 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Sun Apr 7 03:23:50 2013 +0200 - - In strtok_ws() use "last", not "pointer" for the static variable - - * since X11/Xdefs.h may define it too. Found by -Wshadow. - - Bonus: "last" carries more meaning. - -commit e0714ec506da0a3647e352cf86094446cb6d2b38 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Sun Apr 7 03:07:35 2013 +0200 - - Don't use a flexible array member in struct history_item - - * They are a c99 feature, which makes it impossible to build ratpoison - on some platforms. GCC supports zero-sized arrays, more conservative - approaches say to use foo[1], but as brlink says a compiler with - aggressive optimization turned on might play nasty tricks. - Just use a traditional struct. - -commit 340833f5e0c4350ac0c7fc6589a4305014b56ba8 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Apr 1 13:44:57 2013 +0200 - - a .dir-locals.el file for contributors using Emacs - -commit 9cbe6c982d18fdd0ef12d45ba2cfe6629dd4b361 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Fri Feb 22 19:46:59 2013 +0100 - - receive_command_result() fixup - - * forgot a break statement when moving things around - * braino in comment: '1' is RET_SUCCESS, '0' is RET_FAILURE - -commit 3e2c03c1fccb811e8e1e32b8f4727988379aba3b -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Fri Feb 22 19:19:47 2013 +0100 - - fixup return values of several commands - - * in cmd_select(), consistently set the return value for all cases we deal - with - * in cmd_unmanage(), don't attempt to use a NULL pointer if the unmanaged - windows list is empty; just report success - * in cmd_kill, only report failure if XKillClient() actually failed - * in command(), remove a useless test: cmd can't be NULL - * in cmd_gravity, don't call current_window() twice - -commit c58386717db86dc7f5e954d2c972c8d606044bb1 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Fri Feb 22 19:08:11 2013 +0100 - - make ratpoison -c provide a useful exit status - - * properly define the way the wm may give feedback to ratpoison -c; - see communications.c:receive_command_result() - * follow this protocol in events.c:receive_command() - * modify receive_command_result() to return an int (which is the - mirror of the struct cmdret "success" member used on the wm side) - * pass that error status back to main.c; exit with an error status if - any of the commands we sent failed - -commit f42b5f6fcb244d9b5ad159113cd921c7f69d6134 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Feb 18 12:44:52 2013 +0100 - - silence minor compilation warning in src/manage.c - -commit 1c4335fe092978b42eda6ccbb37854c95fb5f368 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Thu Feb 14 22:39:10 2013 +0100 - - more correct cmd_help() - - * only print the "Command key: ..." bits if we're dealing with - the root kmap - * don't read (and print) uninitialized data - (foomap->actions[foomap->actions_last] shouldn't be accessed) - - It seems like keymap actions and other things like aliases - use arrays because they were implemented before linkedlist.[ch] - were introduced. Perhaps should we just switch them to more - fool-proof linked lists? - -commit 13812e9f61fa3141619cb0e2fdf0ed41a5e2ec1d -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Feb 13 00:11:43 2013 +0100 - - move xa_string initialisation before first use - - otherwise ratpoison -c no longer works - -commit 32419fdf409ff9aae184385a98341b964768be0c -Author: Bernhard R. Link <brlink@debian.org> -Date: Tue Feb 12 21:26:35 2013 +0100 - - readd AM_MAINTAINER_MODE, but enable maintainer mode by default - - Using AM_MAINTAINER_MODE([enable]) means you get the maintainer-specific - parts enabled by default like without AM_MAINTAINER_MODE, while - people still can do --disable-maintainer-mode to avoid any pitfalls. - -commit 01dffe2d3795cf484f706f68f557692c138e45e4 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Feb 11 22:39:48 2013 +0100 - - get rid of AM_MAINTAINER_MODE - - * this one has bitten me too many times as an end user ; here it annoys me as - a maintainer - version.texi not being installed. bye bye. - - See info "(automake) maintainer-mode". - -commit 1372824130846d099b507f97f20a1fc453710fa1 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Feb 11 22:38:04 2013 +0100 - - update Shawn's email address in documentation - - * while here, s/EMACS/Emacs/ in the Info manual - -commit 130b4750b433521c77a31d9605a62604a8cd7805 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Sun Feb 10 00:32:59 2013 +0100 - - texinfo manual update - - * fdl.texi: update to a newer version (not to a newer licence version!) - * ratpoison.texi: update to build printed manuals, get rid of annoying - @node references, and move GFDL to the last section. use automake support - for version.texi, so that manuals don't ship with an outdated version - * .gitignore: match update - -commit ec8683c7dbe6168becec6a4f34dcf0a561cf0781 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Fri Feb 8 23:41:05 2013 +0100 - - add myself (as current maintainer) to AUTHORS - -commit 2050d15a19d65a692be47956b1caa4ad21125ef3 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Fri Feb 8 21:37:00 2013 +0100 - - update FAQ url - -commit 1b12727e810929b5978dfe164fb4b1e2b389a6f1 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Thu Feb 7 02:23:47 2013 +0100 - - remove ratpoison.spec - - * this file is outdated and doesn't help rpm distros - packagers / users, so let's just delete it - - Discussed with Kevin Fenzi (Fedora ratpoison maintainer) - -commit 41707e8dd6804f803944caa42b7c79b66697b945 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Wed Feb 6 21:26:59 2013 +0100 - - mv configure.in configure.ac - - * rename this file since new versions of automake complain - about the old name - -commit 2685676e118cd63380e6a12ce81ce5d4f0badc0a -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Wed Feb 6 19:03:07 2013 +0100 - - rp_text_width: remove "font" argument - - * (globals.[ch]): remove rp_text_width "font" arg, since its value - is always the global variable defaults.font (non-Xft case). - remove one #ifdef while here - * update rp_text_width() calls to match new signature - -commit 20c5d11a3be2843c808ba84f971ed3fed011e144 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Wed Feb 6 19:50:53 2013 +0100 - - use utf8-handling Xft functions if we are in an UTF-8 locale - - * (manage.c) in get_wmname(), try to get the (UTF-8 encoded) - _NET_WM_NAME property. Fallback to GetWMName() if unavailable. - Add some debugging bits to see which TEXT encoding clients use - for WM_NAME. - * (globals.c) use Xft*Utf8 functions to compute text width and - draw strings. No regressions with or without Xft, UTF-8 locale - or not. - * assume we can use Xft*Utf8 functions whenever we have Xft, - to reduce the #ifdef dance - - Original patch from Bernhard R. Link - -commit 3725c23fddd8e936a91296f74e3fd6342270d6bb -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Wed Feb 6 19:28:33 2013 +0100 - - make TEXT atoms global variables - - * (events.c) extract xa_compound_text from selection_request(), - make it a global - * introduce xa_string (same as XA_STRING) and rename - utf8_string to xa_utf8_string, for consistency - -commit 5c0abe47a800dca3faf97b7ec608d86fddab25b6 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:33:13 2013 +0100 - - introduce defaults.utf8_locale - - * use nl_langinfo() to detect if locale codeset is UTF-8 - -commit 332b260f17547d822567473f6b92ff710cf738a3 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:30:14 2013 +0100 - - autotools: introduce AM_LANGINFO_CODESET - - * (m4/codeset.m4) new file (from the gettext package) - * (configure.in) use AM_LANGINFO_CODESET - * (.gitignore) don't ignore m4/codeset.m4 - -commit 25827ea4a0f99d5327781892d6cbea84ef78a07c -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:23:25 2013 +0100 - - configure.in: get rid of AC_TYPE_SIGNAL - - it has been unused so far, and afaik we don't support pre-ansi - platforms... - -commit 0ef7dc215071c486495bf86e85661f21733f200e -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:20:55 2013 +0100 - - configure.in: compiler handling - - * no need to explicitely check for gcc, it will be picked - up if available - * prepend to CFLAGS instead of appending - * no need to add -O2 if gcc, autoconf automatically does - that when appropriate - -commit 8376efac671aee91de711d54eeb33d453ca5902e -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:12:24 2013 +0100 - - configure.in: rename obsolete macros - - * s/AM_CONFIG_HEADER/AC_CONFIG_HEADER - * s/AC_HELP_STRING/AS_HELP_STRING - -commit 1d87464fc86864ae66570cfedb5ac703e93d0cfa -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:10:14 2013 +0100 - - Makefile.am: strip unused stuff - - * PACKAGE and VERSION are already AC_SUBST'ed - * targets bin-dist and strip-bin-dist don't exist - -commit c3aa7c8bba7794d8856156ac3c361e952847648d -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Jan 21 02:08:18 2013 +0100 - - more up-to-date autotools practices - - * use proper AC_INIT / AM_INIT_AUTOMAKE arguments - * install macros in m4/ - * install junk build files in build-aux/ - * replace hand-rolled autogen.sh by autoreconf -i - * sync .gitignore - -commit 09a464eb213212ac6538bc4bba9d2e391562b100 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Mon Dec 17 10:03:39 2012 +0100 - - basic contrib/ cleanup - - * (*.pl, rpws) don't hardcode path to Perl but rely on /usr/bin/env - * (allwindows.sh) don't require bash - * (rpshowall.sh) properly handle arguments, use portable shell arithmetic - * (*.sh) use more quotes - * (*.pl, split.sh) use 'ratpoison' if RATPOISON isn't in the environment - (and don't error out) - -commit 70ae853c054dd2b1b6cbf2fcffb678331ae3a031 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Thu Dec 13 14:27:54 2012 +0100 - - tmpwm fix: SIG_IGN -> SIG_DFL - - for waitpid(SIGCHLD, SIG_IGN) behaves wildly differently across OSes. Fixes - tmpwm hanging after child wm exits on OpenBSD. - -commit a88b2a86adc03916a0859468edf742dbf5140b01 -Author: Jérémie Courrèges-Anglas <jca@wxcvbn.org> -Date: Wed Dec 26 05:11:10 2012 +0100 - - environment handling fixes - - * AC_CHECK_FUNCS: +setenv +unsetenv -putenv - (the check for putenv() wasn't used anyway) - * prefer setenv() to putenv() in cmd_setenv() - * prefer unsetenv() to putenv() in cmd_unsetenv() - - putenv("FOO") isn't legit everywhere - - putenv("FOO=") will only work on MinGW - * make the getenv command return an empty output if the variable wasn't found - * while here, split and sort AC_CHECK_FUNCS - - |cos| on #ratpoison reported that environment variables weren't - properly removed, and proposed a different fix. thanks! - -commit 9d1edbd9c618b063a4baae39a82a81da236ea72f -Author: Vincent Batts <vbatts@hashbangbash.com> -Date: Fri Aug 10 01:16:38 2012 -0400 - - contrib/genrpbindings: removing the space between method name and the parenthesis - - Ruby syntax got more restrictive, so spaces are no longer allowed there. - -commit 0509e1dbde7b246e1bfec177ecb451e57bde8788 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sat Jun 30 15:03:45 2012 +0200 - - cmd_info: also display a window not in the current group - - Without this change, cmd_info displays "No Window" if called - with the current window not in the current group (for example - directly after a gselect). - - This change makes it also look in other groups. In that case - it might show a number not the one to switch back to it without - switching the group first, but I guess that is less confusing - than just claiming there is no window. - -commit c21c28d64b5495ec6534d24f5de5200a9e9a7fed -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed May 25 10:07:41 2011 +0200 - - remove mention of non-existant keybinding for quit from manpage - -commit 16196bce07d6ee1beb1bb83db0d36e841b7b59da -Author: anthony <anthony@fiord.com> -Date: Wed Apr 20 13:18:02 2011 +0400 - - Fix display_string construction to handle new XDisplayString() behaviour - - XDisplayString does not append ".screen number" to return value after - http://gitorious.org/omcfadde/libx11/commit/f92e754297ec5fdb81068b56a4435026666224fa - Fix by appending .screen_num to the end of s->display_string in such case - -commit 7d1e839e1ad28053220a2f240a5981093b76aee7 -Author: Bernhard R. Link <brlink@debian.org> -Date: Thu Dec 23 15:38:34 2010 +0100 - - don't follow a pointer that might be NULL (HIDE_MOUSE specific) - - In events.c's key_press, the screen the local pointer variable s - points to is accessed if HIDE_MOUSE is defined when hiding the cursor. - Directly after that there is a "if (!s) return;", which is obviously - too late. - - By default HIDE_MOUSE is not defined in src/conf.h, so this is not - a problem unless this feature was enabled at compile time. - - Found by cppcheck. - -commit f4433c0dfca70186f83bd44f3eca365c06520b34 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sat Aug 21 19:26:52 2010 +0200 - - document nextscreen and prevscreen default keybindings in the manpage - -commit c48f75e86aea05a8b09a9e52eebe202ac2e84c3c -Author: Zed Lopez <zed.lopez@gmail.com> -Date: Tue May 18 09:06:26 2010 -0700 - - add a titlechanged hook - -commit 7ca1af7c055d435888f1c5e3dd02f1456334c599 -Author: Keith Amling <keith.amling@gmail.com> -Date: Fri May 7 04:57:12 2010 -0700 - - fix alias bug - - When an alias is executed without arguments, for example aliasing - "reload" to "source .ratpoisonrc" and then running "reload" by itself - results in "source: .ratpoisonrc : No such file or directory" implying - it was trying to load ".ratpoisonrc " (note the extra space). - -commit 813191c8e9be42d5b113eb35242dc74f5088bddd -Author: Shawn Betts <Shawn Betts sabetts@andrew.cmu.edu> -Date: Fri Apr 16 17:36:03 2010 -0700 - - in init_screen, properly handle a dot in the display string - -commit 20dbf1d91eba92d4b1a61d56774332e00f4c2a6d -Author: Shawn Betts <Shawn Betts sabetts@andrew.cmu.edu> -Date: Mon Apr 12 10:37:45 2010 -0700 - - document newwindow hook - -commit fdd42223cfc6751e4c632daef64189dbcfc2abe8 -Author: Eric A <eric225125@gmail.com> -Date: Mon Apr 12 10:37:03 2010 -0700 - - add a new_window_hook to the map_window function of manage.c. - -commit 526b74d89dfad6772d15004228ff617898918daf -Author: Kipling Inscore <k@bijna.net> -Date: Tue Mar 30 20:47:25 2010 -0700 - - Cleaned up some cmdret, sbuf, char * usage; eliminating associated memory leaks - -commit 24c831b03816bd9821198cc9d24f0cf9e1e7e062 -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Mar 17 16:18:07 2010 +0100 - - fix swap across multiple screens - - exchange_with_frame now always selects the second frame given, - simplifying the code (getting rid of segfaults when both were - on different screens). This changes the behaviour of cmd_swap - to always focus the first argument when two arguments are given. - - This patch also removes the screen argument of exchange_with_frame, - which is now no longer needed (and cmd_swap was giving the wrong - screen anyway in the case of multiple arguments given). - -commit f5246556adf56ae470a1e898f27ca0fead7d0f7b -Author: Shawn Betts <Shawn Betts sabetts@andrew.cmu.edu> -Date: Sun Jan 31 11:30:45 2010 -0800 - - change error message for gdelete to reduce confusion. - -commit 123abf526df35cb6eed59e13516bea653a065873 -Author: Rob Paisley <paisley@rpaisley.com> -Date: Sun Jan 31 11:24:47 2010 -0800 - - cother/iother Segfault patch - - As reported by "Gentooer" in the #ratpoison IRC channel, there is a bug in - :cother and :iother. If are no windows and you issue either :cother, or - :iother ratpoison segfaults. This patch resolves the issue. - -commit fde3d5537776664284cab59f521a898ccb456893 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun Jan 3 12:08:13 2010 +0100 - - correct spelling errors in the manpage - -commit 75ac14935960a23867aa14f736f917ae7a4f3ee5 -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Nov 25 16:20:35 2009 +0100 - - Do not manually set docdir to default directory. - - The setting of docdir in Makefile.am is uncessary - as it is set to the default value. - It is harmful as this overwrites the value filled in by autoconf - causing a user suplied --docdir= to be ignored. - - Thanks to Grigorios Bouzakis for reporting this. - -commit 66f1644c881d8388015016d082e6c8643959fb8c -Author: Bernhard R. Link <brlink@debian.org> -Date: Fri Oct 30 19:05:19 2009 +0100 - - update debian/ - - to include changes for 1.4.5-2 - - to update patches to apply to current git - - list explicit commands in debian/README.source how to build from git - -commit a9578d667935a6206622e01707cb3cd14d1b112b -Author: Bernhard R. Link <brlink@debian.org> -Date: Fri Jul 17 14:21:27 2009 +0200 - - move libraries from LDFLAGS to LDADD to avoid problems in argument order - -commit 12d21a72e0103f32dfb34d5fd05934ceee78e30d -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Jul 15 19:06:41 2009 +0200 - - silence gcc false-positive undefined warning - -commit dd1ca608f1846d52448e80751749dc0e64d24f46 -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Jul 15 18:50:54 2009 +0200 - - silence gcc warnings against empty if branches - -commit 9167cc9a8b98ee691b5653aeedbb71e6d857dbed -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Jul 15 18:48:03 2009 +0200 - - silence unused variables and unused parameters warnings - -commit 21da5ebbedae6e62ec9bbf8a9027ca0c4a1b26f1 -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Jul 15 17:45:07 2009 +0200 - - use gcc's __builtin_prefetch if available to silence problems with the empty prefetch function - -commit 36dd8df21904c8e4dba98af0fb9137c438324f9f -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Jul 15 17:41:11 2009 +0200 - - silence warnings about signed/unsigned char mismatch - -commit ad06f3519881bd3b2d5b8a3f1880a6768a530e2a -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Jul 15 17:30:31 2009 +0200 - - do not shadow identifiers (silencing gcc's -Wshadow warnings) - -commit 7bdee1c7f38befd9b6b0b5805dd0824fe2233936 -Author: Bernhard R. Link <brlink@debian.org> -Date: Tue Jul 14 16:32:56 2009 +0200 - - update debian/ directory for 1.4.5-1 - -commit 4ad0b38fb53506d613c4b4f7268dadfcedae9b8e -Author: Shawn Betts <sabetts@gmail.com> -Date: Sun Jul 12 18:23:25 2009 -0700 - - check for getline in configure.in - - This fixes a build error encountered on glibc 2.10 systems - -commit f94298f075bdd1c7df191e093d9f2f9c35b77b2c -Author: Hatem Nassrat <hnassrat@gmail.com> -Date: Thu Jul 2 15:16:16 2009 -0300 - - Added functionality to rpws script - - - Move window to different workspace - - Workspaces frame state dump and restore (to/from file) commands - -commit bd6200b4ca52a48a0be49ee39e19e9701942e07e -Author: Shawn Betts <sabetts@gmail.com> -Date: Sun Jul 12 14:06:38 2009 -0700 - - bump version to 1.4.6-GIT - -commit a7d1c1e1311f41ac247734550f27dfc4d5b1d28c -Author: Shawn Betts <sabetts@gmail.com> -Date: Sun Jul 12 14:03:23 2009 -0700 - - update NEWS - -commit 14beabe55fa3cac03f598e138f363f1d50659564 -Author: Shawn Betts <sabetts@gmail.com> -Date: Sat Jul 4 20:58:21 2009 -0700 - - fix inverted text when using xft - - Now the inverted rectangle is drawn first and the text overtop in the bg color. - -commit 166021512b2e39344ff4562323d15a1e2fdea153 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun May 31 20:47:33 2009 +0200 - - only add command to general history if it was entered interactively - -commit 3caa93e319499e77f63e25b2ef4a15c276815ca8 -Author: Shawn Betts <sabetts@gmail.com> -Date: Thu Apr 30 12:50:26 2009 -0700 - - fix 'set fgcolor' for xft. Change screen's ft_font and color slots to xft_font and xft_color. - -commit d5e70ba5716dd5b807f7550f9924711365116a8b -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed Apr 29 11:35:52 2009 +0200 - - Fix issues when historysize is zero. - - If historysize is 0, do not create .ratpoison_history at exit - and do keep no entries in history. (Previously ratpoison would - always at least store the last entry). - -commit ac37eba33a3f4acf623f403f826347dde13a6213 -Author: Bernhard R. Link <brlink@debian.org> -Date: Mon Apr 27 14:20:58 2009 +0200 - - update debian/ to 1.4.4-1 - -commit 0930ca29e337de79df18c5f8ba4aaad440ee0c00 -Author: Shawn Betts <sabetts@gmail.com> -Date: Sun Apr 26 19:18:03 2009 -0700 - - bump version to 1.4.5-GIT - -commit b7f45b056ca8de92e195a9661a45e01a1c875578 -Author: Shawn Betts <sabetts@gmail.com> -Date: Sun Apr 26 19:14:30 2009 -0700 - - update AUTHORS, NEWS, and ChangeLog with recent changes -commit 18ee1ed3b3839d44e08e5aefd0e926d29d252654 -Author: Shawn Betts <sabetts@gmail.com> -Date: Fri Apr 24 15:28:27 2009 -0700 - - rename ratpoison-info and ratpoison-commands-info to remove name clash with ratpoison-cmd.el - -commit d605c07b966d541820805a4938b59242e315735f -Author: Philip Hudson <phil.hudson@iname.com> -Date: Sun Apr 19 21:58:23 2009 +0100 - - in contrib/nogaps.el, placate the emacs Lisp byte-compiler and standardise the (require 'cl) line - -commit b890eb8b955edfa46acda6d7b4ff0ab7f15dcfab -Author: Shawn Betts <sabetts@gmail.com> -Date: Fri Apr 24 10:16:39 2009 -0700 - - in contrib/rpws don't create wspl1, since it already exist as the Default group. - - Also add a check to ensure the workspaces creates are at least 2. - -commit a4de27cea6f5bf937f9b282f0195c0e4763a185f -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Apr 13 05:50:35 2009 -0700 - - grab the keyboard and pointer in cmd_resize - - * fixes a bug that hangs rp: in resize mode, click firefox and rp hangs - -commit c7b3817c222952196b11825076c902d6dd1da455 -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Apr 13 05:33:47 2009 -0700 - - make ratinfo and ratrelinfo work with ratpoison -c and return coordinates relative to current frame when there's no window - - * update docs - -commit bd7aa51699f49cf7a67c403ba7f2ba3738fcf644 -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Apr 13 05:19:46 2009 -0700 - - fix segfault in banishrel and make it banish to the corner of the frame when there's no window - - * update documentation - -commit 300c05edf890fbe2de11070b9839359bef9916e1 -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Apr 13 05:04:18 2009 -0700 - - add texinfo documentation for ratinfo, ratrelinfo, banishrel commands - -commit 855d25f482c43a66a73026e62ff0da539acc67e8 -Author: Rob Paisley <paisley@www.rpaisley.com> -Date: Fri Nov 28 13:14:07 2008 -0500 - - Add ratinfo, ratrelinfo, and banishrel commands - -commit e2282bd77f041430c510203365b18436a60d0586 -Author: Hatem Nassrat <hnassrat@gmail.com> -Date: Mon Feb 23 09:57:18 2009 -0400 - - Allowing for next and prev workspace switching. - -commit 82be5b35eda82f8dd4b6e19940d6a7bee1b582ea -Author: Shawn <sabetts@juicebox> -Date: Mon Apr 13 01:23:38 2009 -0700 - - resize the help window when a screen is resized - -commit 281aaf7b489d9ba89fdf5e39637cde287e83f9fa -Author: Bernhard R. Link <brlink@debian.org> -Date: Sat Jan 3 16:22:29 2009 +0100 - - set _net_wm_name for the root window to ratpoison - -commit ffae4bf9413bec7efd5d4821e030b63a700fab69 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sat Jan 3 16:21:34 2009 +0100 - - Move screen activation code to new (de)activate_screen functions, - - making sure _NET atoms are reset after tmpwm and deleted when exiting. - -commit 9888fccffbc7d9f5680512b03ace6dd5fc325094 -Author: Shawn <sabetts@juicebox> -Date: Tue Nov 18 15:46:48 2008 -0800 - - fix AUTO_CLOSE code in unmanage() - -commit 612b99640af64d28823d3a02cdcecf202b74940c -Author: Shawn <sabetts@juicebox> -Date: Sat Nov 1 11:22:22 2008 -0700 - - in cmd_tmpwm wait for a second if it failed to re-select the root events. - -commit 75207d2e878250c2717174a22cc828c0aba5ba76 -Author: Shawn <sabetts@juicebox> -Date: Sat Nov 1 10:29:44 2008 -0700 - - fix (i hope) the tmpwm race condition and the bug that sometimes keys don't work after tmpwm - - the race condition is fixed by spinning in a loop with a special error - handler until it is confirmed that the root event selections were - successfully. - - Existing windows don't get their top level keys grabbed, so after the - windows are synced up, grab the top level keys on all windows. - -commit c0bee97912e5caf256441dbdc531f38fbe06d780 -Author: Shawn <sabetts@juicebox> -Date: Wed Oct 22 14:28:45 2008 -0700 - - include limits.h for INT_MAX - -commit 970d09c36249834e63d529cfdfce0672dff25d99 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun Jun 15 17:56:10 2008 +0200 - - update documentation - -commit 086cf745280ff944a479508f806fa118839e166f -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun Jun 15 15:40:37 2008 +0200 - - ignore non-existing libhistory unless --enable-history - -commit 1e4c576b14025d4e16e09110c31b1dec5dac85b9 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun Jun 15 15:02:03 2008 +0200 - - make history expansion an option (switched off by default) - -commit 4ca186ff04eb611db6b11aa0c06adda7f428d4f3 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun Jun 15 13:40:54 2008 +0200 - - remove libhistory history handling, only feed it on demand when doing ! expansion - -commit 7214b8c52e230fdb52a99ce1ed20092c6944dcd3 -Author: Bernhard R. Link <brlink@debian.org> -Date: Thu Jun 12 18:10:37 2008 +0200 - - add 'set historysize' and 'set historycompaction' (defaulting to true) to compact history - -commit 4a15061f631b5b85c0cff068407c51bfb315a497 -Author: Bernhard R. Link <brlink@debian.org> -Date: Thu Jun 12 12:20:06 2008 +0200 - - alternate history implementation when no libhistory is available - -commit 3737db1e6072c557748ba0ffcdca1e810b15009f -Author: Bernhard R. Link <brlink@debian.org> -Date: Tue Jun 10 15:40:50 2008 +0200 - - move all HAVE_HISTORY into history.c - -commit d11f0735321bc725441fbc1dec04e363d07c987a -Author: Bernhard R. Link <brlink@debian.org> -Date: Tue Jun 10 14:24:05 2008 +0200 - - SHELLCMD history only shows execute arguments, things to execute are stored as in history as execute commands - -commit d801644502adf42570e9a5b75fcaa013f613fc5a -Author: Bernhard R. Link <brlink@debian.org> -Date: Mon Jun 9 23:50:27 2008 +0200 - - define different history types and use them - - (implementation does not separate them yet, though) - -commit 22cea909c3d1b695424ef85153917b00bfb1261c -Author: Antti Nykänen <aon@iki.fi> -Date: Wed Oct 22 18:42:24 2008 +0300 - - return the correct value when set_barinpadding is called without arguments - - Currently, when you execute C-t : set barinpadding, you actually get the - bar's border width. This patch fixes that. - -commit 96f9429650200ee4b9897a778a28954de772d151 -Author: Shawn <sabetts@juicebox> -Date: Sun Oct 19 13:20:28 2008 -0700 - - update the NEWS file to reflect recent changes - -commit 443bd7387dce55812eabe970b4a267d9e626e9a0 -Author: J.R. Mauro <jrm8005@gmail.com> -Date: Sun Oct 19 08:13:41 2008 -0400 - - add contrib/expose.pl - -commit 03f8bba45a8d1b0236731b4aece52795c0bc1326 -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Sat Oct 18 08:05:15 2008 +0330 - - disallow duplicate group names - -commit 9ec3e80ad828e3eb35ce800b78fa73176d0d7c02 -Author: Antti Nykänen <aon@iki.fi> -Date: Thu Jun 26 16:57:16 2008 +0300 - - PID support for format_string - -commit 656481bd1b052137826d041347bd0a93592b96a0 -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Sat Oct 11 09:40:12 2008 +0330 - - run switch group hooks after gdelete - - When current group is deleted, a new group is selected but switch - group hooks are not run. This patch calls set_current_group() which - runs those hooks. - -commit 4a180cb969833289eb2dd46548d594f6f37c8a87 -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Sat Oct 11 09:39:18 2008 +0330 - - don't delete the last group - - Currently gdelete deletes the last group and creates a new empty - group. This patch changes gdelete to show a message, instead. - -commit 098fc67c1a277286fc513ccb646e4054889063ab -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Sat Oct 11 09:38:26 2008 +0330 - - select the last visited group after gdelete - -commit da60eaebff265bafae3c7be1dee5a585ff3e2198 -Author: Shawn <sabetts@juicebox> -Date: Sun Oct 12 17:03:31 2008 -0700 - - change grename arg type to arg_REST - -commit 2557e59fc5ce7690d05856b04e0ea5aaff6f9f60 -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Sat Oct 11 08:33:32 2008 +0330 - - add grename command - -commit 96f8765e306e2a5ed27546d2fec9b08613d369c2 -Author: Bernhard R. Link <brlink@debian.org> -Date: Sat Oct 11 13:30:58 2008 +0200 - - cmd_swap checks that both frames are on the same screen - -commit cdf47ffa11181bee433fd52f01fbc9d29f6d5323 -Author: Shawn <sabetts@juicebox> -Date: Fri Oct 10 14:27:40 2008 -0700 - - document gother - -commit 1d291ecaf30bfa551086aabe02d065f07f00eff3 -Author: Shawn <sabetts@juicebox> -Date: Fri Oct 10 14:23:17 2008 -0700 - - mark the last group in cmd_groups - -commit b57b21ee318287d035269cb526444a756a93cae9 -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Sat Sep 20 22:18:43 2008 +0430 - - add gother command - -commit ddf7f1104af0663ba730b5b82607843fe988109e -Author: Ali Gholami Rudi <aliqrudi@gmail.com> -Date: Tue Sep 23 17:19:54 2008 +0330 - - src/actions.c: fix memory leak in cmd_groups() - -commit 2c2989660cb285509775acdf0950aab2ae6715db -Author: Shawn <sabetts@juicebox> -Date: Fri Oct 10 13:45:43 2008 -0700 - - in get_net_wm_window_type, only call XFree on success - - This fixes a crash bug that was reproduced by running dolphin (the kde - file manager). - -commit 8370ffefe77a74b17dd14b5d8e6544f677782bc3 -Author: Shawn <sabetts@juicebox> -Date: Fri Oct 10 13:35:45 2008 -0700 - - bind nextscreen/prevscreen to C-t N and C-t P - -commit cc668c2218aad54cd27d1a8611de864372156cb0 -Author: Shawn <sabetts@juicebox> -Date: Fri Oct 10 13:04:12 2008 -0700 - - choose a better approach to setting the border color in remove_frame - - * remove call to give_window_focus in remove_frame - * set the border color in hide_window - - calling give_window_focus in remove_frame was plain incorrect. setting - it in hide_window might be considered overkill but I believe it will - catch this case and any others that might be lurking. - -commit 497fb323835bbb3cceb39874e7555b565863c7e8 -Author: Kipling Inscore <k@bijna.net> -Date: Sun Aug 3 11:40:42 2008 -0700 - - allow window border color to be set seperately for focused and unfocused windows - -commit b47008536843fe9dfa5790581228f42d5c83ee80 -Author: J.R. Mauro <jrm8005@gmail.com> -Date: Tue Jul 29 21:40:02 2008 -0400 - - clean up set_active_window_body() with 2 new helper functions - -commit dd86c8350d1ba3dd024240ae0b91c147aa42473d -Author: Bernhard R. Link <brlink@debian.org> -Date: Fri Oct 10 10:08:04 2008 +0200 - - doc/ratpoison.texi: fix argument order of execf - -commit 8a8b8d5618eaddd2be1fd6e3e716320e007406cd -Author: Bernhard R. Link <brlink@debian.org> -Date: Sun Jun 22 17:00:36 2008 +0200 - - document new %M in manpage - -commit dd36053ca5b842759aa2c5cc5f653a84a98cbd47 -Author: Bernhard R. Link <brlink@debian.org> -Date: Mon Jun 9 22:23:58 2008 +0200 - - make xstrdup argument const char* - -commit 845b825f3f16ae02c8083f046ef13d5c922efa40 -Author: Bernhard R. Link <brlink@debian.org> -Date: Mon Jun 9 11:22:27 2008 +0200 - - Mark command arguments as arg_COMMAND - -commit f75953fcce418773e3c552cefcee33034ab6dbdb -Author: Bernhard R. Link <brlink@debian.org> -Date: Mon Jun 9 10:59:25 2008 +0200 - - remove unused history_list_items function - -commit 4e08030acf10a54af36e92b14624257fbf0835a4 -Author: Shawn <sabetts@juicebox> -Date: Fri Jun 20 14:01:39 2008 -0700 - - support the netwm dialog window type - -commit ea17008472c85c2c931336774335261b8394a691 -Author: Shawn <sabetts@juicebox> -Date: Fri Jun 20 13:57:18 2008 -0700 - - add a maxsize formatter character to format_string - -commit 5df9409554d64c73736fb044d8baead78c9c938e -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Jun 16 19:15:20 2008 -0700 - - update copyright notice - -commit 040d4dbf7332d295b1c3078ded7c418ec396e8fa -Author: Shawn Betts <sabetts@gmail.com> -Date: Thu May 29 15:01:07 2008 -0700 - - don't grab the key if the keysym doesn't map to a keycode - - Also, remove the restriction that a keysym must have a keycode in order to be bound. - -commit d1f633382214f50e07cea482249ff9733fa7ded3 -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed May 28 19:11:02 2008 +0200 - - Use AC_HELP_STRING for all help texts. - -commit 229ba0708073b0d02ab253290f224a91844f1b17 -Author: Bernhard R. Link <brlink@debian.org> -Date: Wed May 28 18:59:57 2008 +0200 - - Only check for xft.pc if xft is not disabled. - If xft is explicitly requested, not finding it causes an error. - The CPP and LD flags for the different libraries are put in - specific variables and only added in the Makefile. - -commit bb3e3db9c29a478939394c612ab93f9d9cdc3bc8 -Author: Shawn <sabetts@juicebox> -Date: Sun May 25 01:00:23 2008 -0700 - - update news and authors wrt xft - -commit 76c0bd55bd31b70bc0cbfd198613c09be4acd9b5 -Author: Shawn <sabetts@juicebox> -Date: Sun May 25 01:00:11 2008 -0700 - - use PKG_CHECK_MODULES to detect xft - -commit bf8dc854fbb0c258c67735153c18903aeb467c60 -Author: Shawn <sabetts@juicebox> -Date: Sun May 25 00:27:03 2008 -0700 - - don't free defaults.font when xft is enabled - -commit 8ff12976802745ddfd06b4016089b12a3182a86b -Author: Shawn <sabetts@juicebox> -Date: Sun May 25 00:20:00 2008 -0700 - - properly indent calls to rp_text_width and rp_draw_string - -commit 98503f1fa2abd896c91a186c1f1670932a14ed63 -Author: Shawn <sabetts@juicebox> -Date: Sun May 25 00:18:17 2008 -0700 - - change -1 to the proper string length in some calls to rp_text_width and rp_draw_string - -commit 4be06410d03bcbcde5707e317c321a482cb32214 -Author: Shawn <sabetts@juicebox> -Date: Sat May 24 23:43:12 2008 -0700 - - fix whitespace errors in xft patch - -commit d37c7484ab881b0283fd4573235b24fe7d1e7af9 -Author: Midare Kiyura <puce@gmx.com> -Date: Sat May 24 16:04:33 2008 -0500 - - Add xft support - -commit c7ec59674cfe315f2a0ea54fc7444b4a6a6a8a67 -Author: Bernhard R. Link <brlink@debian.org> -Date: Fri May 2 10:10:43 2008 +0200 - - make read_any_key a proper prototype - -commit ede3fb4202ee1e8d397d2ec041bbfa927cf51d02 -Merge: 9b98a44... 9120e78... -Author: Shawn <sabetts@juicebox.(none)> -Date: Fri Apr 18 16:42:37 2008 -0700 - - Merge branch 'master' of ssh://sabetts@git.sv.gnu.org/srv/git/ratpoison - -commit 9b98a448c43088603601e287794925039fd60429 -Author: Shawn <sabetts@juicebox> -Date: Fri Apr 18 16:42:17 2008 -0700 - - fix off by one bug in rpws - -commit c2c4f2850606bb982350f0d7bae6b100a4d4a5de -Author: Shawn <sabetts@juicebox> -Date: Fri Apr 18 16:42:00 2008 -0700 - - bump version to 1.4.4-GIT - -commit 59f03dada1682b5025cf7def0ec2dde5abdab83a -Author: Shawn <sabetts@juicebox> -Date: Fri Apr 18 16:41:49 2008 -0700 - - add 1.4.3 news - -commit 9120e78541e6e58f0a859de8dfe0c1b00eb0f264 -Author: Bernhard R. Link <brlink@debian.org> -Date: Fri Feb 22 11:06:17 2008 +0100 - - remove AC_CANONICAL_HOST and bin-dist target as only user of it - -commit 0f793c3f0ba508afa251cab5cfd45fe79123584f -Author: Bernhard R. Link <brlink@debian.org> -Date: Thu Feb 21 15:20:41 2008 +0100 - - update debian/ directory - -commit 7f74fffef79e5e77f9b880a7cad8fc308e901709 -Author: Bernhard R. Link <brlink@debian.org> -Date: Thu Feb 21 14:26:18 2008 +0100 - - fix syntax errors in the manpage - -commit cc35f0778f427e43f00d735576e7044514950605 -Author: Shawn <sabetts@juicebox> -Date: Tue Feb 19 16:53:23 2008 -0800 - - grab top level key bindings asynchronously - -commit fa2fa9692587a431399ce3786f3b1e970b5e244e -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Feb 11 23:16:07 2008 -0800 - - return a value in read_single_key - -commit 6ef6c4ddce5eec679d81c48c0f5b72ab04a388f2 -Merge: a45a3c2... 4245904... -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Feb 11 23:13:39 2008 -0800 - - Merge branch 'master' of sabetts@git.sv.gnu.org:/srv/git/ratpoison - -commit a45a3c2cba130c6164088884d51af7545b7c671a -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Feb 11 23:12:09 2008 -0800 - - ifdef out Xtst library calls - -commit 42459044340ce1cb016a9a7d85e8c784f7e36979 -Merge: bd51b17... 3793365... -Author: Shawn <sabetts@juicebox.(none)> -Date: Wed Feb 6 16:50:28 2008 -0800 - - Merge branch 'master' of ssh://sabetts@git.sv.gnu.org/srv/git/ratpoison - -commit bd51b1705292845686f8f682d15f6b7b90ddc787 -Author: Shawn <sabetts@juicebox> -Date: Wed Feb 6 14:16:37 2008 -0800 - - Change the way input is read - - Before rp used xgrabkeyboard to read a key. Instead, the keyboard is - frozen when a top level key is read. Then when rp reads a key it first - sets the input focus to a suitable location such as key_window or - input_window, then thaws the keyboard and waits for a keypress. When a - key is pressed the keyboard is frozen again and the process repeats - until ratpoison is done reading input. At that point the keyboard is - thawed in a way that future keystrokes do not refreeze the keyboard. - -commit cbcc8f2882ac8985a027b5c8423b5e764c51c158 -Author: Shawn <sabetts@juicebox> -Date: Wed Feb 6 14:13:45 2008 -0800 - - add TAGS to .gitignore - -commit 37933658a66f1d7f5cc00cbf83882b84cf8c8337 -Author: Shawn Betts <sabetts@gmail.com> -Date: Fri Dec 7 12:12:07 2007 -0800 - - call switchwin hook when a window in unmapped or destroyed - -commit c322af661de758faab2a8035d1dbfd64b36a5082 -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Oct 22 02:24:25 2007 -0700 - - bump the version number in the docs to 1.4.3 - -commit e0f6041ffe1bfa9cc0c347db7a60ba420f945134 -Merge: c72f081... d384649... -Author: Shawn Betts <sabetts@gmail.com> -Date: Thu Oct 11 13:58:41 2007 -0700 - - Merge branch 'master' of sabetts@git.sv.gnu.org:/srv/git/ratpoison - -commit c72f0811c3c6f35183e7ced8b686411f329c8671 -Author: Shawn Betts <sabetts@gmail.com> -Date: Thu Oct 11 13:57:37 2007 -0700 - - Properly shell-escape ratpoison commands for perl bindings. - -commit d3846498579cbc5bbdf7cbf012e07a049488ed6a -Merge: f30be19... f229711... -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Oct 8 17:26:54 2007 -0700 - - Merge branch 'master' of ssh://sabetts@git.sv.gnu.org/srv/git/ratpoison - -commit f30be1924830a6afee9935b1a6ef094dd9471dfe -Author: Shawn Betts <sabetts@gmail.com> -Date: Mon Oct 8 17:26:17 2007 -0700 - - add more ignored files - -commit f229711cc2633a95d88c1b59c5a3e48c5800d2b4 -Author: Bernhard R. Link <brlink@debian.org> -Date: Mon Oct 8 13:02:58 2007 +0200 - - Update debian/ directory - -commit e3f4eb16ef7fce25da1e77b16b87525a724b9526 -Author: Shawn Betts <sabetts@gmail.com> -Date: Sat Oct 6 21:13:52 2007 -0700 - - bump version to 1.4.3-GIT - -commit 2dc366b17f298ec697e453e648213e29d9dea815 -Author: Shawn Betts <sabetts@gmail.com> -Date: Sat Oct 6 21:13:21 2007 -0700 - - add NEWS for 1.4.2 - -commit d4b97b5a7ff4b9a9cb73ba0d1dbaf3b91e75f8f8 -Author: Shawn Betts <sabetts@gmail.com> -Date: Sat Oct 6 21:12:58 2007 -0700 - - Remove .cvsignore files. add .gitignore files - -2007-08-14 Bernhard R. Link <brlink@debian.org> - - * src/main.c (xvsprintf): limit memory allocation - to 200K when vsnprintf return -1. (i.e. on pre-1999 - systems not distinguising fatal errors and too small - buffer). - -2007-07-08 Bernhard R. Link <brlink@debian.org> - - * src/manage.c (get_res_name, get_res_class): remove - (update_window_name): call get_class_hints directly to avoid it - being called two times. - -2007-07-07 Bernhard R. Link <brlink@debian.org> - - * src/manage.c (get_wmname): always try XmbTextPropertyToTextList - first to also support UTF-8 window titles when encoded as XA_STRING - -2007-07-04 Bernhard R. Link <brlink@debian.org> - - * src/main.c (clean_up): call free_user_commands, free_groups only - after free_window_stuff - * src/window.c (free_window_stuff): remove windows from group lists - * src/action.h (free_user_commands): new prototype - * src/action.c (set_var_free,user_command_free,free_user_commands): - new functions - -2007-05-19 Bernhard R. Link <brlink@debian.org> - - * src/manage.c (get_wmname): free buffer to close memory hole - -2007-05-17 Bernhard R. Link <brlink@debian.org> - - * src/actions.c (cmd_windows): free buffer to close memory hole - -2007-05-07 Shawn Betts <sabetts@shitbender.gagrod> - - * src/main.c (init_defaults): only load the backup font when the - default font fails. - -2007-05-04 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (init_defaults): if the default font fails, use the - backup font. - - * src/conf.h (BACKUP_FONT): new define - -2007-04-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (update_modifier_map): don't map both super and - hyper to the same modifier slot. - -2007-03-08 Shawn Betts <sabetts@vcn.bc.ca> - - * src/split.c (set_active_frame): call switch_frame hook - (show_frame_indicator): only show frame indicator - (set_active_frame): new arg force_indicator. all callers updated. - (show_frame_indicator): new arg force. all callers updated. - - * src/main.c (init_defaults): init bar_in_padding - - * src/globals.c (rp_switch_screen_hook): new hook - - * src/data.h (struct rp_defaults): new slot, bar_in_padding - - * src/bar.c (bar_x): honour bar_in_padding setting - (bar_y): likewise - - * src/actions.c (init_set_vars): add barinpadding - (set_barinpadding): new function - - * src/globals.h: new global rp_switch_screen_hook - -2007-01-31 Bernhard R. Link <brlink@debian.org> - - * src/frame.c (frame_read): fix bug to never set dedicated - -2006-12-19 Shawn Betts <sabetts@shitbender.gagrod> - - * Release 1.4.1 - -2006-12-19 Shawn Betts <sabetts@shitbender.gagrod> - - * src/manage.c (force_maximize): remove call to usleep - -2006-12-13 Andreas Seltenreich <uwi7@rz.uni-karlsruhe.de> - - * src/bar.c (show_bar, prepare_bar): Switch to default colormap. - (hide_bar): Possibly restore colormap. - - * src/input.c (get_more_input): Temporarily install default - colormap. - - * src/actions.c (cmd_help, cmd_license): Likewise. - - * src/events.c (colormap_notify): Postpone installing colormap - when bar is raised. - -2006-11-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/events.c (execute_remote_command): return a cmdred instead - of NULL when RP_COMMAND isn't present. - - * src/actions.h (cmdred_new): new prototype - - * src/actions.c (cmdret_new): no longer static function - -2006-11-23 Bernhard R. Link <brlink@debian.org> - - * doc/ratpoison.texi (set winfmt): document number between % and format. - - * doc/ratpoison.1 (set winfmt): complete format char description, - document number between % and format. - -2006-11-21 Bernhard R. Link <brlink@debian.org> - - * add MAINTAINERCLEANFILES variables to sub Makefile.ams - - * add depcomp to top-level Makefile.am's MAINTAINERCLEANFILES - - * add fdl.texi to doc/Makefile.am's EXTRA_DIST - -2006-11-18 Shawn Betts <sabetts@vcn.bc.ca> - - * src/split.c (show_frame_message): handle the case when the frame - is empty. - -2006-11-17 Shawn Betts <sabetts@vcn.bc.ca> - - * src/bar.c (bar_y): take into account screen padding - (bar_x): likewise - - * src/split.c (show_frame_indicator): use defaults.frame_fmt - (show_frame_message): format frame_fmt string with format_string - - * src/messages.h (MESSAGE_FRAME_STRING): removed - - * src/main.c (init_defaults): init defaults.frame_fmt - - * src/data.h (struct rp_defaults): add frame_fmt - - * src/actions.c (set_framefmt): new function - (init_set_vars): new set var "framefmt" - -2006-10-03 Shawn Betts <sabetts@vcn.bc.ca> - - * src/events.c (handle_key): demote the 'no matching key' error to debug output. - - * src/main.c (strtok_ws): remove useless debug ouput. - -2006-09-26 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (initialize_default_keybindings): bind "swap" to C-t x and C-t C-x - -2006-09-26 Bernhard R. Link <brlink@debian.org> - - * src/actions.c (cmd_execa,cmd_execf): new functions - (spawn): new argument to set frame for client_info - (cmd_exec): give spawn current_frame() - (cmd_verbexec): give spawn current_frame() - (cmd_tmpwm): give spawn NULL - (init_user_commands): add execa and execf commands - - * src/actions.h (spawn): new argument added to prototype - (cmd_execa,cmd_execf): new prototypes - -2006-09-26 Bernhard R. Link <brlink@debian.org> - - * src/split.c, src/split.h: new function exchange_with_frame - - * src/actions.c, src/actions.h: add cmd_exchange_left,cmd_exchange_right,cmd_exchange_up,cmd_exchange_down, - add new keybindings C-Left,C-Right,C-Up,C-Down to those. - - * doc/ratpoison.1: document the new functions and keybindings. - -2006-09-26 Shawn Betts <sabetts@vcn.bc.ca> - - * src/frame.c (read_slot): use strtok_ws - (frame_read): likewise - - * src/actions.c (command): dont use strtok. manually pull out the - command and the rest. - - * src/main.c (strtok_ws): new function - - * src/manage.c (update_window_name): return 1 if anything changed. 0 otherwise. - - * src/events.c (property_notify): only update the window names if - the window name actually changed. - - * src/bar.h (redraw_last_message): new prototype - - * src/bar.c (update_bar): update the window list if that's what's - displayed. call redraw_last_message. - (update_window_names): call marked_message_internal. - (marked_message): call marked_message_internal. - (marked_message_internal): ripped body from old marked_message - minus alarm reset. - (redraw_last_message): new function - (show_last_message): call redraw_last_message - - * src/actions.c: include ctype.h - (cmd_license): use redraw_last_message - (cmd_help): likewise - -2006-08-27 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (parse_args): gobble spaces at the beginning of - the string. - (parse_args): use isspace to test for spaces - -2006-08-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/bar.c (prepare_bar): cap the width and height to the size of - the screen. - -2006-05-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (spawn): pass cmd twice to execcl - - * src/events.c (handle_signals): pass NULL to execlp - - * src/actions.c (spawn): pass NULL to execcl - - * src/xinerama.c (free_xinerama): take void arguments. prototype updated. - (init_xinerama): likewise - - * src/window.c (init_window_stuff): take void arguments. prototype updated. - (free_window_stuff): likewise - - * src/split.c (remove_all_splits): take void arguments. prototype updated. - (current_frame): likewise - (init_frame_lists): likewise - (find_last_frame): likewise - (current_window): likewise - (remove_all_splits): likewise - (hide_frame_indicator): likewise - (show_frame_indicator): likewise - - * src/main.c (check_child_procs): take void arguments. prototype updated. - (clean_up): likewise - - * src/number.c (numset_new): take void arguments. prototype updated. - - * src/manage.c (clear_unmanaged_list): take void arguments. prototype updated. - (list_unmanaged_windows): likewise - (ungrab_keys_all_wins): likewise - (grab_keys_all_wins): likewise - (current_screen): likewise - (unhide_all_windows): likewise - - * src/main.c (sighandler): static function - (hup_handler): likewise - (alrm_handler): likewise - (handler): likewise - (print_version): likewise - (print_help): likewise - (show_welcome_message): take void arguments - (init_defaults): likewise - - * src/input.c (ring_bell): take void arguments. prototype updated - (update_modifier_map): likewise - - * src/history.c (get_history_filename): take void arguments - (history_load): take void arguments. prototype updated - (history_save): likewise - (history_reset): likewise - (history_previous): likewise - (history_next): likewise - (history_list_items): likewise - - * src/group.c (group_in_list): static function - (init_groups): take void arguments. prototype updated - (free_groups): likewise - (group_next_group): likewise - (group_prev_group): likewise - - * src/globals.c (x_export_selection): take void arguments - (get_cut_buffer): likewise - (get_primary_selection): likewise - (get_selection): take void arguments. protype updated. - (init_globals): likewise - - * src/events.c (selection_clear): take void arguments - (handle_signals): likewise - (listen_for_events): take void argumens. prototype updated - - * src/bar.c (reset_alarm): take void arguments - (show_last_message): take void arguments. prototype updated. - (free_bar): likewise - - * src/actions.c (init_set_vars): static function. take void arguments - (clear_frame_redos): take void arguments - (pop_frame_undo): likewise - (pop_frame_redo): likewise - (keymap_new): static function - (parse_keydesc): likewise - (trivial_completions): likewise - (keymap_completions): likewise - (window_completions): likewise - (group_completions): likewise - (colon_completions): likewise - (exec_completions): likewise - (hook_completions): likewise - (var_completions): likewise - (update_all_gcs): take void arguments - (grab_rat): likewise - (ungrab_rat): likewise - (init_user_commands): take void arguments. prototype updated. - (free_keymaps): likewise - (free_aliases): likewise - -2006-05-21 Shawn Betts <sabetts@vcn.bc.ca> - - * src/conf.h (DEFAULT_FONT): changed - - * src/actions.c (command): return a cmdret structure if cmd is - NULL - -2006-05-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/manage.c (grab_top_level_keys): use defaults.top_kmap for the top kmap - - * src/main.c (init_defaults): init defaults.top_kmap - - * src/events.c (handle_key): use defaults.top_kmap for the top kmap - - * src/data.h (struct rp_defaults): new field, top_kmap - - * src/actions.c (set_topkmap): new prototype - (init_set_vars): topkmap new set variable - (initialize_default_keybindings): use defaults.top_kmap for the top kmap - (cmd_undefinekey): likewise - (cmd_definekey): likewise - (cmd_escape): likewise - (cmd_delkmap): likewise - (set_topkmap): new function - -2006-05-14 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (update_modifier_map): use XGetKeyboardMapping. - -2006-05-08 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/rpws (ws_init): loop from 1 not 0 - -2006-04-29 Shawn Betts <sabetts@vcn.bc.ca> - - * src/bar.c (marked_message): print NULL if msg is null in debug output - - * src/actions.c (cmd_getenv): return an empty string for - nonexistant env vars. - (command): print NULL if rest is null in debug output - -2006-04-21 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (print_version): print build date - -2006-04-20 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.h: new command sfrestore - - * src/actions.c (init_user_commands): new command sfrestore - (cmd_sfrestore): new function - -2006-04-19 Shawn Betts <sabetts@vcn.bc.ca> - - * src/events.c (property_notify): Only map the first window in the launch frame. - - * src/split.c (show_frame_message): use XmbDrawString and XmbTextEscapement - - * src/screen.c (init_screen): don't include the font in the gc - - * src/ratpoison.h: include Xlocale.h - - * src/manage.c (get_wmname): support i18n characters - - * src/main.c (init_defaults): call load_query_font_set and set_extents_of_fontset - (main): call setlocale - (clean_up): call XFreeFontSet - (set_extents_of_fontset): new function - (load_query_font_set): likewise - - * src/input.c (update_input_window): use XmbTextEscapement and XmbDrawString - - * src/globals.h (FONT_HEIGHT): use rp_font_ascent and rp_font_descent - (MAX_FONT_WIDTH): use rp_font_width - new globals rp_font_ascent, rp_font_descent, rp_font_width - - * src/globals.c: new globals rp_font_ascent, rp_font_descent, rp_font_width - - * src/data.h (struct rp_defaults): font is a XFontSet - - * src/bar.c (max_line_length): call XmbTextEscapement - (draw_string): call XmbDrawString - (get_mark_box): call XmbTextEscapement - - * src/actions.c (read_frame): call XmbTextEscapement - (cmd_license): likewise - (read_frame): call XmbDrawString - (cmd_license): likewise - (cmd_help): likewise - (update_gc): don't include the font - (set_font): call load_query_font_set - -2006-04-18 Shawn Betts <sabetts@vcn.bc.ca> - - * src/hook.c (hook_run): echo the result of each command. free the - result. - -2006-04-03 Shawn Betts <sabetts@vcn.bc.ca> - - * src/messages.h (MESSAGE_MAP_TRANSIENT_GROUP): new define - (MESSAGE_MAP_WINDOW_GROUP): likewise - - * src/manage.c (map_window): call show_rudeness_msg - - * src/events.h (show_rudeness_msg): new prototype - - * src/events.c (show_rudeness_msg): renamed from - show_rudeness_raise_msg. handle the MAP messages as well. all - callers updated. - -2006-04-02 Shawn Betts <sabetts@vcn.bc.ca> - - * 1.4.0 release - -2006-04-02 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/Makefile.am (pkgdata_DATA): add sloppy.c - (EXTRA_DIST): likewise - - * src/events.c (handle_key): call XAllowEvents - -2006-04-01 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (grab_key): grab the keyboard synchronously - - -2006-03-16 Ryan Yeske <rcyeske@gmail.com> - - * doc/ratpoison.texi (Groups): Fix description of gnew command. - -2006-03-15 Bernhard R. Link <brlink@debian.org> - - * src/screen.c (screen_update): new function - (init_screen): listen for screen resizes - * src/screen.h: new prototype - - * src/events.c (configure_notify): new function - (delegate_event): call configure_notify for ConfigureNotify events - - * src/frame.c (frame_dump): remember the size of the screen the - frame coordinates are relative to. - (frame_restore): adopt coordinates to possible screen resizes. - - * src/frame.h (frame_fump): take a screen argument - (frame_read): likewise - - * src/actions.c (cmd_tmpwm): listen for screen resizes again - (fdump, frestore, cmd_fdump): supply screen to frame_dump, frameread - -2006-03-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (clean_up): use list_size not rp_num_frame_undos - - * src/globals.c: remove global var rp_num_frame_undos. All callers updated. - - * src/actions.c (push_frame_undo): use list_size, not rp_num_frame_undos - (set_maxundos): likewise - - * src/window.c (_XOPEN_SOURCE): new define - - * src/screen.c (is_a_root_window): w is unsigned int - (init_screen): typecast _net_wm_pid as unsigned char*. - - * src/main.c (read_rc_file): linesize is size_t - - * src/frame.c (frame_read): use a temp var when reading the - :dedicated value. - - * src/bar.c (max_line_length): i and start are size_t - (draw_string): i is size_t - (get_mark_box): mark_start and mark_end are size_t - - * src/actions.c (find_keybinding): state is unsigned int - (remove_keybinding): likewise - (frame_selector): n is unsigned int - (frame_selector_match): i is size_t. typecast comparison as size_t. - - * src/bar.c (show_bar): accept a fmt argument. all callers and prototype updated. - (update_bar): just display the last message if bar isn't hidden. - (update_window_names): accept a fmt argument. all callers and prototype updated. - - * src/actions.c (init_user_commands): add optional argument to "info" - (cmd_info): handle optional argument - (cmd_windows): when called interactively use the argument as the format string. - -2006-03-14 Antti Nykдnen <aon@iki.fi> - - * src/format.c: new file - - * src/format.h: new file - - * Makefile.am (ratpoison_SOURCES): add format.c and format.h - - * src/actions.c (set_infofmt): new function - (wingravity_to_string): char * instead of static char * because needed in format.c - (cmd_info): use format_string - - * src/actions.h (wingravity_to_string): add prototype - - * src/data.h (info_fmt): new variable - - * src/main.c (init_defaults): set a value for defaults.info_fmt - - * src/ratpoison.h: include format.h - - * src/windows.c (get_window_list): use format_string - (isdigit): remove function as the formatting is now done in format.c - (concat_width): likewise - (format_window_name): likewise - -2006-03-14 Shawn Betts <sabetts@vcn.bc.ca> - - * src/manage.c (ungrab_top_level_keys): unconditionally ungrab every key. - - * src/events.c (mapping_notify): call ungrab_keys_all_wins and grab_keys_all_wins. - -2006-04-10 Bernhard R. Link <brlink@debian.org> - - * src/manage.c (maximize_transient,maximize_normal): - avoid divide by zero when resize increment is 0. - -2006-03-07 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (clean_up): properly free rp_frame_numset - - * src/editor.c (editor_enter): free line->buffer before setting it to the history expansion. - - * src/completions.c (completions_free): free the rp_completions struct too - - * src/actions.c (del_frame_undo): free the rp_frame_undo struct too. - -2006-02-26 Shawn Betts <sabetts@vcn.bc.ca> - - * src/editor.c (editor_insert): use memmove to make room for - inserted string. - - * src/window.c (add_to_window_list): only change the window's - group and frame if window_mapped is 0. - - * src/data.h (struct rp_child_info): new field window_mapped - - * src/actions.c (spawn): init window_mapped field in child_info. - -2006-01-18 Bernhard R. Link <brlink@debian.org> - - * src/events.c: look for _NET_WM_PID notify events and adopt the - intended frame number accordingly. - - * src/window.c, src/window.h: make get_child_info accessible from - events.c - -2006-01-04 Shawn Betts <sabetts@vcn.bc.ca> - - * src/conf.h (ASPECT_WINDOWS_ARE_TRANSIENTS): new define - - * src/manage.c (window_is_transient): new function - (maximize_normal): honour aspect ratio hint - - * src/window.c (update_window_gravity): use maxsize_gravity for windows with aspect hints. - (set_active_window_body): call window_is_transient - - * src/split.c (cleanup_frame): call window_is_transient - -2006-01-03 Shawn Betts <sabetts@vcn.bc.ca> - - * src/number.c (numset_add_num): store the ret val of - numset_find_empty_cell in a variable and use it as an index into - the numbers_taken array. - - * src/actions.c (cmd_curframe): return the frame number in - non-interactive mode. - - * src/split.c (cleanup_frame): in the maxsize windows are - transients check either the width or height must be less than the - screen width/height (just like in windows.c). - -2005-12-11 Shawn Betts <sabetts@shitbender.gagrod> - - * src/manage.c (withdraw_window): call rp_delete_window_hook hook - - * src/globals.c: new hook rp_delete_window_hook - -2005-11-05 Shawn Betts <sabetts@shitbender.gagrod> - - * src/events.c (handle_signals): xsync after hiding all windows - - * src/manage.h (unhide_all_windows): new prototype - - * src/manage.c (unhide_all_windows): new function. - - * src/events.c (handle_signals): unhide windows before switching to a new wm - -2005-10-22 Shawn Betts <sabetts@shitbender.gagrod> - - * src/window.c (get_mouse_position): renamed from - get_mouse_root_position. get pos relative to window. - -2005-10-20 Shawn Betts <sabetts@shitbender.gagrod> - - * src/window.c: include unistd.h - (get_child_info): new function - (add_to_window_list): get the window's client's pid if possible - and assign the window the appropriate group and frame. - (add_to_window_list): init intended_frame_number - (save_mouse_position): save the position relative to the window - (give_window_focus): restore the position relative to the window - (set_active_window_body): put the window in the frame contained in - intended_frame_number when appropriate. - - * src/screen.c (screen_find_frame_by_frame): new function - (init_screen): add the net_supported atom to the root window. - - * src/main.c (main): init netwm atoms - - * src/group.c (groups_find_group_by_group): new function - - * src/globals.c (_net_wm_pid, _net_supported): new globals - - * src/data.h (struct rp_window): new field intended_frame_number. - (struct rp_child_info): new fields group, frame, screen. - - * src/actions.c (spawn): call the command directly when new - argument, raw, is non zero. all callers updated. - (spawn): fill in the frame, group and screen for the child. - -2005-10-14 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_describekey): print the key name even when it's bound. - -2005-08-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_addhook): remove erroneous call to free. - - * contrib/Makefile.am (pkgdata_DATA): add unrat.c - (EXTRA_DIST): likewise - -2005-06-13 Shawn Betts <sabetts@shitbender.gagrod> - - * src/editor.c (edit_bindings): add C-h and C-m - -2005-06-11 Shawn Betts <sabetts@shitbender.gagrod> - - * src/main.c (clean_up): call del_frame_undo not pop_frame_undo - - * src/globals.h: new global prototype rp_frame_redos - - * src/globals.c: new global rp_frame_redos - - * src/actions.h: new command 'undo' - (del_frame_undo): new prototype - (pop_frame_undo): delete prototype - - * src/actions.c (init_user_commands): new command 'undo' - (clear_frame_redos): new function - (del_frame_undo): likewise - (push_frame_undo): call del_frame_undo instead of pop_frame_undo. call clear_frame_redos. - (pop_frame_list): new function - (pop_frame_undo): returns the popped frame. all callers updated. - (pop_frame_redo): new function - (initialize_default_keybindings): bind undo to u and C-u, bind redo to U. - (set_maxundos): call del_frame_undo instead of pop_frame_redo - (cmd_redo): new function - -2005-06-11 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.h: remove the non-existant command, last. - - * src/window.c (isdigit): new function - (format_window_name): read a length argument and crop window names to that length. - (get_window_list): length argument applies to %c and %a. - - * src/actions.c (cmd_tmpwm): stop waiting for the child if waitpid - produced an error. - -2005-04-17 Shawn <sabetts@vcn.bc.ca> - - * src/actions.h: new prototype compat - - * src/actions.c (initialize_default_keybindings): move def* aliases to cmd_compat - (cmd_compat): new function - - * src/messages.h (MESSAGE_RAISE_TRANSIENT_GROUP): new define - (MESSAGE_RAISE_WINDOW_GROUP): likewise - - * src/group.h (groups_find_group_by_window): new prototype - - * src/group.c (groups_find_group_by_window): new function. - - * src/events.c (show_rudeness_raise_msg): new function - (map_request): call show_rudeness_raise_msg - (configure_request): likewise - -2005-04-12 Shawn <katia_dilkina@verizon.net> - - * contrib/rpws: Replace with Mike O'Connor's perl version. - -2005-04-10 Shawn <sabetts@vcn.bc.ca> - - * src/actions.c (cmdret_new): malloc enough for the cmdret structure. - -2005-04-09 Shawn <sabetts@monk.lamenet> - - * src/actions.c (init_user_commands): add KEY argument to meta - command. - (cmd_meta): optionally use the KEY passed in as an argument. - (cmd_set): pass the string produced when no args are passid in to - cmdret_new using "%s". - (cmd_windows): return the string using "%s" in call to cmdret_new. - (cmd_help): likewise. - (cmd_gravity): likewise - (cmd_getenv): likewise - (cmd_fdump): likewise - (cmd_groups): likewise - (cmd_listhook): likewise - (cmd_sfdump): likewise - (cmd_sdump): likewise - (cmd_describekey): likewise - (cmd_prompt): likewise - (cmd_getsel): likewise - (cmd_unmanage): likewise - (cmd_prev): likewise - (cmd_prev_frame): likewise - (cmd_next): likewise - (cmd_next_frame): likewise - (cmd_other): likewise - (cmd_version): likewise - (cmd_time): likewise - (cmd_cnext): likewise - (cmd_cprev): likewise - (cmd_inext): likewise - (cmd_iprev): likewise - (cmd_cother): likewise - (cmd_iother): likewise - -2005-03-05 <sabetts@localhost> - - * src/ratpoison.h (check_child_procs): new prototype - (chld_handler): likewise - (set_sig_handler): likewise - - * src/main.c (check_child_procs): new function - (chld_handler): call check_child_procs - (free_screen): unselect all events on the root window. - - * src/actions.c: include signal.h - (spawn): don't prefix the command with exec. - (set_wingravity): print the setting as a string. - (set_transgravity): likewise - (set_maxsizegravity): likewise - (set_bargravity): likewise - (set_font): likewise - (set_winfmt): likewise - (set_fgcolor): likewise - (set_bgcolor): likewise - (set_framesels): likewise - (cmd_tmpwm): ungrab the keys for all windows before spawning the - new wm. - (cmd_tmpwm): disable the sigchld handler then enabled it after the - wm returns. call check_child_procs. - - -2005-02-26 <sabetts@localhost> - - * src/actions.c (parse_args): properly check if we've hit the arg - limit. - -2005-02-22 sabetts <sabetts@apeguts> - - * src/main.c (read_startup_files): use xsprintf when generating - path to ratpoisonrc. - - * src/input.c (get_more_input): Use HAVE_HISTORY to ifdef out - history_reset. - - * src/actions.c (command): new variable, raw, which records - whether to tell parse_args not to parse the last arg. - (cmd_set): likewise - -2005-02-10 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (parse_keydesc): return a cmdret error in the - event of an error and take a point to an rp_key as an - argument. Fill this argument with the parsed key. - (parse_keydesc): Don't accept the keysym if it doesn't map to a - keycode. - (cmdret_new): renamed from cmdret_new_printf. All callers updated. - (cmdret_new_printf): remove function. - (arg_free): free the key member. - -2005-02-09 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (main): set the RATPOISON env. variable to the path - to this executable. - -2005-02-06 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_prompt): allow prompt to be run - interactively. - -2005-02-04 Shawn Betts <sabetts@vcn.bc.ca> - - * configure.in: bump version to 1.4.0-CVS. - -2005-02-04 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (set_winname): return the cmdret created. - (cmd_unalias): likewise - (cmd_nextscreen): likewise - (cmd_prevscreen): likewise - (cmd_gdelete): likewise - -2005-01-30 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_escape): when the escape key doesn't have a - modifier give the meta key a modifier. - (cmd_undefinekey): call XSync after ungrabbing and grabbing all - keys. - -2005-01-22 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.h (argtype): add arg_RAW - - * src/actions.c (init_user_commands): make unmanage'd argument - optional when called non-interactively. - (init_user_commands): "title" accepts 1 argument. - (init_user_commands): "echo" and "putsel" take a raw argument. - (read_arg): parse arg_RAW - (parse_args): take a raw argument. gobble whitespace when we've - hit nargs and raw is false. callers updated. - (command): don't gobble whitespace after reading the command. set - nargs when the argtype is arg_RAW, too. - (cmd_set): set nargs when the argtype is arg_RAW, too. - -2005-01-20 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (init_user_commands): fix unmanage command. - -2005-01-19 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/genrpbindings: add python bindings. - -2005-01-17 Shawn Betts <sabetts@vcn.bc.ca> - - * src/frame.c (frame_read): remove space in "(frame " string. - -2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (spawn): Prepend cmd with exec. - -2004-01-15 Bernhard R. Link <brlink@debian.org> - - * actions.c (cmd_focusleft,cmd_focusright,cmd_focusup,cmd_focusdown): show - currectframe if movement not possible. - -2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/frame.c (frame_read): correctly determine if the input - starts with "(frame ". - -2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_prev): return a cmdret*. same for error - messages. - (cmd_select): likewise. - (command): use cmdret* to report when alias recursion has hit the - limit. - (cmd_resize): return a cmdret when num frames is < 2. - (set_padding): return a cmdret*, not NULL. - (cmd_nextscreen): likewise - (cmd_prevscreen): likewise - (cmd_addhook): likewise - - * src/main.c (main): Report extra unparsed arguments. - - * src/actions.c (init_user_commands): set the last argument of the - following commands to arg_REST: addhook, chdir, remhook, source, - tmpwm, and prompt. - (command): check list_size of head when checking for too many - arguments. - (cmd_set): raise error if set command was passed too many - arguments. - -2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (init_user_commands): change select's argument to - arg_REST. - - * configure.in: add AM_MAINTAINER_MODE - - * src/globals.h (rp_exec_newwm): new extern. - - * src/globals.c (rp_exec_newwm): new global. - - * src/actions.c (cmd_newwm): set rp_exec_newwm to the new wm. - - * src/events.c (listen_for_events): call XSync after - delegate_event. - (handle_signals): exec newwm if its not NULL. Report X11 errors - (moved from listen_for_events). - -2005-01-15 Ryan Yeske <rcyeske@gmail.com> - - * src/editor.c (saved_command): Only define whe HAVE_HISTORY is - defined. - -2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (command): treat arg_SHELLCMD like arg_REST. - (cmd_set): likewise - - * src/globals.h (RET_SUCCESS): set to 1 - (RET_FAILURE): set to 0 - - * src/communications.c (receive_command_result) - (receive_command_result): fix error deciding when to print to - stderr. - -2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (parse_args): remove erroneous pointer dereference - of i when gobbling whitespace. - (init_user_commands): set second argument to "alias" command to - arg_REST. - (init_user_commands): likewise for "set" - (cmd_readkey): remove useless PRINT_DEBUG - (cmd_set): pass an empty string to parse_args when the args[1] is - NULL. - (cmd_set): call the set function if the arg list size is 0. - -2005-01-14 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (init_defaults): turn off warp by default. - -2005-01-14 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (ARG_STRING): new define - (ARG): likewise - (set_vars): change to a list_head. - (add_set_var): new function - (init_set_vars): likewise - (user_commands): change to a list_head. Move command definitions - to init_user_commands. - (add_command): new function - (init_user_commands): likewise - (cmdret_new): likewise - (cmdret_new_printf): likewise - (cmdret_free): likewise - (read_string): likewise - (read_keymap): likewise - (read_keydesc): likewise - (read_command): likewise - (read_shellcmd): likewise - (read_frame): likewise - (read_window): likewise - (read_gravity): likewise - (read_group): likewise - (read_hook): likewise - (read_variable): likewise - (hook_completions): likewise - (read_number): likewise - (read_arg): likewise - (parsed_input_to_args): likewise - (fill_in_missing_args): likewise - (parse_args): likewise - (arg_array): likewise - (arg_free): likewise - (command): use parse_args, parsed_input_to_args, - fill_in_missing_args to parse arguments and pass to command - functions. - (command): return cmdret* structure. prototype updated. - (cmd_abort): second arg is an array of struct cmdarg*. Return - cmdret*. Updated to use new parsed arguments. - (cmd_addhook): likewise - (cmd_alias): likewise - (cmd_banish): likewise - (cmd_bind): likewise - (cmd_chdir): likewise - (cmd_clrunmanaged): likewise - (cmd_colon): likewise - (cmd_curframe): likewise - (cmd_delete): likewise - (cmd_echo): likewise - (cmd_escape): likewise - (cmd_exec): likewise - (cmd_fdump): likewise - (cmd_focusdown): likewise - (cmd_focuslast): likewise - (cmd_focusleft): likewise - (cmd_focusright): likewise - (cmd_focusup): likewise - (cmd_frestore): likewise - (cmd_fselect): likewise - (cmd_gdelete): likewise - (cmd_getenv): likewise - (cmd_gmerge): likewise - (cmd_gmove): likewise - (cmd_gnew): likewise - (cmd_gnewbg): likewise - (cmd_gnext): likewise - (cmd_gprev): likewise - (cmd_gravity): likewise - (cmd_groups): likewise - (cmd_gselect): likewise - (cmd_h_split): likewise - (cmd_help): likewise - (cmd_info): likewise - (cmd_kill): likewise - (cmd_last): likewise - (cmd_lastmsg): likewise - (cmd_license): likewise - (cmd_link): likewise - (cmd_listhook): likewise - (cmd_meta): likewise - (cmd_msgwait): likewise - (cmd_newwm): likewise - (cmd_next): likewise - (cmd_next_frame): likewise - (cmd_nextscreen): likewise - (cmd_number): likewise - (cmd_only): likewise - (cmd_other): likewise - (cmd_prev): likewise - (cmd_prev_frame): likewise - (cmd_prevscreen): likewise - (cmd_quit): likewise - (cmd_redisplay): likewise - (cmd_remhook): likewise - (cmd_remove): likewise - (cmd_rename): likewise - (cmd_resize): likewise - (cmd_restart): likewise - (cmd_rudeness): likewise - (cmd_select): likewise - (cmd_setenv): likewise - (cmd_shrink): likewise - (cmd_source): likewise - (cmd_startup_message): likewise - (cmd_time): likewise - (cmd_tmpwm): likewise - (cmd_unalias): likewise - (cmd_unbind): likewise - (cmd_unimplemented): likewise - (cmd_unmanage): likewise - (cmd_unsetenv): likewise - (cmd_v_split): likewise - (cmd_verbexec): likewise - (cmd_version): likewise - (cmd_warp): likewise - (cmd_windows): likewise - (cmd_readkey): likewise - (cmd_newkmap): likewise - (cmd_delkmap): likewise - (cmd_definekey): likewise - (cmd_undefinekey): likewise - (cmd_set): likewise - (cmd_sselect): likewise - (cmd_ratwarp): likewise - (cmd_ratclick): likewise - (cmd_ratrelwarp): likewise - (cmd_rathold): likewise - (cmd_cnext): likewise - (cmd_cother): likewise - (cmd_cprev): likewise - (cmd_dedicate): likewise - (cmd_describekey): likewise - (cmd_inext): likewise - (cmd_iother): likewise - (cmd_iprev): likewise - (cmd_prompt): likewise - (cmd_sdump): likewise - (cmd_sfdump): likewise - (cmd_undo): likewise - (cmd_putsel): likewise - (cmd_getsel): likewise - (set_resizeunit): arg is an array of struct cmdarg*. Return - cmdret*. Updated to use new parsed arguments. - (set_wingravity): likewise - (set_transgravity): likewise - (set_maxsizegravity): likewise - (set_bargravity): likewise - (set_font): likewise - (set_padding): likewise - (set_border): likewise - (set_barborder): likewise - (set_inputwidth): likewise - (set_waitcursor): likewise - (set_winfmt): likewise - (set_winname): likewise - (set_fgcolor): likewise - (set_bgcolor): likewise - (set_barpadding): likewise - (set_winliststyle): likewise - (set_framesels): likewise - (set_maxundos): likewise - - * src/actions.h: include ratpoison.h - (argtype): add arg_FRAME, arg_WINDOW, arg_COMMAND, arg_SHELLCMD, - arg_KEYMAP, arg_KEY, arg_GRAVITY, arg_GROUP, arg_HOOK, - arg_VARIABLE. - (union arg_union): new union - (struct cmdarg): new struct - (struct argspec): likewise - (struct cmdret): likewise - (user_command): change func to reflect new command function - args. add num_args, ni_required_args, i_required_args. - (RP_CMD): new macro for prototyping command functions. all command - function prototypes updated to use this macro. - (init_user_commands): new prototype - (cmdret_free): likewise - - * src/main.c (read_rc_file): handle cmdret* returned by command. - (main): call init_user_commands - - * src/linkedlist.h (list_size): new prototype - - * src/linkedlist.c (list_size): new function - - * src/globals.h (RET_SUCCESS): new define - (RET_FAILURE): new define - - * src/events.c (handle_key): handle the cmdret structure returned - by command. - (execute_remote_command): return cmdret*. - (receive_command): mark the command return string as error or - output before sending. - - * src/data.h (struct rp_action): change data element type to char* - - * src/communications.c (receive_command_result): print command - output to stderr if marked as an error. - -2005-01-04 Ryan Yeske <rcyeske@gmail.com> - - * src/actions.c (cmd_rudeness): Print rudeness to bar when called - interactively. - -2005-01-03 Ryan Yeske <rcyeske@gmail.com> - - * src/main.c (print_help): Update mailing list. - - * src/actions.c (cmd_license): Update mailing list and website. - -2005-01-14 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/genrpbindings: fix regex to match new actions.c format. - -2004-12-12 Shawn Betts <sabetts@vcn.bc.ca> - - * src/sbuf.c (sbuf_concat): call sbuf_nconcat. move bulk of body - to sbuf_nconcat. - (sbuf_nconcat): new function - - * src/globals.c (init_globals): new function - - * src/main.c (main): call init_globals. - - * src/globals.c: include unistd.h. - (x_export_selection): new function - (set_nselection): likewise - (set_selection): call x_export_selection - (get_cut_buffer): new function - (get_primary_selection): likewise - (get_selection): likewise - - * src/editor.c (editor_kill_word): add the deleted text to the X11 - selection - (editor_backward_kill_word): likewise - (editor_kill_line): likewise - (backward_kill_line): new fuction - (editor_backward_kill_line): add the deleted text to the X11 - selection. call backward_kill_line. - (paste_cut_buffer): remove function - (paste_primary_selection): likewise - (editor_paste_selection): call get_selection to get the X11 - selection. - (editor_complete): call backward_kill_line instead of - editor_backward_kill_line. - - * src/ratpoison.h: Include string.h. Include X11/XAtom.h. - - * src/globals.c (selection): new global - (set_selection): new function - - * src/events.c: include X11/Xmd.h - (selection_request): new function - (selection_clear): new function - (delegate_event): call selection_request and selection_clear for - SelectionRequest and SelectionClear events. - - * src/actions.c (user_commands): remove duplicate focusprev entry. Add putsel. Add getsel. - (cmd_putsel): new function - (cmd_getsel): new function - - * contrib/genrpbindings: add a missing paren to the elisp bindings. - -2004-12-12 Ryan Yeske <rcyeske@gmail.com> - - * MERCHANDISE: Add file. - -2004-12-09 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_unmanage): fix message formatting - (cmd_ratwarp): likewise - (cmd_ratrelwarp): likewise - (cmd_ratclick): likewise - (cmd_rathold): likewise - (cmd_unsetenv): likewise - (set_barpadding): likewise - (cmd_fselect): likewise - (cmd_addhook): likewise - (cmd_remhook): likewise - (cmd_listhook): likewise - (cmd_gdelete): likewise - (cmd_readkey): likewise - (cmd_newkmap): likewise - (cmd_delkmap): likewise - (cmd_describekey): likewise - - * src/messages.h (MESSAGE_NO_OTHER_WINDOW): remove padding spaces - (MESSAGE_NO_OTHER_FRAME): likewise - (MESSAGE_NO_MANAGED_WINDOWS): likewise - (MESSAGE_UNKNOWN_COMMAND): likewise - (MESSAGE_WINDOW_INFORMATION): likewise - (MESSAGE_RAISE_TRANSIENT): likewise - (MESSAGE_RAISE_WINDOW): likewise - (MESSAGE_MAP_TRANSIENT): likewise - (MESSAGE_MAP_WINDOW): likewise - (MESSAGE_WELCOME): likewise - (MESSAGE_FRAME_STRING): likewise - - * src/main.c (init_defaults): set bar_x_padding to 4 - - * src/events.c (handle_signals): Remove padding space on all calls - to message and marked_message_printf. - - * src/editor.c (editor_enter): Remove padding space on all calls - to message and marked_message_printf. - - * src/actions.c: Remove padding space on all calls to message and - marked_message_printf. - - * src/bar.c (get_mark_box): make the mark extend to the edge of - the box regardless of the bar padding. - -2004-12-08 Shawn Betts <sabetts@vcn.bc.ca> - - * src/events.c (destroy_window): make sure the current screen is - the windows screen before calling set_active_frame. - (unmap_notify): likewise - - * src/actions.c (frestore): use strtok_r. - -2004-12-06 Shawn Betts <sabetts@vcn.bc.ca> - - * src/manage.c (unmanage): remove call to numset_release. - -2004-12-04 Shawn Betts <sabetts@vcn.bc.ca> - - * src/frame.c (frame_dump): use a hyphen instead of underscore for - f->last_access. - -2004-11-22 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_verbexec): rewritten to fix crash bug. - -2004-11-20 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_rathold): change argument order. echo parse - errors. - -2004-11-19 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_sfdump): properly declare i at the top of the - function. - - * src/frame.c (frame_dump): dump the frame as an sexpr instead of - a list of numbers. - (frame_read): read the new frame dump format - (init_frame): new static function - (frame_new): call init_frame - (frame_read): likewise - - * src/actions.c (cmd_describekey): fix error messages. - -2004-11-18 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (set_vars): add maxundos - (push_frame_undo): new function - (pop_frame_undo): likewise - (initialize_default_keybindings): add binding for "undo" - (initialize_default_keybindings): add def alias for maxundos - (cmd_other): call set_active_window_force instead of - set_active_window - (cmd_v_split): push the frame set - (cmd_h_split): likewise - (cmd_only): likewise - (cmd_remove): likewise - (cmd_shrink): likewise - (cmd_tmpwm): likewise - (cmd_license): update copyright. Add build date and time. - (cmd_fselect): simplify code that returns the frame selected. - (fdump): new function - (cmd_fdump): call fdump to dump the screen's frame set. - (frestore): new function - (cmd_frestore): call frestore to restore the screen's frame set. - (cmd_sfdump): new function - (cmd_sdump): likewise - (set_maxundos): likewise - (cmd_cnext): likewise - (cmd_cprev): likewise - (cmd_inext): likewise - (cmd_iprev): likewise - (cmd_cother): likewise - (cmd_iother): likewise - (cmd_undo): likewise - (cmd_prompt): likewise - (cmd_describekey): likewise - (cmd_dedicate): likewise - - * src/main.c (init_defaults): init maxundos to 20 - (clean_up): free the undo history lists - - * src/window.h (set_active_window_body): new function - (set_active_window_force): likewise - - * src/window.c (set_active_window): new function - (set_active_window_force): likewise - (set_active_window_body): renamed from set_active_window - (set_active_window_body): Add code to handle dedicated frames. - - - * src/screen.h (screen_dump): new prototype - - * src/screen.c (screen_dump): new function - - * src/linkedlist.h (list_last): new macro - - * src/group.h (group_last_window_by_class_complement): new prototype - (group_last_window_by_class): likewise - - * src/group.c (group_last_window_by_class): new function - (group_last_window_by_class_complement): likewise - - * src/globals.h (rp_frame_undos): new extern. - (rp_num_frame_undos): likewise - - * src/globals.c (rp_frame_undos): new list. - (rp_num_frame_undos): new global - - * src/frame.c (frame_new): init f->dedicated to 0. - - * src/data.h (struct rp_frame): add dedicated member. - (struct rp_defaults): add maxundos member. - (struct rp_frame_undo): new struct. - - * src/actions.c: new commands, cnext, cother, cprev, - - * src/window.c (print_window_information): add argument, - group. print the window's number in the group. All callers - updated. - - * src/actions.c (cmd_info): print the window's number in the - current group. - - * src/window.c (unhide_transient_for): add a newline to debugging - output. - (hide_transient_for_between): likewise. - - * src/manage.c (get_wmname): typecast name when passing to - xstrdup. - - * src/main.c (main): typecast command[i] when passing to - send_command. - - * src/events.c (execute_remote_command): typecast req[1] when - passing to command. - (receive_command): typecast result when passing to - XChangeProperty. - - * src/editor.c (editor_history_previous): Add newline to - debugging output. - (editor_history_next): likewise. - (paste_primary_selection): typecast data when passing to editor_insert. - - * src/communications.c (receive_command_result): typecast result - when passing to strlen. - (send_command): typecast cmd when passing the XChangeProperty. - - * src/actions.c (user_commands): add focusprev - (cmd_prev): clean up - (cmd_next): likewise - (cmd_prev_frame): call find_frame_prev instead of find_frame_next. - (cmd_frestore): grab the frame's number first when processing the - frames. - -2004-11-17 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (user_commands): add rathold - -2004-11-17 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_rathold): new function - -2004-11-17 Bernhard R. Link <brlink@debian.org> - - * src/actions.c: (initialize_default_keybindings): Added - default keybindings for focusleft,fcousup,focusright,focusdown. - (cmd_resize): Added support for multiple keybindings - per action. Added arrow keys, escape and vi-like h,j,k,l - to the keys used for resizing. - - * doc/ratpoison.1: Documented C-t arrow key - * doc/ratpoison.texi: Documented C-t arrow key, - fixed description of C-t f - -2004-11-17 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/rpws: use env to find out where bash is - -2004-11-11 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/genrpbindings: fix up path to ratpoison binary - - * src/actions.c (cmd_ratclick): new function - (cmd_ratrelwarp): likewise - (cmd_ratwarp): likewise - (user_commands): new commands ratclick, ratrelwarp, ratwarp. - - * contrib/genrpbindings: add common lisp bindings - -2004-11-03 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (get_more_input): call history_reset - - * src/history.c (history_load): remove call to using_history. - (history_save): likewise - (history_add): likewise - -2004-11-02 Shawn Betts <sabetts@vcn.bc.ca> - - * src/split.c (blank_frame): use the frames screen, not the current screen. - - * src/group.c (group_last_window): add argument, the screen to find the - window in. All callers updated. - (group_prev_window): make sure the matched window is in the same - screen as win. - (group_next_window): likewise - - * src/window.c (find_window_other): add argument, the screen to - find the window in. All callers updated. - -2004-10-29 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/rpws: remove the echo /tmp/boom line. - -2004-10-28 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (set_padding): fix the padding order in xsprintf. - -2002-02-05 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_set): check if var is NULL before checking strlen(var) - -2004-10-07 Shawn Betts <sabetts@vcn.bc.ca> - - * doc/ratpoison.texi (Frame Numbering): new topic - -2004-07-24 Thien-Thi Nguyen <ttn@glug.org> - - * autogen.sh: Handle "-f" option. Add usage comment. - -2004-10-05 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_unsetenv): add an '=' to the string passed to - putenv. - (cmd_source): display an error message if no file is supplied. - - * src/main.c (print_version): update copyright date. - - * src/conf.h (DEFAULT_FONT): new define - - * src/main.c (init_defaults): use the DEFAULT_FONT define - - * src/actions.c: new command, sselect - (cmd_sselect): new function. added prototype. - (cmd_set): free 'var' at the appropriate places. - (cmd_version): add the build date and time. - (cmd_fselect): in interactive mode, return 'abort' when the user - aborts, the frame number when they select one, or 'No such frame' - when they selected a nonexistent one. - (cmd_version): return the version string in non-interactive mode. - (parse_wingravity): accept numbers for gravity. - - * src/events.c (property_notify): pass the root window to - receive_command. - (receive_command): take a root window as an argument and use it to - listen for the command. - -2004-10-04 Shawn Betts <sabetts@vcn.bc.ca> - - * src/screen.h (is_a_root_window): new prototype - - * src/screen.c (is_a_root_window): new function - - * src/events.c (property_notify): check for ratpoison commands on - every root window, not just the default root window. - - * src/communications.c (send_command): store the root window in a - variable, root. and use it whenever the root window is needed. - -2004-09-29 Shawn Betts <sabetts@vcn.bc.ca> - - * configure.in: Warn when the history header or library is not - found and compile without history support. - - * src/ratpoison.h: change ifdef to check for HAVE_HISTORY. - - * src/manage.c (get_state): change data to an unsigned char and - cast data to a long* when it's used. - - * src/main.c (main): change ifdef to check for HAVE_HISTORY. - (clean_up): likewise - - * src/history.c: change ifdef to check for HAVE_HISTORY. - - * src/events.c (receive_command): make prop_return an unsigned char. - - * src/editor.c (editor_history_previous): change ifdef to check for HAVE_HISTORY. - (editor_history_next): likewise - (editor_enter): likewise - -2004-09-27 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/ratpoison.el (ratpoison-command): use call-process. - -2004-06-13 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (init_defaults): set default for window list style to - column. - -2004-06-03 Shawn Betts <sabetts@vcn.bc.ca> - - * src/number.c (numset_add_num): add debugging output to print the args. - (numset_release): likewise - (numset_request): add debugging output to print the requested number - - - * src/manage.c (withdraw_window): Print an error when withdrawing - a window who's number is -1. - - * src/main.c (clean_up): free the global frame numset. - (free_screen): don't free the screen's numset, since it's a - pointer to the global numset. - - * src/group.c (group_del_window): don't release the window number - here. It's already been done in group_unmap_window. - - * src/events.c (configure_request): only change the stack mode for - non withdrawn windows. - -2004-05-19 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (rp_mask_to_x11_mask): handle the shift modifier - (x11_mask_to_rp_mask): likewise - (keysym_to_keycode_mod): Make sure lower != keysym before adding - the shift mask. - (keysym_to_string): handle the shift modifier. use 's' for super - instead of 'S' - (cook_keycode): keep the shift modifier if XLookupString didn't - gobble it. - - * src/data.h (RP_SHIFT_MASK): new define - - * src/actions.c (parse_keydesc): parse the shift modifier change - super to 's' from 'S'. - - * src/window.c (format_window_name): add %f format option - -2004-05-05 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (grab_key): use keysym_to_keycode_mod to get the - keycode and modifier for the keysym. - (keysym_to_keycode_mod): new function - -2004-04-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/data.h (struct rp_defaults): new members, font_string, - fgcolor_string, bgcolor_string. - - * src/actions.c (set_font): return defaults.font_string when data is NULL - (set_fgcolor): likewise for fgcolor_string - (set_bgcolor): likewise for bgcolor_string - - * src/manage.c (ungrab_top_level_keys): properly grab capital letters. - - * src/main.c (init_defaults): init fgcolor_string, bgcolor_string, and font_string - - * src/input.c (grab_key): change keysym type to KeySym. convert - keysym to keycode. All callers updated. - -2004-04-18 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_set): if non-interactive and no arguments are - specified, then output the current value of all variables. - - * src/messages.h (MESSAGE_PROMPT_SELECT_VAR): new define - (MESSAGE_PROMPT_VAR_VALUE): likewise - - * src/actions.h (cmd_set): new prototype - - * src/actions.c (user_commands): remove all def* commands. Add 'set' command. - rename all cmd_def* commands to set_*. Add prototypes for set_* commands. - (struct set_var): new struct - (set_vars): new static global - (cmd_set): new function - (var_completions): new function - (initialize_default_keybindings): add aliases for def* commands - - * src/events.c (configure_request): only display a raise request - if the window isn't already focused. - - * src/manage.h (ungrab_keys_all_wins): new prototype - (grab_keys_all_wins): likewise - - * src/manage.c (grab_top_level_keys): renamed from - grab_prefix_key (all callers updated). Grab all keys in the top level keymap. - (ungrab_top_level_keys): renamed from ungrab_prefix_key (all callers updated). ungrab - all keys in the top level keymap. - (ungrab_keys_all_wins): new function - (grab_keys_all_wins): likewise - - * src/globals.c: (rp_key_hook): rename from - rp_prefix_hook. Dependant code updated. - (set_rp_window_focus): change 'prefix' hook to 'key' hook. - - * src/events.c (handle_key): handle a top level key press. - (handle_key): new arguments ks, and mod. - (key_press): pass the keysym and modifier to handle_key - - * src/conf.h (TOP_KEYMAP): new define - - * src/actions.c (cmd_v_split, cmd_h_split): swap names. - (user_commands): bind split to cmd_v_split. - (initialize_default_keybindings): initialize the top level keymap - (cmd_definekey): update the keys grabbed when changing a key on - the top level keymap. - (cmd_escape): update the escape key in the top level map. - (cmd_delkmap): don't allow the deletion of the top level keymap. - -2004-04-03 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (init_defaults): init frame_selectors. - - * src/data.h (struct rp_defaults): new field, frame_selectors. - - * src/actions.h (cmd_defframesels): new prototype - - * src/actions.c (user_commands): new command defframesels - (frame_selector): new function - (frame_selector_match): likewise - (cmd_defframesels): likewise - (cmd_fselect): use default.frame_selectors to select a frame. - -2004-03-01 Shawn Betts <sabetts@vcn.bc.ca> - - * configure.in: fix check for Xinerama.h - -2004-02-27 Shawn Betts <sabetts@vcn.bc.ca> - - * src/screen.c (screen_free_nums): new function. prototype added - (init_screens): init rp_frame_numset - (init_screen): set screen's frames_numset to rp_frame_numset - - * src/globals.h: new global prototype, rp_frame_numset - - * src/globals.c: new global, rp_frame_numset - - * src/split.c (find_last_frame): find the last from of all the - screens. prototype updated. Callers updated. - (find_frame_number): search all screens. prototype - updated. callers updated. - - * src/actions.c (cmd_fselect): select from frames in all screens. - - * src/window.c (give_window_focus): save the mouse position before - checking if win is NULL. - (give_window_focus): set rp_current_screen to xine_screen_num of - the window's screen. - (set_active_window): when using xinerama get the frame from the - current screen. - - * src/split.c (set_frames_window): update the window's scr - attribute to point to the frame's screen. - (find_window_for_frame): when xinerama is being used search all - windows. - (set_active_frame): update rp_current_screen to point to the - frame's screen. - - * src/screen.h (init_screens): new prototype - (is_rp_window_for_screen): likewise - - * src/screen.c: include string.h and X11/cursorfont.h - (init_screens): new function - (is_rp_window_for_screen): new function. - (init_screen): fill in xine_screen_num when using xinerama. - - * src/ratpoison.h: include xinerama.h - - * src/manage.c (current_screen): use xine_screen_num to find the - current screen. - (scanwins): use is_rp_window_for_screen to skip over ratpoison windows. - (scanwins): when using xinerama only manage windows inside the viewable area. - - * src/main.c (main): call init_xinerama and init_screens. Move - screen initing code to these functions. - (init_rat_cursor): move to screen.c - (init_screen): likewise - (find_screen): likewise - (clean_up): call free_xinerama - - - * src/group.c (group_last_window): only check windows in the - current screen, unless xinerama is being used in which case all - windows are accessible. - (group_next_window): likewise - (group_prev_window): likewise - - * src/globals.h: new globals rp_have_xinerama, xine_screen_num. - - * src/events.c (new_window): when using xinerama, the new window's - screen is the current screen. - (key_press): when using xinerama, use the current screen. - - * src/data.h (struct rp_screen): remove root_attr and add left, - top, width, height. All dependant code updated. Add xine_screen_num. - - * src/actions.c (cmd_remove): show the frame indicator in the new - current frame after removing the frame. - - * src/Makefile.am (ratpoison_SOURCES): add xinerama.c and xinerama.h - -2004-02-26 Shawn Betts <sabetts@vcn.bc.ca> - - * src/split.c (hide_frame_indicator): unmap all 'current frame' - indicator windows. - (show_frame_indicator): hide the 'current frame' indicator before - showing it. - -2004-01-30 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_tmpwm): add an XSync() call - -2004-01-25 Ryan Yeske <rcyeske@vcn.bc.ca> - - * src/actions.c (sync_wins): Change list_for_each_entry to - list_for_each_entry_safe. - (cmd_tmpwm): Unhide and maximize each mapped window before - spawning a new wm. - -2003-11-29 Ryan Yeske <rcyeske@vcn.bc.ca> - - * src/communications.c (receive_command_result): Rename from - recieve_command_result. From paxed. - - * src/events.c (handle_signals): s/recieve/receive. - -2003-11-24 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (ratpoison_longopts): add "file" - (ratpoison_opts): add f: option - (print_help): print help for --file option - (read_startup_files): take an alternative rc file as an argument - and use it if it is non-NULL. - (main): parse the --file option. pass alt_rcfile to - read_startup_files. - -2003-11-22 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/Makefile.am (pkgdata_DATA): add rpshowall.sh - (EXTRA_DIST): likewise - -2003-11-17 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/rpshowall.sh: store ratpoison binary location in - RATPOISON env var. - - * src/ratpoison.h (FD_CLOEXEC): new define - (set_close_on_exec): new prototype - - * src/main.c (ratpoison_longopts): add "interactive" option. - (ratpoison_opts): likewise - (print_help): print a help line for interactive option. - (set_close_on_exec): new function - (read_startup_files): call set_close_on_exec on file pointer - (main): parse interactive command line option and pass it to - send_command. - - * src/events.c (execute_remote_command): pass the interactive bit - to command. - - * src/communications.c (send_command): send an interactive bit at - the beginning of the message. Take an interactive argument. All - callers updated. Prototype updated. - - * src/actions.c (cmd_source): call set_close_on_exec on file pointer. - -2003-11-16 Ryan Yeske <rcyeske@vcn.bc.ca> - - * contrib/rpshowall.sh: Added file. From Florian Cramer - <cantsin@zedat.fu-berlin.de> - -2003-11-02 Thien-Thi Nguyen <ttn@glug.org> - - * AUTHORS: Add self. - - * configure.in: Add "--disable-history" handling. - Conditionalize libhistory checks accordingly. - - * README: Mention "--disable history". - - * src/history.c: Surround most of the code with - "#ifdef HAVE_READLINE_HISTORY_H". - - * src/ratpoison.h: Only #include history.h when - "#ifdef HAVE_READLINE_HISTORY_H". - - * src/main.c (main, clean_up): Only load and save history, - respectively, when "#ifdef HAVE_READLINE_HISTORY_H". - - * src/editor.c (editor_history_previous, editor_history_next): - Return EDIT_NO_OP when not "#ifdef HAVE_READLINE_HISTORY_H". - (editor_enter): Do not do line expansion or history add - when not "#ifdef HAVE_READLINE_HISTORY_H". - - * doc/ratpoison.texi: Mention that history cycling and - processing is not available when ratpoison is configured - with the "--disable-history" option. - -2003-11-01 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (cook_keycode): null terminate the string. - -2003-10-24 Ryan Yeske <rcyeske@vcn.bc.ca> - - * contrib/ratpoison.el: Added requires. - -2003-10-15 Shawn Betts <sabetts@vcn.bc.ca> - - * src/globals.c (rp_hook_db): add hooks quit and restart - (rp_quit_hook): new global - (rp_restart_hook): likewise - - * src/events.c (handle_signals): call the restart and quit hooks - -2003-09-24 Shawn Betts <sabetts@vcn.bc.ca> - - * contrib/clickframe.pl: put the patch at the end of the file and - make it runnable through patch. - - * contrib/Makefile.am (EXTRA_DIST): add clickframe.pl - (pkgdata_DATA): likewise - -2003-09-21 Shawn Betts <sabetts@vcn.bc.ca> - - * src/bar.c (prepare_bar): move and resize the window before mapping it. - -2003-09-04 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (initialize_default_keybindings): use ROOT_KEYMAP - in the bind and unbind aliases. - -2003-09-02 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (show_welcome_message): search the root keymap for - the help binding. - (clean_up): call free_keymaps and not free_keybindings. - - * src/events.c (handle_key): call cmd_readkey to hand actually - reading a key from the keyboard. - - * src/data.h (typedef rp_keymap): new typedef - (struct rp_keymap): new struct - - * src/conf.h (ROOT_KEYMAP): new define - - * src/actions.h (cmd_readkey): new prototype - (cmd_newkmap): likewise - (cmd_delkmap): likewise - (cmd_definekey): likewise - (find_keymap): likewise - (keymap_free): likewise - (free_keymaps): likewise - - * src/actions.c (rp_keymaps): new global. remove globals - key_actions, key_actions_last, and key_actions_table_size. - (user_commands): remove bind and unbind. New commands readkey, - newkmap, delkmap, and definekey. - (find_keybinding_by_action): take a rp_keymap argument and operate - on it. All callers updated. - (find_keybinding): likewise - (find_command_by_keydesc): likewise - (resolve_command_from_keydesc): likewise - (add_keybinding): likewise - (remove_keybinding): likewise - (cmd_definekey): new function - (cmd_newkmap): likewise - (cmd_delkmap): likewise - (keymap_new): likewise - (keymap_free): likewise - (find_keymap): likewise - (free_keymaps): likewise - (cmd_bind): remove function. Prototype removed. - (cmd_unbind): likewise - (initialize_default_keybindings): add aliases for unbind and bind. - (ungrab_rat): moved from events.c - (grab_rat): likewise - - -2003-08-30 Shawn Betts <sabetts@vcn.bc.ca> - - * src/input.c (get_more_input): use XGrabKeyboard and XUngrabKeyboard - for changing focus to read key presses. - - * src/events.c (handle_key): use XGrabKeyboard and XUngrabKeyboard - for changing focus to read key presses. - - * src/actions.c (cmd_resize): use XGrabKeyboard and - XUngrabKeyboard for changing focus to read key presses. - (cmd_license): likewise - (cmd_help): likewise - (cmd_fselect): likewise - -2003-08-29 Shawn Betts <sabetts@vcn.bc.ca> - - * src/window.c (give_window_focus): use set_rp_window_focus. - - * src/split.c (set_active_frame): use set_window_focus. - (blank_frame): likewise - - * src/main.c (main): use set_window_focus. - - * src/input.c (get_more_input): use set_window_focus - - * src/globals.h (set_window_focus): new prototype - (set_rp_window_focus): likewise - - * src/events.c (handle_key): use set_window_focus. - - * src/actions.c (cmd_resize): use set_window_focus. - (cmd_license): likewise - (cmd_help): likewise - (cmd_tmpwm): likewise - (cmd_fselect): likewise - - * src/globals.c (set_rp_window_focus): new function - (set_window_focus): likewise - -2003-08-24 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (goto_window): don't do anything if the window is - already the current window. - (set_active_window): don't abort if last_win and win are the same. - -2003-08-22 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (set_active_window): don't do anything if the - window is already the focused window. - - * src/split.c (remove_all_splits): only hide the windows in the - current screen. - - * src/group.h (group_delete_group): new prototype - - * src/group.c (group_last_window): find the last window in the - current screen. - (group_next_window): find next window in current screen. - (group_prev_window): find previous window in current screen. - - * src/manage.c (force_maximize): call XSync() after first resize. - - * src/globals.h (GROUP_DELETE_GROUP_OK): new define - (GROUP_DELETE_GROUP_NONEMPTY): likewise - - * src/actions.h (cmd_gdelete): new prototype - - * src/actions.c (user_commands): new command gdelete - (cmd_gdelete): new command - -2003-08-10 Shawn Betts <sabetts@sfu.ca> - - * src/editor.c (editor_enter): return EDIT_ABORT if there was an - error with the history retrieval. - - * src/bar.c (get_mark_box): take the bar padding into account when - calculate the top of the highlight bar. - (prepare_bar): just use height for the height of the window. - (marked_message): add the padding to the height of the window. - - * src/window.c (give_window_focus): only save the pointer position - when win and last_win aren't the same window. - - * src/actions.h (cmd_listhook): new prototype - - * src/actions.c (use_commands): new command listhook - (cmd_remhook): fix error messages - (hook_completions): new function - (cmd_listhook): likewise - -2003-08-02 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (cmd_number): rename the window's group number - instead of it's internal number. - -2003-07-16 Shawn Betts <sabetts@sfu.ca> - - * src/hook.c: include string.h - - * src/window.c (set_active_window): run the switch window hook. - - * src/split.c (set_active_frame): run the switch frame hook. - - * src/ratpoison.h: include hook.h - - * src/group.h (set_current_group): new prototype - - * src/group.c (set_current_group): new function - - * src/globals.h (rp_prefix_hook): new extern - (rp_switch_win_hook): likewise - (rp_switch_frame_hook): likewise - (rp_switch_group_hook): likewise - (rp_hook_db): likewise - - * src/globals.c (rp_prefix_hook): new hook - (rp_switch_win_hook): likewise - (rp_switch_frame_hook): likewise - (rp_switch_group_hook): likewise - (rp_hook_db): new global - - * src/events.c (handle_key): call the prefix hook. - - * src/data.h (struct rp_hook_db_entry): new struct - - * src/actions.h (cmd_addhook): new prototype - (cmd_remhook): likewise - - * src/actions.c (user_commands): add commands addhook and remhook. - (cmd_windows): show the window bar no matter what if the bar - timeout is > 0. - (cmd_gnext): call set_current_group - (cmd_gprev): likewise - (cmd_gnew): likewise - (cmd_gselect): likewise - (cmd_addhook): new function - (cmd_remhook): likewise - - * src/Makefile.am (ratpoison_SOURCES): add hook.c and hook.h - -2003-06-29 Shawn Betts <sabetts@sfu.ca> - - * src/editor.c (editor_enter): return EDIT_ABORT when a history - expansion fails. - -2003-06-25 Shawn Betts <sabetts@sfu.ca> - - * contrib/rpws: only set RATPOISON if it's not already set. - - * src/actions.c (cmd_gmove): prompt the user if no group is passed - as an argument. - - * contrib/rpws: call /bin/bash - (rp_call): remove extraneous 'function' keyword in function declaration. - (ws_init_ws): likewise - (ws_init): likewise - (ws_save): likewise - (ws_restore): likewise - (ws_bindings): likewise - -2003-06-24 Shawn Betts <sabetts@sfu.ca> - - * contrib/rpws (rp_call): Don't print debug information. - - * src/actions.c (cmd_resize): fix error message text - (cmd_resize): likewise - (cmd_defresizeunit): likewise - (cmd_defresizeunit): likewise - (cmd_chdir): likewise - (cmd_frestore): likewise - (cmd_frestore): likewise - (cmd_defwinliststyle): likewise - (cmd_defwinliststyle): likewise - (cmd_gmove): likewise - (cmd_gmove): likewise - (cmd_gmerge): likewise - -2003-06-22 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (cmd_groups): print a * beside the current - group. if non-interactively called, return the string. - (sync_wins): rewrite. - (cmd_groups): always print a column in non-interactive mode. - -2003-06-21 Shawn Betts <sabetts@sfu.ca> - - * contrib/Makefile.am (bin_SCRIPTS): add rpws - -2003-06-14 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (set_active_window): remove duplicate call to - unhide_window, it is made in give_window_focus. Call - give_window_focus before calling hide_others. - -2003-06-02 Shawn Betts <sabetts@sfu.ca> - - * src/group.c (groups_merge): don't merge a group with itself. - - * src/bar.c (draw_mark): abort if mark_end is the beginning of the - line or the start and end of the mark is the same. - - * src/actions.c (group_completions): use a group's number if it - has no name. - -2003-05-31 Shawn Betts <sabetts@sfu.ca> - - * configure.in: check for usleep - -2003-05-28 Shawn Betts <sabetts@sfu.ca> - - * src/completions.c (completions_complete): if direction is - COMPLETION_PREVIOUS, then set last_match to it's previous entry. - - * src/globals.h (COMPLETION_NEXT): new define - (COMPLETION_PREVIOUS): likewise - - * src/editor.c (editor_complete): remove prototype - (editor_complete_prev): new prototype - (editor_complete_next): likewise - (editor_insert): make it a static function. update prototype - (edit_bindings): add editor_complete_prev. replace editor_complete - with editor_complete_next. - (editor_complete): call completions_complete - (editor_complete_next): new function - (editor_complete_prev): likewise - - * src/completions.h (completions_next_completion): remove prototype - (completions_update): likewise - (completions_assign): likewise - (completions_complete): new prototype - - * src/completions.c (completions_assign): make it a static - function - (completions_update): likewise - (completions_prev_match): new function - (completions_next_match): likewise - (completions_complete): renamed from - completions_next_completion. call completions_next_match and - completions_prev_match. - -2003-05-27 Shawn Betts <sabetts@sfu.ca> - - * src/completions.c (completions_next_completion): check - c->last_match as a match to partial on a virgin completion. - - * src/group.c (free_groups): new function - - * src/group.h (free_groups): new prototype - - * src/main.c (clean_up): call free_groups - - * src/actions.c (cmd_fdump): free the string returned by frame_dump. - - * src/completions.c (completions_update): free new_list. - - * src/editor.c (input_line_free): free the completions structure - in line. - - * configure.in: add a check for libhistory. - - * src/editor.c (saved_command): new local global - (edit_binding): new typedef - (edit_binding): new struct - (edit_bindings): new local global - (input_line_new): new function - (input_line_free): likewise - (execute_edit_action): likewise - (editor_forward_char): likewise - (editor_backward_char): likewise - (editor_forward_word): likewise - (editor_backward_word): likewise - (editor_beginning_of_line): likewise - (editor_end_of_line): likewise - (editor_delete_char): likewise - (editor_backward_delete_char): likewise - (editor_kill_word): likewise - (editor_backward_kill_word): likewise - (editor_kill_line): likewise - (editor_backward_kill_line): likewise - (editor_history_previous): likewise - (editor_history_next): likewise - (editor_abort): likewise - (editor_no_action): likewise - (editor_insert): likewise - (editor_enter): likewise - (paste_cut_buffer): likewise - (paste_primary_selection): likewise - (editor_paste_selection): likewise - (editor_complete): likewise - (editor_forward_char): new prototype - (editor_backward_char): likewise - (editor_forward_word): likewise - (editor_backward_word): likewise - (editor_beginning_of_line): likewise - (editor_end_of_line): likewise - (editor_delete_char): likewise - (editor_backward_delete_char): likewise - (editor_kill_word): likewise - (editor_backward_kill_word): likewise - (editor_kill_line): likewise - (editor_paste_selection): likewise - (editor_abort): likewise - (editor_no_action): likewise - (editor_enter): likewise - (editor_history_previous): likewise - (editor_history_next): likewise - (editor_complete): likewise - (editor_backward_kill_line): likewise - - * src/sbuf.h (sbuf): add node field. - - * src/main.c (xrealloc): don't print debugger output - (init_defaults): init history_size - (main): initialize rp_selection - (main): load history - (clean_up): save history - - * src/linkedlist.h (list_first): new macro - - * src/input.h (free_history): remove prototype - (ring_bell): new function - - * src/input.c: include unistd.h - (input_history): remove - (input_num_history_entries): likewise - (update_input_window): remove prompt, input, and input_len - arguments. add line argument. - (update_input_window): use line argument. - (ring_bell): new function - (get_input): take completion_fn argument. prototype and callers - updated. - (free_history): remove function - (get_more_input): take completion_fn argument. prototype and - callers updated. use line structure and its functionality. - - * src/globals.h (MAX_FONT_WIDTH): new define - (rp_selection): new extern - - * src/globals.c (rp_selection): new global - - * src/completions.h (completions_new): new prototype - (completions_free): likewise - (completions_assign): likewise - (completions_update): likewise - (completions_next_completion): likewise - - - * src/completions.c (completions_new): new function - (completions_free): likewise - (completions_assign): likewise - (completions_update): likewise - (completions_next_completion): likewise - - * src/Makefile.am (ratpoison_SOURCES): add editor.c editor.h - history.h and history.c - - * src/data.h (rp_completions): new typedef - (rp_input_line): likewise - (completion_fn): likewise - (rp_defaults): new field, history_size - (rp_completions): new struct - (rp_input_line): new struct - - * src/conf.h (MAX_HISTORY_SIZE): new define - (HISTORY_FILE): likewise - (VISUAL_BELL): likewise - (MODIFIER_PREFIX): set to RP_CONTROL_MASK - (INPUT_ABORT_MODIFIER): likewise - (INPUT_PREV_HISTORY_MODIFIER): likewise - (INPUT_NEXT_HISTORY_MODIFIER): likewise - (RESIZE_VGROW_MODIFIER): likewise - (RESIZE_VSHRINK_MODIFIER): likewise - (RESIZE_HGROW_MODIFIER): likewise - (RESIZE_HSHRINK_MODIFIER): likewise - - * src/actions.c (trivial_completions): new function - (window_completions): likewise - (colon_completions): likewise - (exec_completions): likewise - (cmd_select): pass window_completions to get_input - (cmd_rename): pass trivial_completions to get_input - (cmd_colon): pass colon_completions to get_input and - get_more_input - (cmd_exec): pass exec_completions to get_input - (cmd_newwm): pass trivial_completions to get_input - (cmd_resize): convert the keysym modifier to something ratpoison - understands. - -2003-05-25 Shawn Betts <sabetts@sfu.ca> - - * src/Makefile.am (ratpoison_SOURCES): add completions.c and completions.h - - * src/actions.c (cmd_gmerge): show a message if the group - specified by the user could not be found. - (cmd_gselect): if the user didn't type anything then return. - - * src/window.c: do not include ctype.h - - * src/ratpoison.h (str_comp): new prototype - - * src/messages.h (MESSAGE_PROMPT_SWITCH_TO_GROUP): new define - - * src/main.c: include ctype.h - (str_comp): moved from window.c - - * src/group.h (groups_find_group_by_name): new prototype. - (groups_find_group_by_number): likewise. - (groups_merge): likewise - (group_move_window): likewise - - * src/group.c: include string.h - (group_new): new argument, name. All callers updated. prototype - updated. - (init_groups): create the first group with DEFAULT_GROUP_NAME as - its name. - (group_new): new argument, name. All callers updated. Prototype - updated. - (group_free): free the group's name. - (group_add_new_group): new argument, name. All callers - updated. Prototype updated. - (groups_find_group_by_name): new function - (groups_find_group_by_number): likewise - (group_move_window): likewise - (groups_merge): likewise - - * src/conf.h (DEFAULT_GROUP_NAME): new define - - * src/actions.h (cmd_gselect): new prototype - (cmd_groups): likewise - (cmd_gmove): likewise - (cmd_gmerge): likewise - (cmd_gnewbg): likewise - - * src/actions.c (user_commands): new commands gselect, groups, - gmove, gmerge, gnewbg. - (cmd_gnewbg): new function - (find_group): likewise - (cmd_gselect): likewise - (cmd_groups): likewise - (cmd_gmove): likewise - (cmd_gmerge): likewise - - * src/bar.c (reset_alarm): new function - (show_bar): call reset_alarm() - (count_lines): make function static. clean up code. - (max_line_length): likewise - (pos_in_line): likewise - (line_beginning): likewise - (draw_string): new static function - (correct_mark): likewise - (prepare_bar): likewise - (get_mark_box): likewise - (draw_inverse_box): likewise - (draw_mark): likewise - (update_last_message): likewise - (marked_message): Move most of the code to seperate function - calls. Call reset_alarm(), prepare_bar(), draw_string(), - correct_mark(), draw_mark(), and update_last_message(). - - * src/actions.c (cmd_select): fix crash bug. - - * src/window.c (get_window_list): mark_end is the length of the - string. Don't do a special case if the window list is being - displayed as a column. - - * src/input.c (read_key): Do not wait for the key release - event. Remove gobble_rel argument. Callers updated. - -2003-05-24 Shawn Betts <sabetts@sfu.ca> - - * src/group.h (group_resort_window): new prototype - - * src/group.c (group_find_window_by_number): return - rp_window_elem*. Dependant code updated. - (group_insert_window): new function - (group_in_list): likewise - (group_resort_window): likewise - (group_map_window): insert the window and sort the list. - - * src/actions.c (cmd_number): Change the group number of the - window. - (cmd_resize): print an error message if the command was called - interactively with <2 arguments. - -2003-05-21 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (cmd_resize): fail if data == NULL when called - non-interactively. - -2003-05-20 Shawn Betts <sabetts@sfu.ca> - - * src/linkedlist.h: Move all C function to linkedlist.c - -2003-05-19 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (find_window): add debugging output describing - which window list the window was found in. - - * src/group.c (group_new): assign the group's number the number - passed as an argument. - - * src/events.c (destroy_window): withdraw iconified and normal - windows before unmanaging them. - (handle_signals): delete the node from the list before freeing it. - - * src/bar.h (message): remove define. - (marked_wrapped_message): remove prototype - (message): new prototype - - * src/bar.c (message): new function - (marked_wrapped_message): renamed to marked_message. remove - marked_message. - -2003-05-18 Shawn Betts <sabetts@sfu.ca> - - * src/bar.c (marked_wrapped_message): Free the GC's created with - XCreateGC. - -2003-05-17 Shawn Betts <sabetts@sfu.ca> - - * configure.in: version bump to 1.3.0-cvs - - * src/main.c (chld_handler): Variable declaration placed in proper - location. - - * src/actions.c (spawn): always put the DISPLAY string in the - environment. - -2003-05-16 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (add_to_window_list): add the window to the current - group. - (find_window_name): search the current group for a matching - window. - (find_window_other): likewise. - (format_window_name): take a rp_window_elem as an argument, not an - rp_window. Print the group window's number, not the window's - internal number. - (get_window_list): loop through the current group. - - * src/split.c (find_window_for_frame): search the current group - for a window to fit in the frame. - - * src/ratpoison.h: include globals.h and group.h - - * src/manage.c (unmanage): remove the window from any groups it - was in. - (map_window): map the window in any groups it is in. - (withdraw_window): unmap the window in any groups it is in. - - * src/main.c: Move all globals to globals.h - (main): initialize the group functions. - - * src/data.h: Move all defines and extern globals to globals.h - (struct rp_window_elem): new struct - (struct rp_group): likewise - - * src/actions.h (cmd_gnext): new prototype - (cmd_gprev): likewise - (cmd_gnew): likewise - - * src/actions.c (user_commands): new commands gnext, gprev, and gnew - (cmd_prev): fix to work with new group code. - (cmd_next): likewise - (cmd_gnext): new function - (cmd_gprev): likewise - (cmd_gnew): likewise - - * src/Makefile.am (ratpoison_SOURCES): add files globals.h, - globals.c, group.h and group.c - -2003-05-15 Shawn Betts <sabetts@sfu.ca> - - * src/data.h (struct rp_frame): renamed from rp_window_frame. All - dependant code updated. - - * src/main.c: remove child_info global. Add rp_children global. - (chld_handler): update the terminated and status fields of any - terminated children. - - * src/events.c (handle_signals): loop through each child process - and remove them from the list. Print a message for any child that - doesn't return a 0 status. - - * src/data.h (rp_child_info): new fields, terminated and node. - remove child_info global. Add rp_children global. - - * src/actions.c (spawn): Add the command to the list of children. - -2003-05-14 Shawn Betts <sabetts@sfu.ca> - - * src/data.h (struct rp_screen): rename from - screen_info. Dependant code updated. - -2003-05-09 Shawn Betts <sabetts@sfu.ca> - - * src/manage.h (clear_unmanaged_list): new prototype - (list_unmanaged_windows): likewise - (add_unmanaged_window): likewise - - * src/manage.c (unmanaged_window_list): no longer a const. - (num_unmanaged_windows): new static global - (clear_unmanaged_list): new function - (list_unmanaged_windows): likewise - (add_unmanaged_window): likewise - (unmanaged_window): use num_unmanaged_windows to tell how many - elements are in the unmanaged list. - - * src/actions.h (cmd_unmanage): new prototype - (cmd_clrunmanaged): likewise - - * src/actions.c (user_commands): new commands unmanage, - clrunmanaged. - (cmd_unmanage): new function - (cmd_clrunmanaged): likewise - - * src/split.c (split_frame): call update_bar() instead of - update_window_names(). - (set_active_frame): likewise - (blank_frame): likewise - - * src/bar.h (update_bar): new prototype. - - * src/bar.c (BAR_IS_HIDDEN): new define. - (update_bar): new function. - - * src/actions.c (cmd_frestore): call update_bar() instead of - update_window_names(). - - * src/split.c (set_active_frame): update the window list after - switching frames. - (blank_frame): update the window list after blanking the screen. - - * src/actions.c (cmd_frestore): update the window list after - restoring the frames. - - * src/split.c (split_frame): update the window list after the - split. - -2003-04-13 Shawn Betts <sabetts@sfu.ca> - - * src/main.c (main): if the screen was specified on the - command-line, send the command to the correct screen. - - * src/communications.c (send_command): new argument, - screen_num. Get the root window for the specified - screen. prototype updated. - - * src/main.c (init_screen): print the display string for - debugging. - (ratpoison_opts): fix -c option by adding a : after it. - - * src/manage.c (current_screen): search for the current screen - using rp_current_screen. - - * src/main.c (main): add switch case for the display command line - option. - (print_help): add --display option. Add text to demonstrate - --display and --command take an argument. - (ratpoison_longopts): add display. - (ratpoison_longopts): add screen. - (ratpoison_opts): add 'd' - (ratpoison_opts): add 's' - (main): parse the screen argument and process it. - (print_help): add --screen - - * src/manage.c (get_wmname): add debugging output to print - returned elements from X11 call. - -2003-04-11 Shawn Betts <sabetts@sfu.ca> - - * src/manage.c (get_wmname): add a debug line to print the - property returned. - (get_wmname): add newline in debug print out. - (get_wmname): fail if n is 0. - - * src/window.c (window_name): use WIN_NAME_* defines for possible - defaults.win_name values. - (window_name): remove case WIN_NAME_TITLE and glob it with the - default switch. - - * src/main.c (init_defaults): use WIN_NAME_* defines for - possible defaults.win_name values. - - * src/actions.c (cmd_defwinname): use WIN_NAME_* defines for - possible defaults.win_name values. - (cmd_defwinname): likewise - - * src/data.h (WIN_NAME_TITLE): new define - (WIN_NAME_RES_CLASS): new define - (WIN_NAME_RES_NAME): new define - - * src/window.c (add_to_window_list): use xstrdup to create the - default value for user_name. - -2003-04-10 Shawn Betts <sabetts@sfu.ca> - - * src/events.c (unmap_notify): fix crash bug in NormalState case. - -2003-04-09 Shawn Betts <sabetts@sfu.ca> - - * configure.in (TERM_PROG): Add doc string - - * src/events.c (receive_command): handle the case when more than - one client requests a command (fix infinite loop bug). - -2003-04-08 Shawn Betts <sabetts@sfu.ca> - - * src/main.c (WAIT_ANY): define it if it isn't already define. - -2003-04-07 Shawn Betts <sabetts@sfu.ca> - - * src/input.c (read_key): remove the local variable, key_presses. - - * src/Makefile.am (ratpoison_SOURCES): add linkedlist.h - - * src/bar.c (marked_message): pass correct arguments to bar_y. - - * src/actions.c (cmd_defwinliststyle): error messages print the - correct command name. - -2003-04-06 Shawn Betts <sabetts@sfu.ca> - - * src/actions.h: All cmd_* functions take char* instead of - void*. All callers updated. - - * src/bar.c (marked_wrapped_message): make the marked line span - the whole line. - - * src/actions.c (cmd_number): update any frames pointing to the - windows that have changed. - -2003-04-05 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (get_window_list): if window_list_style is STYLE_COLUMN then - the end of the mark is the length of the buffer minus the start of - the mark. - - * src/main.c (init_defaults): init window_list_style to STYLE_ROW. - - * src/input.c (update_input_window): store the height in a - variable. - - * src/data.h (struct rp_defaults): new member, window_list_style. - - * src/bar.h [message]: wrap msg arg in parens. - (marked_wrapped_message): new prototype - - * src/bar.c (bar_y): new argument, height. All callers updated. - (bar_y): use height in calculations. - (update_window_names): print a column of windows if - defaults.window_list_style is in column mode. - (count_lines): new function - (max_line_length): likewise - (pos_in_line): likewise - (line_beginning): likewise - (marked_wrapped_message): likewise - - * src/actions.c (user_commands): new commands 'verbexec' and - 'defwinliststyle'. Move @end take to after the def* commands. - (cmd_verbexec): new function. Added prototype. - (cmd_defwinliststyle): likewise - -2003-04-04 Shawn Betts <sabetts@sfu.ca> - - * src/split.c (set_active_frame): fix NULL pointer crash bug. - - * src/actions.c (cmd_setenv): properly parse the environment name - and value using strtok. - - * src/window.c (add_to_window_list): init the window's frame_number to EMPTY. - - * src/number.h (numset_clear): new prototype - - * src/manage.c (unmanage)[AUTO_CLOSE]: code update for new globals. - - * src/frame.c (frame_new): init f->last_access to 0. - (frame_dump): dump the X11 window ID, not the window number. - (frame_read): new function - - * src/events.c (destroy_window): just unmanage the window. - - * src/actions.h (cmd_fdump): new prototype - (cmd_frestore): likewise - - * src/actions.c (user_commands): new commands "fdump" and "frestore". - (cmd_fdump): new function - (cmd_frestore): likewise - - * src/number.c (numset_clear): new function. - -2003-03-31 Shawn Betts <sabetts@sfu.ca> - - * src/window.c (set_current_window): use current_frame() - - * src/split.h (current_frame): new prototype - - * src/split.c (current_frame): new function - (current_window): use current_frame() - (split_frame): likewise - (remove_all_splits): likewise - (set_active_frame): likewise - (show_frame_message): likewise - (remove_all_splits): use current_screen() - - * src/actions.c (cmd_prev_frame): use current_frame() - (cmd_next_frame): likewise - (cmd_select): likewise - (cmd_h_split): likewise - (cmd_v_split): likewise - (cmd_remove): likewise - (cmd_shrink): likewise - (cmd_resize): likewise - (cmd_focusup): likewise - (cmd_focusdown): likewise - (cmd_focusleft): likewise - (cmd_focusright): likewise - -2003-03-30 Shawn Betts <sabetts@sfu.ca> - - * src/split.c (current_window): call screen_get_frame. - (split_frame): call screen_get_frame to get appropriate structure. - (split_frame): call find_window_number to get appropriate - structure. - (remove_all_splits): call screen_get_frame to get appropriate - structure. - (resize_frame): make sure all frames that will be resized are big - enough for the resize. - (resize_frame): return int - (resize_shrink_to_window): call find_window_number to get the - appropriate structure. - (resize_frame_right): return int - (resize_frame_left): likewise - (resize_frame_top): likewise - (resize_frame_bottom): likewise - (resize_frame_horizontally): backup the frameset and restore it if - the resize fails. Do not allow a frame to be resized too small or - too big. - (resize_frame_vertically): likewise - (remove_frame): call find_window_number to get the appropriate - structure. - (set_active_frame): likewise - (blank_frame): likewise - (show_frame_message): call screen_get_frame to get the appropriate - structure. - - * src/screen.c (screen_width): new function (and prototype) - (screen_height): likewise - (screen_left): likewise - (screen_right): likewise - (screen_top): likewise - (screen_bottom): likewise - (screen_copy_frameset): likewise - (screen_restore_frameset): likewise - (frameset_free): likewise - (screen_get_frame): likewise - - * src/split.c (maximize_frame): call screen_width and - screen_height to get the size for the frame. - - * src/ratpoison.h: include screen.h - - * src/manage.c (move_window): - - * src/frame.h (frame_copy): new prototype - (frame_dump): likewise - - * src/frame.c (frame_copy): new function - (frame_dump): likewise - - * src/events.c (unmap_notify): compare frame numbers, not - pointers. - (client_msg): call screen_get_frame when blanking the frame. - - * src/data.h (EMPTY): new define - (struct rp_window_frame): replace the win field with - win_number. Dependant code updated. - (struct rp_window): replace frame with frame_number. Dependant - code updated. - (struct screen_info): replace rp_current_frame with current_frame - and change type to int. Dependant code updated. - - * src/Makefile.am (ratpoison_SOURCES): added screen.h and screen.c - -2003-03-25 Shawn Betts <sabetts@sfu.ca> - - * src/split.h (show_frame_message): new prototype - - * src/split.c (show_frame_message): new function - - * src/main.c (init_screen): listen for key release events in the - key_window and input_window. - - * src/input.c (read_key): new argument, gobble_rel. All callers - updated. - - * src/actions.c (cmd_remove): only remove the current frame if it - isn't the ONLY one. - (cmd_remove): display a message informing the user if the frame - cannot be removed. - (cmd_resize): clean up resize loop. - (cmd_resize): display a window indicating which frame is being - resized. - -2003-03-23 Shawn Betts <sabetts@sfu.ca> - - * src/split.c (resize_frame_vertically): fix typo error (frame_top - not frame_left). - -2003-03-17 Shawn Betts <sabetts@sfu.ca> - - * src/split.c (resize_frame_horizontally): only resize to the left - if the frame isn't against the left side of the screen. - (resize_frame_vertically): only resize to the left - if the frame isn't against the top of the screen. - - * src/actions.c (initialize_default_keybindings): add keybindings - for fselect and resize. Move keybinding for curframe. - - * src/split.c (create_initial_frame): call frame_new to allocate a frame. - (split_frame): likewise - - * src/main.c (free_screen): call frame_free to free the screen - frames. - - * src/frame.h (frame_new): new prototype - (frame_free): likewise - - * src/frame.c (frame_new): new function. - (frame_free): likewise - -2003-03-07 Shawn Betts <sabetts@sfu.ca> - - * src/Makefile.am (ratpoison_SOURCES): add frame.c and frame.h - - * src/frame.h (frame_left): new prototype - (frame_top): likewise - (frame_right): likewise - (frame_bottom): likewise - (frame_width): likewise - (frame_height): likewise - (frame_resize_left): likewise - (frame_resize_right): likewise - (frame_resize_up): likewise - (frame_resize_down): likewise - (frame_move_left): likewise - (frame_move_right): likewise - (frame_move_up): likewise - (frame_move_down): likewise - - * src/frame.c (frame_left): new function - (frame_top): likewise - (frame_right): likewise - (frame_bottom): likewise - (frame_width): likewise - (frame_height): likewise - (frame_resize_left): likewise - (frame_resize_right): likewise - (frame_resize_up): likewise - (frame_resize_down): likewise - (frame_move_left): likewise - (frame_move_right): likewise - (frame_move_up): likewise - (frame_move_down): likewise - - * src/split.c (resize_frame): new function - (resize_frame_right): likewise - (resize_frame_left): likewise - (resize_frame_top): likewise - (resize_frame_bottom): likewise - (resize_frame_horizontally): use resize_frame_right and - resize_frame_left to do the resizing. - (resize_frame_vertically): use resize_frame_top and - resize_frame_bottom to do the resizing. - - * src/ratpoison.h (PRINT_ERROR): flush stdout - (PRINT_DEBUG): likewise - include frame.h - -2003-03-06 Shawn Betts <sabetts@sfu.ca> - - * src/split.h (find_frame_number): new prototype - - * src/split.c (create_initial_frame): give a number to the - initial frame - (split_frame): give the new frame a unique number - (split_frame): add the new frame after the current frame - (remove_all_splits): return the frame's number when deleting it. - (remove_frame): likewise - (find_frame_number): new function - - * src/main.c (init_screen): initialize the frames_numset member - (free_screen): free the frames_numset member - - * src/data.h (struct screen_info): new member, frames_numset - - * src/actions.h (cmd_fselect): new prototype - - * src/actions.c (user_commands): new command "fselect" - (cmd_fselect): new function - - * src/Makefile.am (ratpoison_SOURCES): remove list.h and list.c, - add window.c and window.h - - * src/ratpoison.h: include window.h instead of list.h - - * src/main.c (main): call init_window_stuff(). Remove call to init_numbers(). - (clean_up): call free_window_stuff(). Remove call to free_numbers(). - - * src/list.h (free_window_stuff): new prototype - (init_window_stuff): likewise - - * src/list.c (rp_window_numset): new global - (init_window_stuff): new function - (free_window_stuff): new function - - * src/data.h (rp_window_numset): new extern - - * src/number.c (numset_init): new function - (number_is_taken): rename to numset_num_is_taken, callers updated. - (find_empty_cell): rename to numset_find_empty_cell, callers updated. - (add_window_number): rename to numset_add_num, callers updated. - (return_window_number): rename to numset_release, callers updated. - (init_numbers): remove function - (free_numbers): rename to numset_free, callers updated. - (numset_num_is_taken): take struct numset* as an argument. - (numset_find_empty_cell): likewise - (numset_add_num): likewise - (numset_request): likewise - (numset_release): likewise - (numset_free): likewise - (numset_new): new function - -2003-02-27 Shawn Betts <sabetts@sfu.ca> - - * src/main.c (free_screen): new function - (clean_up): call free_screen on each screen. free the screen - array. free defaults.window_fmt. - - * src/number.h (free_numbers): new prototype - - * src/number.c (free_numbers): new function - - * src/manage.c (get_wmname): use XGetWindowProperty to get the - window name. - (unmanaged_window): free wname after using it. - - * src/main.c (wm_name): new global - (main): internalize WM_NAME atom. - (clean_up): free data structures for keybindings, aliases, the - bar, window numbers, and input history. - - * src/input.h (free_history): new prototype - - * src/input.c (free_history): new function - - * src/events.c (execute_remote_command): free properties returned - by XGetWindowProperty(). - - * src/data.h (wm_name): new extern - - * src/communications.c (recieve_command_result): free properties - returned by XGetWindowProperty(). - - * src/bar.h (free_bar): new prototype - - * src/bar.c (update_window_names): bar_buffer is not static. - (update_window_names): free bar_buffer after using it. - (marked_message): free the GC after using it. - (free_bar): new function. - - * src/actions.h (free_keybindings): new prototype - (free_aliases): likewise - - * src/actions.c (free_keybindings): new function - (free_aliases): likewise - (cmd_tmpwm): unmap the key window before calling the new wm, and - remap it afterwards. - -2003-02-24 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (cmd_tmpwm): unmap the key window before spawning - the wm and map it afterwards. - -2003-02-23 Shawn Betts <sabetts@sfu.ca> - - * src/split.c (remove_all_splits): fix bug hiding windows not in - the current frame. - - * src/split.h (cleanup_frame): new protoype - - * src/manage.c (scanwins): added better debugging output - - * src/events.c (cleanup_frame): move to split.c - (handle_key): ungrab the rat right after we read the key. - - * src/actions.h (cmd_tmpwm): new prototype. - - * src/actions.c (spawn): return the pid of the child - process. prototype updated. - (cmd_tmpwm): new function - (user_commands): new command, tmp_wm. - -2003-02-22 Shawn Betts <sabetts@sfu.ca> - - * configure.in: don't check for variable argument support in - preprocessor. - - * src/ratpoison.h (PRINT_LINE): new macro. - (PRE_PRINT_LOCATION): remove macro - (PRINT_ERROR): takes one argument which is the argument list - ,parens and all, to be passed to printf. Callers updated. - - * src/linkedlist.h (list_direction_entry): no longer returns NULL - if there is only one element in the list. Instead, returns the - same element again and again. - - * src/actions.c (cmd_number): use list delete entry macro - (cmd_number): likewise - (cmd_escape): use list looping macro - (cmd_escape): likewise - (cmd_defpadding): likewise - (cmd_defborder): likewise - - * src/data.h: include linkedlist.h - (struct rp_window_frame): use struct list_head instead of next, - prev pointers. - (struct rp_window): likewise - (struct screen_info): rename rp_window_frame_sentinel to - rp_window_frames and change it's type to list_head. - - * src/events.c (mapping_notify): use list looping macro - (mapping_notify): likewise - - * src/list.c: rename rp_unmapped_window_sentinel to - rp_unmapped_window and rp_mapped_window_sentinel to - rp_mapped_window. Use LIST_HEAD to create them. externs updated. - (add_to_window_list): use list add entry macro. - (find_window_in_list): list head is of type list_head. Prototype - and callers updated. - (find_window_in_list): use list looping macro - (init_window_list): remove function - (find_window_number): use list looping macro - (find_window_name): likewise - (find_window_prev): use list previous entry macro - (find_window_next): use list next entry macro - (find_window_other): use list looping macro - (append_to_list): remove function - (insert_into_list): use list looping macro - (insert_into_list): use list add entry macro - (remove_from_list): remove function - (get_window_list): use list looping macro - - * src/main.c (main): do not call init_window_list() - - * src/manage.c (unmanage): use list delete macro - (map_window): likewise - (withdraw_window): use list moving macro to move entry to - another list. - (hide_others): use list looping macro - - * src/split.c (num_frames): use list looping macro - (frames_screen): likewise - (maximize_all_windows_in_frame): likewise - (delete_frame_from_list): remove function - (create_initial_frame): remove list init code. Add current frame - to screen's frame list. - (init_frame_list): use list init macro - (find_last_frame): use list looping macro - (find_windows_frame): likewise - (find_frame_next): use list next entry macro - (find_frame_prev): use list previous entry macro - (find_window_for_frame): use list looping macro - (split_frame): use list add entry macro - (remove_all_splits): use list looping macro - (resize_frame_vertically): likewise - (resize_frame_horizontally): likewise - (total_frame_area): likewise - (frame_overlaps): likewise - (remove_frame): likewise - (find_frame_up): likewise - (find_frame_down): likewise - (find_frame_left): likewise - (find_frame_right): likewise - -2003-02-10 Shawn Betts <sabetts@sfu.ca> - - * src/split.h (num_frames): new prototype - (resize_shrink_to_window): likewise - (resize_frame_vertically): likewise - (resize_frame_horizontally): likewise - - * src/split.c (num_frames): no longer a static function - (resize_shrink_to_window): new function - (resize_frame_vertically): likewise - (resize_frame_horizontally): likewise - - * src/main.c (init_defaults): init frame_resize_unit. - - * src/data.h (struct rp_defaults): new member frame_resize_unit. - - * src/conf.h (RESIZE_VGROW_KEY): new define - (RESIZE_VGROW_MODIFIER): likewise - (RESIZE_VSHRINK_KEY): likewise - (RESIZE_VSHRINK_MODIFIER): likewise - (RESIZE_HGROW_KEY): likewise - (RESIZE_HGROW_MODIFIER): likewise - (RESIZE_HSHRINK_KEY): likewise - (RESIZE_HSHRINK_MODIFIER): likewise - (RESIZE_SHRINK_TO_WINDOW_KEY): likewise - (RESIZE_SHRINK_TO_WINDOW_MODIFIER): likewise - (RESIZE_END_KEY): likewise - (RESIZE_END_MODIFIER): likewise - - * src/actions.h (cmd_shrink): new prototype - (cmd_resize): likewise - (cmd_defresizeunit): likewise - - * src/actions.c (user_commands): add commands cmd_resize and - cmd_shrink, and cmd_defresizeunit. - (cmd_shrink): new function - (cmd_resize): likewise - (cmd_defresizeunit): likewise - -2003-01-30 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (cmd_bind): more informative error messages - (cmd_unbind): likewise - (cmd_source): likewise - (cmd_select): likewise - (cmd_number): likewise - (cmd_escape): likewise - (cmd_h_split): likewise - (cmd_v_split): likewise - (cmd_rudeness): likewise - (cmd_gravity): likewise - (cmd_defwingravity): likewise - (cmd_deftransgravity): likewise - (cmd_defmaxsizegravity): likewise - (cmd_msgwait): likewise - (cmd_defbargravity): likewise - (cmd_defbargravity): likewise - (cmd_defborder): likewise - (cmd_defbarborder): likewise - (cmd_definputwidth): likewise - (cmd_definputwidth): only accept input widths >=0 - (cmd_chdir): add error message if HOME environment variable is not - set. - (cmd_chdir): add error message if chdir fails. - (cmd_rudeness): only accept rudeness numbers between 0 and 15 - (cmd_msgwait): only accept waiting times >=0 - -2003-01-25 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (cmd_help): Print key binding when called - non-interactively. - (cmd_defwaitcursor): error message correctly shows what command - the error occurred in. - (cmd_rudeness): rudeness data correctly stored in rudeness - variables. - -2002-12-11 Shawn <sabetts@sfu.ca> - - * configure.in (AC_CHECK_FUNCS): Add check for putenv, remove - check for setenv and unsetenv. - - * src/actions.c (setenv): remove function - (unsetenv): likewise - (cmd_setenv): use putenv instead of setenv. - (cmd_unsetenv): likewise - -2002-12-09 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (spawn): only add DISPLAY to the environment if it - isn't already there. - -2002-11-24 Shawn Betts <sabetts@sfu.ca> - - * src/main.c: include sys/wait.h - (chld_handler): new function - - * src/events.c: include sys/wait.h - (handle_signals): Print an error message in the case of a child - signal. - - * src/data.h (struct rp_child_info): New struct. - (child_info): New global. - (chld_signalled): likewise - - * src/actions.c (spawn): Let the SIGCHLD handler handle process - completion instead of doing an ugly dance. - -2002-11-20 Shawn Betts <sabetts@sfu.ca> - - * src/ratpoison.h[!HAVE_VARARG_MACROS]: PRINT_ERROR and - PRINT_DEBUG are defined as void macros. - - * src/events.c (client_msg): Add semicolon to the end of a - PRINT_DEBUG line. - - * src/actions.c (cmd_bind): typecast data as a (char *) before - using it in (char *) pointer arithmetic. - - * configure.in: Add check to see if the preprocessor has variable - argument macro capabilities. - - * src/main.c (init_defaults): set pointer warping to on by - default. - - * src/list.c (give_window_focus): only warp the pointer if the - warp setting is turned on. - - * src/data.h (struct rp_defaults): new member, warp. - - * src/actions.h (cmd_ward): new prototype - - * src/actions.c (user_command): new command "warp" - (cmd_warp): new function - -2002-10-18 Shawn Betts <sabetts@sfu.ca> - - * src/actions.c (read_split): a negative number means subtract the - pixels from the frame's current size to get the new frame's size. - - * src/split.c (VERTICALLY): new define - (VERTICALLY): likewise - (split_frame): new argument 'pixels'. The current frame is split - and resized to 'pixels' pixels. - (v_split_frame): new argument 'pixels'. prototype updated. - (h_split_frame): likewise - - * src/actions.c (user_commands): hsplit, vsplit, and split take a - string argument. - (read_split): new function - (cmd_h_split): takes a ratio or number to determine how big the - frame split will be. - (cmd_v_split): likewise - -2002-08-31 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_bind): malloc the correct amount of memory for keydesc - (cmd_unbind): likewise - -2002-07-28 Shawn Betts <sabetts@vcn.bc.ca> - - * src/main.c (handler): do not report badwindow errors if - IGNORE_BADWINDOW is define. - - * src/conf.h (IGNORE_BADWINDOW): new define - -2002-07-06 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_help): key descriptions don't run off the - bottom of the screen. - -2002-03-23 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (command): look for the command in the aliases - before looking in the command list. - - * src/actions.h (cmd_unalias): new prototype - - * src/actions.c (user_commands): new command unalias - (cmd_unalias): new function - -2002-04-25 Gergely Nagy <algernon@debian.org> - - * src/actions.c: include <strings.h> - include setenv implementation if HAVE_SETENV is not set, - OR setenv is not defined (removes a compiler warning on - AIX) - * src/events.c: include <strings.h> - * src/getopt.c: include <strings.h> - -2002-03-13 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_nextscreen): An error message is displayed - when there is only 1 screen. - (cmd_prevscreen): likewise - - * src/split.c (set_active_frame): fix to operate properly with - multiple screens. - - * src/data.h (struct rp_window_frame): new data member 'number'. - - * src/actions.h (cmd_prevscreen): new prototype - (cmd_nextscreen): likewise - - * src/actions.c (user_commands): new commands "nextscreen" and - "prevscreen" - (cmd_nextscreen): new function - (cmd_prevscreen): likewise - -2002-02-19 Shawn Betts <sabetts@vcn.bc.ca> - - * src/split.c: include string.h - - * src/sbuf.c: likewise - - * src/events.c: likewise - - * src/communications.c: likewise - -2002-02-17 Shawn Betts <sabetts@vcn.bc.ca> - - * src/manage.c (update_normal_hints): fix debugging output to be - more readable. - - * src/events.c (configure_request): call XSync after granting - configure request. - (property_notify): maximize the window on receiving a normal hints - property change. - -2002-02-16 Shawn Betts <sabetts@vcn.bc.ca> - - * src/manage.c (maximize): remove calls to XSelectInput. - (force_maximize): likewise - (unhide_window): likewise - (unhide_window_below): likewise - - * src/events.c (configure_notify): remove function. - (configure_request): grant the request, then immediately maximize - the window. - (delegate_event): ignore ConfigureNotify events. - (configure_request): grant the request if ratpoison isn't managing - the window. - -2002-02-14 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_license): redraw the bar if it was visible. - (cmd_help): likewise - - * configure.in: fix the --enable-debug help string. - - * src/events.c (configure_request): Ignore the configure notify - event caused by the geometry change if the window is not mapped. - - * src/manage.c (maximize_transient): correctly detect when the - window is bigger than its frame. - (maximize): ignore the structure events generated by the maximize - (force_maximize): likewise - (unhide_window): likewise - (unhide_window_below): likewise - - * src/events.c (configure_notify): Clear up ambiguous debugging - output. - (configure_request): initialize the changes structure to the - window's current attributes. - -2002-02-07 Shawn Betts <sabetts@vcn.bc.ca> - - * src/split.h (find_last_frame): prototype now correctly reflects - the actual function. - - * src/events.c (configure_notify): ignore substructurenotify - events. Add more debugging statements. - - * src/actions.c (cmd_focuslast): pass the current screen to the - call to find_last_frame. - -2002-02-02 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_defbarpadding): print an error message if - defbarpadding is called interactively without arguments. - - * src/events.c (handle_signals): only hide the bar if it times - out. - - * src/bar.c (marked_message): Fix text marking bug. - -2002-02-01 Shawn Betts <sabetts@vcn.bc.ca> - - * src/actions.c (command): bail out if alias recursion gets too deep. - - * src/conf.h (MAX_ALIAS_RECURSIVE_DEPTH): new define - - * src/bar.c (bar_x): update to work with all X11 gravity values. - (bar_y): likewise - - * src/actions.c (cmd_defbargravity): Rename from - cmd_defbarloc. Dependant code updated. - (cmd_defbargravity): accept all gravity arguments. - -2002-01-26 shawn <sabetts@vcn.bc.ca> - - * configure.in: check for the vsnprintf function and stdarg.h - header. - - * src/main.c (xvsprintf): Cleaned up to call vsnprintf only in one - place. wrap the vsnprintf call with va_copy (or __va_copy) and - va_end. - - * src/list.c (format_window_name): If res_class or res_name are - NULL use "None" instead. - - * src/actions.c (alias_t): rename data structure from cmd_alias to - avoid a name clash with the function cmd_alias. Dependant code - updated. - - * src/list.c (set_active_window): Corrected a bug in determining - what a maxsize window is. Only one of width or height must be less - than the screen width or height for a window to qualify as a - maxsize window. - -2002-01-24 shawn <sabetts@vcn.bc.ca> - - * src/actions.c (cmd_defbarloc): Read the location argument as a - gravity argument using parse_wingravity. - (cmd_defbgcolor): don't set the background color for key_window. - (cmd_deffgcolor): don't set the foreground color for key_window. - - * src/messages.h (MESSAGE_FRAME_STRING): Pad the string with - spaces on both sides. - - * src/main.c (init_screen): Create the frame, input, and bar - windows with a border width of defaults.bar_border_width. - (init_defaults): initialize defaults.bar_border_width - - * src/bar.c (bar_x): Incorporate defaults.bar_border_width into - calculations. - (bar_y): likewise - - * src/actions.h (cmd_defbarborder): new prototype - - * src/actions.c (user_commands): new command "defbarborder" - (cmd_defbarborder): new function - - * src/main.c (init_screen): create the help window with a 0 border - width. - - * src/actions.c (find_alias_index): new function - (cmd_alias): When an alias is already in the alias list, replace - it with the new alias. - (command): Append to the end of alias command the arguments passed - in before evaluating the alias. - - * src/events.c (configure_request): do not send a synthetic - configure notify event. - - * src/actions.c (wingravity_to_string): Fix the north gravity - string to return "n" not "ng". - (cmd_defborder): return NULL when no (or a bad) argument is passed - in. - -2002-01-23 Shawn <sabetts@vcn.bc.ca> - - * src/manage.c (send_configure): Change parameters to X11 window, - x, y, width, height and border. Prototype updated. All callers - updated. - - * src/events.c (configure_request): For the changes variable, fill - in geometry parameters not part of the request with the - window's geometry. - - * src/manage.c (update_normal_hints): improve debugging output. - -2002-01-17 Gergely Nagy <algernon@debian.org> - - * debian/changelog: update for a new snapshot - - * doc/ratpoison.1, doc/ratpoison.texi (Keystrokes): removed - false statement that C-t C-: is bound to colon. - -2002-01-15 Shawn Betts <sabetts@sfu.ca> - - * src/input.c (keysym_to_string): handle the case when - XKeysymToString returns NULL. - -2002-01-11 shawn <sabetts@vcn.bc.ca> - - * src/main.c (handler): store the error text at the beginning of - the string instead of 7 bytes in. - -2002-01-10 shawn <sabetts@vcn.bc.ca> - - * src/events.c (delegate_event): ignore the CirculateRequest event. - - * src/actions.c (cmd_rename): Allows the user to specify a second - argument which is the number of the window whose number will be - set to the first argument. - -2002-01-09 Gergely Nagy <algernon@debian.org> - - * src/actions.c (setenv, unsetenv): new functions, used when - the system libc does not have them. - - * configure.in: check for the presence of setenv and unsetenv. - -2002-01-02 shawn <sabetts@vcn.bc.ca> - - * src/main.c (init_screen): do not select on any events for the - bar_window and the frame_window. - - * src/events.h (listen_for_events): new prototype - - * src/events.c (configure_notify): If the event dimensions don't - match the windows, then re-maximize the window. - (configure_request): always grant the requests. - (delegate_event): Changes to the debugging output. - (delegate_event): Don't print debugging messages for events that - ratpoison doesn't need to handle. - (handle_signals): new function - (listen_for_events): new function - (handle_events): remove function. Dependant code uses - listen_for_events. - (get_event): likewise - - * src/manage.h (get_state): new prototype - - * src/manage.c (update_normal_hints): print only the hints that - are set as debugging output. - (scanwins): collect mapped and iconized windows. - (get_state): new function - - * src/main.c (clean_up): don't map iconized windows. - -2001-12-21 shawn <sabetts@vcn.bc.ca> - - * src/actions.h (cmd_alias): new prototype - - * src/actions.c (user_commands): remove "license" from the - unimplemented section. - (user_commands): new command "alias" - (cmd_alias): new function - (command): handle aliases - (initialize_default_keybindings): initialize the alias list - (struct cmd_alias): new struct - (alias_list): new static global - (alias_list_size): likewise - (alias_list_last): likewise - - * src/actions.h (cmd_license): new prototype - - * src/actions.c (cmd_license): new function - (user_commands): new command "license" - (initialize_default_keybindings): bind "license" to V and C-V - - * src/list.c (format_window_name): print unrecognized formatting - options. - - * src/manage.c (unmanage): set the kill_signalled variable. - - * src/actions.c (wingravity_to_string): new function - (cmd_gravity): return the current value when data is NULL - (cmd_defwingravity): likewise - (cmd_deftransgravity): likewise - (cmd_defmaxsizegravity): likewise - (cmd_msgwait): likewise - (cmd_defbarloc): likewise - (cmd_defpadding): likewise - (cmd_defborder): likewise - (cmd_definputwidth): likewise - (cmd_defwaitcursor): likewise - (cmd_defwinfmt): likewise - (cmd_defwinname): likewise - (cmd_defbarpadding): likewise - (cmd_startup_message): likewise - (cmd_rudeness): likewise - - * src/sbuf.h (sbuf_printf_concat): new prototype - (sbuf_printf): likewise - - * src/sbuf.c (sbuf_printf_concat): new function - (sbuf_printf): likewise - - * src/ratpoison.h: include stdarg.h - (xvsprintf): new prototype - (xsprintf): likewise - - * src/main.c (xvsprintf): new function - (xsprintf): likewise - - * src/bar.c: remove include of stdarg.h - (marked_message_printf): call xvsprintf. - - * src/input.c (input_history): new static global - (input_num_history_entries): likewise - (get_more_input): cycle through the input history. - - * src/conf.h (INPUT_PREV_HISTORY_KEY): new define - (INPUT_PREV_HISTORY_MODIFIER): likewise - (INPUT_NEXT_HISTORY_KEY): likewise - (INPUT_NEXT_HISTORY_MODIFIER): likewise - (INPUT_MAX_HISTORY): likewise - - * src/input.c (update_input_window): Draw the cursor in the right place. - - * src/actions.h (cmd_defbarpadding): new prototype - - * src/actions.c (user_commands): new command entry "defbarpadding" - (cmd_defbarpadding): new function - - * src/data.h (rp_error_msg): new global extern - - * src/main.c (rp_error_msg): new global variable - - * src/events.c (get_event): If there is an X11 error message to - print, print it. - - * src/main.c (handler): record the error in rp_error_msg - -2001-12-20 shawn <sabetts@vcn.bc.ca> - - * src/manage.c (maximize_transient): always honour the current - size of the window. - - * src/actions.c (cmd_info): print "Transient" if the window is a - transient window. - -2001-12-18 shawn <sabetts@vcn.bc.ca> - - * src/manage.c (maximize_transient): Fit the transient window - inside its frame. - -2001-12-11 shawn <sabetts@vcn.bc.ca> - - * src/actions.c (parse_keydesc): Don't mangle the key description - argument. - -2001-12-11 Ryan C Yeske <rcyeske@sfu.ca> - - * contrib/genrpbindings: Add ruby bindings. From Doug Kearns - <djkea2@mugc.its.monash.edu.au>. - -2001-12-08 shawn <sabetts@vcn.bc.ca> - - * src/events.c (handle_key): revert the focus immediately after - reading the key. - - * src/list.c (give_window_focus): update rp_current_frame when - setting the window focus. - - * src/main.c (main): scan for windows in a seperate pass after - initializing the screen structures. - (init_screen): build a display string for each screen. - (init_screen): remove the call to scanwins. - - * src/manage.c (current_screen): return the current screen using - rp_current_screen. - - * src/split.h (init_frame_lists): new function - - * src/split.c (rp_window_frame_sentinel): remove. - (rp_current_frame): remove. - (frames_screen): new function - (maximize_frame): use the frame's screen to find out the width and - height of the display. - (create_initial_frame): take a pointer to a screen_info as an - argument. - (init_frame_lists): new function - (init_frame_list): take a pointer to a screen_info as an argument. - (find_last_frame): take a pointer to a screen_info as an argument. - - * src/actions.c (spawn): Set the DISPLAY environment variable to - point to the current screen. - - * src/data.h (struct screen_info): add display_string, - rp_window_frame_sentinel, rp_current_frame. - (rp_current_screen): new global - (rp_current_frame): Remove. Dependant code uses - screen_info.rp_current_frame. - -2001-12-09 Gergely Nagy <algernon@debian.org> - - * debian/changelog: Lets have a snapshot release - * debian/control: Changed Maintainer, and added an Uploaders field - * debian/ratpoison.examples: added the files in contrib/ - * doc/Makefile.am (EXTRA_DIST): removed ratpoisonrc-mode.el - * contrib/Makefile.am (EXTRA_DIST, pkgdata_DATA): added genrpbindigs - -2001-12-05 Ryan C Yeske <rcyeske@sfu.ca> - - * contrib/genrpbindings: Fix perl typos. From Doug Kearns - <djkea2@mugc.its.monash.edu.au>. - -2001-12-04 Ryan C Yeske <rcyeske@sfu.ca> - - * contrib/genrpbindings: New file. - - * src/actions.c (user_commands): Add markup for genrpbindings. - (cmd_getenv): New function. - -2001-10-18 shawn <sabetts@vcn.bc.ca> - - * src/split.c (show_frame_indicator): call XSync after clearing the window. - - * src/input.c (get_more_input): clear the window after it is - raised. Call XSync aftwards. - - * src/conf.h (MAX_LINK_DEPTH): new define - - * src/bar.c (marked_message): clear the window after it is - raised. Call XSync aftwards. - - * src/actions.h (cmd_link): new prototype - - * src/actions.c (user_command): new command 'link' - (find_command_by_keydesc): new function - (resolve_command_from_keydesc): likewise - (cmd_link): likewise - - * src/split.h (find_last_frame): new prototype - - * src/split.c (update_last_access): new function - (find_last_frame): likewise - (split_frame): update the new frame's last_access field - (set_active_frame): update the new current frame's last_access field - - * src/input.h (x11_mask_to_rp_mask): new prototype - (rp_mask_to_x11_mask): likewise - - * src/input.c (x11_mask_to_rp_mask): new function - (rp_mask_to_x11_mask): likewise - - * src/events.c (handle_key): convert X11 modifier masks to rp - modifier masks where appropriate. - - * src/actions.h (cmd_focuslast): new prototype - - * src/actions.c (initialize_default_keybindings): new keybinding - for "focuslast" - (cmd_focuslast): new function - (user_command): new command "focuslast" - - * src/data.h (struct rp_window_frame): new field 'last_access' - (RP_CONTROL_MASK): new define. All code depending on the X11 - modifier mask equivalent has been changed to use this where - appropriate. - (RP_META_MASK): likewise - (RP_ALT_MASK): likewise - (RP_SUPER_MASK): likewise - (RP_HYPER_MASK): likewise - -2001-10-11 shawn <sabetts@vcn.bc.ca> - - * src/bar.c (show_last_message): abort if there was no last - message. - - * src/events.c (configure_request): Always check the rudeness - level before honouring a raise request. - -2001-10-09 shawn <sabetts@vcn.bc.ca> - - * src/split.c (remove_frame): Make sure the frame attempting to - take up the space of the deleted frame overlaps the deleted frame - after the size change. - (remove_frame): More debug messages - - * src/list.c (format_window_name): add formatting option '%l' to - grab the last_access field from the window. - -2001-10-05 Gergely Nagy <algernon@debian.org> - - * contrib/ratpoisonrc-mode.el: superceded by.. - * contrib/ratpoison.el: ..this one, now with AllYou'llEverNeed(tm) - -2001-10-01 shawn <sabetts@vcn.bc.ca> - - * src/bar.c (marked_message_printf): Handle a return value from - vsnprintf of -1 properly. - -2001-09-27 shawn <sabetts@vcn.bc.ca> - - * src/main.c[ratpoison_opts]: remove 'r' and 'k'. - -2001-09-23 shawn <sabetts@vcn.bc.ca> - - * src/actions.c (initialize_default_keybindings): Change C-t a and - C-t C-a binding to "time". - -2001-09-21 shawn <sabetts@vcn.bc.ca> - - * src/split.h (find_frame_up): new prototype - (find_frame_down): likewise - (find_frame_left): likewise - (find_frame_right): likewise - - * src/split.c (find_frame_up): new function - (find_frame_down): likewise - (find_frame_left): likewise - (find_frame_right): likewise - - * src/manage.c (move_window): use x11 gravity constants to denote - gravity. - - * src/main.c (ratpoison_longopts): remove --kill and - --restart. Dependant code updated. - (init_defaults): use x11 gravity constants to denote gravity. - (main): only display the startup message if - defaults.startup_message is on. - - * src/list.c (update_window_gravity): rename from - update_window_position. dependant code updated - - * src/events.c (client_msg): don't test for restart or kill client - messages. - (client_msg): properly handle iconify requests. - (get_event): kill and restart the process here. - - * src/data.h (TOP_LEFT): remove define - (TOP_CENTER): likewise - (TOP_RIGHT): likewise - (CENTER_LEFT): likewise - (CENTER_CENTER): likewise - (CENTER_RIGHT): likewise - (BOTTOM_LEFT): likewise - (BOTTOM_CENTER): likewise - (BOTTOM_RIGHT): likewise - (struct rp_window): rename field to position to gravity. - (struct rp_defaults): rename win_pos to win_gravity, trans_pos to - trans_gravity and maxsize_pos to maxsize_gravity. - (rp_restart): remove global variable - (rp_kill): likewise - - * src/communications.h (send_kill): remove prototype - (send_restart): likewise - - * src/communications.c (send_restart): remove function. obsolete. - (send_kill): likewise - - * src/bar.c (bar_x): Use X11 gravity constants to denote location. - (bar_y): likewise - - * src/actions.h (cmd_focusup): new prototype - (cmd_focusdown): likewise - (cmd_focusleft): likewise - (cmd_focusright): likewise - (cmd_startup_message): likewise - (cmd_restart): likewise - - * src/actions.c (cmd_quit): just set the kill_signalled variable. - (parse_wingravity): use compass directions to describe the gravity - (parse_wingravity): renamed from parse_winpos. dependant code - updated. - (cmd_gravity): renamed from cmd_pos. dependant code updated. - (cmd_defwingravity): renamed from cmd_defwinpos. dependant code - updated. - (cmd_deftransgravity): renamed from cmd_deftranspos. dependant - code updated. - (cmd_defmaxsizegravity): renamed from cmd_defmaxsizepos. dependant - code updated. - (cmd_focusup): new function - (cmd_focusdown): likewise - (cmd_focusleft): likewise - (cmd_focusright): likewise - (cmd_restart): likewise - (cmd_startup_message): likewise - (user_commands): new commands "focusup" "focusdown" "focusright" - "focusleft" "startup_message" "restart". - -2001-09-18 shawn <sabetts@vcn.bc.ca> - - * src/list.c (window_name): make sure the default window name is - not NULL. In this case return win's user_name field which is never - NULL. - -2001-09-18 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c(user_commands)[0]: remove "lastmsg" from the list. - (cmd_defwinpos): abort if data is NULL - (cmd_deftranspos): likewise - (cmd_defmaxsizepos): likewise - (cmd_defmaxsizepos): Use the correct command name in call to message. - (cmd_deftranspos): likewise - (cmd_defwinpos): likewise - - * src/actions.h (cmd_info): new prototype - (cmd_lastmsg): likewise - - * src/bar.h (show_last_message): new prototype - - * src/bar.c: new static globals last_msg, lash_mark_start, and last_mark_end. - (marked_message): Store the message in last_msg. - (show_last_message): new function - - * src/actions.c (cmd_info): new function - (cmd_lastmsg): likewise - (user_commands): new commands "info" and "lastmsg" - (initialize_default_keybindings): Add key bindings for "info" and - "lastmsg". - -2001-09-17 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.h (cmd_unsetenv): new prototype - - * src/actions.c (cmd_unsetenv): new function - (user_commands): new "unsetenv" command - - * src/ratpoison.h (xstrdup): new prototype - - * src/main.c (xstrdup): new function. All calls to strdup replaced - with calls to xstrdup. - (main): Keep a list of all commands pasted in through the -c command-line option. - (main): execute all commands pasted in through the -c command-line option. - - * src/actions.h (cmd_chdir): new prototype - - * src/actions.c (cmd_clock): rename to cmd_time. Dependant code - updated. - (user_commands): rename "clock" command to "time". - (cmd_chdir): new function - (user_commands): new command "chdir". - -2001-09-16 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c (update_all_gcs): new function - (cmd_deffont): update the graphics contexts. - - * src/list.c (format_window_name): Use 2 character escape codes, - like printf. Dependant code updated. - - * configure.in: check for setpgrp. - - * src/actions.c (spawn): Only call setsid if it exists. - (spawn): Only call setpgid if it exists. - (spawn): if setpgid doesn't exist, try setpgrp. - - * configure.in: check for setsid and setpgid functions. Add - contrib/Makefile to AC_OUTPUT. - - * Makefile.am (SUBDIRS): add contrib - -2001-09-14 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c (spawn): set the process group ID and session ID - for the spawned process. - -2001-09-13 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c (command): Gobble the whitespace between the - command and the argument list. Code that did this in specific - commands has been removed. - (cmd_setenv): new function - (cmd_meta): rename from cmd_generate. All dependant code updated. - (cmd_redisplay): rename from cmd_maximize. All dependant code - updated. - (initialize_default_keybindings): bind "redisplay" to C-t l and - C-t c-l. - (cmd_msgwait): rename from cmd_defbartimeout. All dependant code - updated. - - * src/input.c (update_input_window): Draw a cheap-o cursor - -2001-09-12 Gergely Nagy <algernon@debian.org> - - * src/actions.c (cmd_bind): binding an empty string to a key will - unbind the key. - -2001-09-09 shawn <sabetts@diggin.lamenet.tmp> - - * src/conf.h (MAXSIZE_WINDOWS_ARE_TRANSIENTS): defined - - * src/split.c (set_active_frame): give the key_window focus when - no window has focus. - (blank_frame): give the key_window focus. - - * src/main.c (init_screen): don't listen for keystrokes on the - root window. - (main): give the key_window focus in the case that no window has - focus. - - * src/bar.c (marked_message): use the screen_info fg_color and - bg_color to create the inverse GC. - - * src/actions.h (cmd_deffgcolor): new prototype - (cmd_defbgcolor): new prototype - - * src/actions.c (cmd_defbartimeout): merge the 2 ifs. - (cmd_defbartimeout): verify that the number is positive. - (cmd_defborder): likewise - (cmd_defwinname): gobble leading whitespace. Use strings as - arguments, not numbers. - (cmd_windows): Use the argument as a window format string in - non-interactive mode. - (cmd_windows): if data is NULL use the default format string. - (user_commands): new commands deffgcolor, defbgcolor. - (update_gc): new function - (cmd_deffgcolor): likewise - (cmd_defbgcolor): likewise - -2001-09-08 shawn <sabetts@diggin.lamenet.tmp> - - * src/list.h (update_window_position): new prototype - (window_name): new prototype - (get_window_list): update prototype - - * src/events.c (grab_rat): Don't wrap in an #ifdef - (ungrab_rat): likewise - (handle_key): record if the rat is grabbed and only ungrab it at - the end if it was first grabbed. - - * src/actions.h (cmd_pos): new prototype - (cmd_defwinpos): new prototype - (cmd_deftranspos): new prototype - (cmd_defmaxsizepos): new prototype - (cmd_defbartimeout): new prototype - (cmd_defbarloc): new prototype - (cmd_deffont): new prototype - (cmd_defpadding): new prototype - (cmd_defborder): new prototype - (cmd_definputwidth): new prototype - (cmd_defwaitcursor): new prototype - (cmd_defwinfmt): new prototype - (cmd_defwinname): new prototype - - * src/messages.h (MESSAGE_FRAME_STRING): new message - - * src/manage.c (get_wmname): renamed from get_window_name - (get_class_hints): new function - (get_res_name): likewise - (get_res_class): likewise - (update_window_name): update the window's wm_name, res_name, and - res_class fields. - (update_window_name): calls functions get_wmname, get_res_name, - get_res_class. - (update_window_name): Don't crop the window name. - (update_window_information): call update_window_position. - (move_window): new function - (maximize_transient): only set the window's width and height - fields. - (maximize_normal): likewise - (maximize): call move_window - (force_maximize): likewise - (force_maximize): if the window has resize hints, resize it 1 - resize unit. - - * src/main.c: new global variable, defaults. remove static - variable, font, and move to defaults. Dependant code updated. - (init_defaults): new function - (main): call init_defaults. - (init_screen): initialize the screen's fg_color to black and - bg_color to white. - - * src/list.c (free_window): free the fields user_name, res_name, - res_class, and wm_name. - (update_window_position): new function - (window_name): new function. Code accessing a window's name uses - this function. All code updated. - (add_to_window_list): call update_window_position - (add_to_window_list): initialize wm_name, res_name, and res_class - for the new window. - (format_window_name): new function - (get_window_list): Add parameter fmt. All callers updated. - (get_window_list): call format_window_name. - - * src/conf.h: move Configuration variables to the global variable, - defaults. Dependant code updated. - - * src/data.h (TOP_LEFT): new define - (TOP_CENTER): likewise - (TOP_RIGHT): likewise - (CENTER_LEFT): likewise - (CENTER_CENTER): likewise - (CENTER_RIGHT): likewise - (BOTTOM_LEFT): likewise - (BOTTOM_CENTER): likewise - (BOTTOM_RIGHT): likewise - (struct rp_window): new fields user_name, wm_name, res_name, - res_class, position. - (struct rp_window): remove field name. Replaced with - user_name. Dependant code updated. - (struct screen_info): remove field font. dependant code updated. - (struct screen_info): new fields fg_color, bg_color. - (struct rp_defaults): new struct - (defaults): new global - - * src/actions.c (parse_winpos): new function - (cmd_pos): likewise - (cmd_defwinpos): likewise - (cmd_deftranspos): likewise - (cmd_defmaxsizepos): likewise - (cmd_defbartimeout): likewise - (cmd_defbarloc): likewise - (cmd_deffont): likewise - (cmd_defpadding): likewise - (cmd_defborder): likewise - (cmd_definputwidth): likewise - (cmd_defwaitcursor): likewise - (cmd_defwinfmt): likewise - (cmd_defwinname): likewise - (user_commands): New commands defbarloc, defbartimeout, defborder, - deffont, defintputwidth, defmaxsizepos, defpadding, deftranspos, - defwaitcursor, defwinfmt, defwinname, defwinpos. - -2001-09-06 shawn <sabetts@diggin.lamenet.tmp> - - * configure.in: Use AC_CHECK_FUNCS to check for getopt and - getopt_long. - -2001-09-06 Gergely Nagy <algernon@debian.org> - - * doc/ratpoison-mode.el: major mode for editing .ratpoisonrc files - * doc/Makefile.am (EXTRA_DIST): added ratpoison-mode.el - - * debian/changelog: Updated to version 1.0.0 - - * doc/sample.ratpoisonrc: change escape ^a to escape C-a, to - reflect the new key naming scheme - - * ratpoison.spec: bring it up to date, and add %doc stuff - -2001-09-06 shawn <sabetts@diggin.lamenet.tmp> - - * src/manage.c (grab_prefix_key): call grab_key. - (ungrab_prefix_key): use AnyModifier as the modifier mask param to - XUngrabKey. - - * src/input.h (grab_key): new protoype - - * src/input.c (update_modifier_map): find the numlock and scroll - lock modifiers. - (grab_key): new function - (cook_keycode): new param ignore_mad_mods. protoype updated. all - callers updated. - (cook_keycode): ignore caps lock, numlock and scroll lock - modifiers when ignore_bad_mods param is non-zero. - - * src/events.c (key_press): ignore numlock, scroll lock, and caps - lock modifiers when cooking the prefix key. - - * src/data.h (struct modifier_info): new fields num_lock_mask, - scroll_lock_mask. - -2001-09-05 shawn <sabetts@diggin.lamenet.tmp> - - * src/main.c (show_welcome_message): If the help key is bound to ? - then print ? instead of `question'. - - * configure.in: check for getopt and getopt_long. - - * src/getopt.c: wrap the whole file in an #ifndef HAVE_GETOPT_LONG - - * src/getopt1.c: wrap the whole file in an #ifndef HAVE_GETOPT_LONG - - * src/messages.h (MESSAGE_WELCOME): The help keystroke is not - hardcoded. - - * src/main.c (show_welcome_message): new function - (main): call show_welcome_message to show the welcome message. - - * src/actions.h (find_keybinding_by_action): new prototype - - * src/actions.c (key_actions): change to a static variable. - (key_actions_last): likewise - (key_actions_table_size): likewise - (find_keybinding_by_action): new function - -2001-09-04 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.h (cmd_unbind): new prototype - - * src/actions.c (find_keybinding): Change the first parameter's - type to KeySym. Prototype updated. - (add_keybinding): likewise - (remove_keybinding): new function. - (key_actions): new command 'unbind'. - (key_actions): #if out the unimplemented bindings. - (cmd_bind): Error messages are more accurate. - (cmd_unbind): new function. - (cmd_escape): update the "other" command before the "generate" - command. - (cmd_escape): When searching for the "other" and "generate" - commands' keystrokes, verify that the located action is the right - command. - -2001-08-31 Shawn <sabetts@hotdog> - - * src/split.c (set_active_frame): Only show the frame indicator - when switching to a new frame and when there is more than 1 frame. - - * src/actions.c (cmd_next_frame): display MESSAGE_NO_OTHER_FRAME - when there is only 1 frame. - - * src/messages.h (MESSAGE_NO_OTHER_FRAME): new message - - * src/split.c (hide_frame_indicator): always hide the frame - indicator. - (blank_frame): don't show the frame indicator. - - * src/manage.c (maximize_normal)[MAXSIZE_WINDOWS_ARE_TRANSIENTS]: - win are centered properly in the frame. - -2001-08-29 Shawn <sabetts@hotdog> - - * src/manage.c (unhide_window): always raise the window. - -2001-08-27 Shawn <sabetts@hotdog> - - * src/actions.c (cmd_clock): pad the time with spaces on either - side. - - * src/manage.c (maximize_normal)[MAXSIZE_WINDOWS_ARE_TRANSIENTS]: - use maxx, maxy not the window's width and height. - - * src/events.c (handle_key): use marked_message_printf to notify - user of an unbound key. - - * src/messages.h (MESSAGE_RAISE_TRANSIENT): new message - (MESSAGE_RAISE_WINDOW): likewise - (MESSAGE_MAP_TRANSIENT): likewise - (MESSAGE_MAP_WINDOW): likewise - - * src/manage.c (update_window_information): update the - transient-ness of the window. - (maximize_normal)[MAXSIZE_WINDOWS_ARE_TRANSIENTS]: center the - window. - (map_window): use the appropriate define in messages.h to notify - the user about the new window. - - * src/list.h: remove prototypes unhide_transient_for, - is_transient_ancestor, hide_transient_for, - hide_transient_for_between from compilation. - - * src/list.c (unhide_transient_for): remove from compilation - (hide_transient_for_between): likewise - (hide_transient_for): likewise - (is_transient_ancestor): likewise - (set_active_window)[[MAXSIZE_WINDOWS_ARE_TRANSIENTS]: Don't hide the - other windows if the window has a max size hint. - (print_window_information): use marked_message_printf - - * src/events.c (cleanup_frame): restructure - (cleanup_frame)[MAXSIZE_WINDOWS_ARE_TRANSIENTS]: Don't hide the - other windows if the window has a max size hint. - (unmap_notify): don't try to locate the event's screen. - (unmap_notify): if the window wasn't found, return immediately. - (map_request): restructure. reword debugging output - (map_request): use the appropriate define in messages.h to notify - the user about window raise requests. - (configure_request): likewise - (property_notify): Handle the transient_for notify. - - * src/conf.h (MAXSIZE_WINDOWS_ARE_TRANSIENTS): new customization - - * src/bar.c (show_bar): map and raise the window - (marked_message): likewise - (marked_message): crop the mark_end and mark_start to the - boundaries of the message. - (marked_message): calculate the end of the marked part of the - message correctly. - - * src/actions.c (cmd_delete): use PRINT_DEBUG for debug messages. - (command): use marked_message_printf - (cmd_echo): likewise - (cmd_rudeness): pad messages with spaces. - -2001-08-26 Shawn <sabetts@hotdog> - - * src/events.c (configure_request): make sure the window is iconic - before notifying a raise request. - - * src/split.c (num_frames): uncomment. - (set_active_frame): only show the frame indicator if, in addition, - there are more than 1 frames. - (set_active_frame): give the root window focus if there is no - current window. - (blank_frame): only show the frame indicator if, in addition, - there are more than 1 frames. - -2001-08-24 Shawn <sabetts@hotdog> - - * src/input.c (get_more_input): detect and handle a user abort key - sequence. - - * src/conf.h (INPUT_ABORT_KEY): new define - (INPUT_ABORT_MODIFIER): likewise - - * src/actions.c (cmd_select): handle a user abort. - (cmd_rename): likewise - (cmd_colon): likewise - (cmd_exec): likewise - (cmd_newwm): likewise - -2001-08-23 Shawn <sabetts@hotlunch> - - * src/manage.c (maximize_normal): In the new height on windows - with increment hints code, reorder the steps. - (map_window): conditionally map the window based on the rudeness - level. - - * src/main.c (rp_honour_transient_raise): new global declaration - (rp_honour_transient_map): likewise - (rp_honour_normal_raise): likewise - (rp_honour_normal_map): likewise - - * src/events.c (map_request): conditionally map the window based - on the rudeness level. - (configure_request): conditionally raise the window based on the - rudeness level. - (configure_request): only maximize the window if the height, - width, border, or position was changed. - - * src/data.h (rp_honour_transient_raise): new global - (rp_honour_normal_raise): likewise - (rp_honour_transient_map): likewise - (rp_honour_normal_map): likewise - - * src/bar.h (marked_message_printf): new prototype - - * src/bar.c: include stdarg.h - (marked_message_printf): new function - - * src/actions.h (cmd_rudeness): new prototype - - * src/actions.c (user_commands): new command 'rudeness' - (cmd_rudeness): new function - -2001-08-22 Shawn <sabetts@hotdog> - - * src/split.h (set_frames_window): new prototype - (maximize_all_windows_in_frame): likewise - - * src/split.c (set_frames_window): new function. all code setting - a frame's window updated to use this function. - (maximize_all_windows_in_frame): new function - (find_window_for_frame): don't include windows that are mapped in - another frame (not necessarily the frames active window). - (split_frame): maximize all windows in the existing frame, not - just the active one. - (split_frame): comment out unhiding transient window code. - (remove_all_splits): hide all mapped windows not in the current - frame. - (remove_all_splits): maximize all windows mapped in the current - frame. - (remove_all_splits): comment out hiding transient window code. - (remove_frame): when a frame's size has been changed, maximize all - windows in that frame. - (remove_frame): hide all windows in the frame being removed. - - * src/manage.h (hide_others): new prototype - - * src/manage.c (hide_window): set win's frame to NULL. - (unhide_window_below): renamed frame unhide_below_window. All - callers updated. - (hide_others): new function - - * src/list.c (set_active_window): comment out hiding transient - window code. - - * src/events.c (cleanup_frame): comment out hiding transient - window code. - - * src/data.h (struct rp_window): new field 'frame'. - - * src/actions.c (cmd_help): initialize old_i to 0 - - * src/list.c (set_active_window): Don't hide last_win's transient_for - windows if last_win and win share the same transient_for window. - - * src/events.c (cleanup_frame): Don't hide last_win's transient_for - windows if last_win and win share the same transient_for window. - -2001-08-20 Shawn <sabetts@hotdog> - - * src/events.c (cleanup_frame): set the new window's frame before - maximizing it. - -2001-08-19 Shawn <sabetts@hotdog> - - * src/events.c (cleanup_frame): unhide the new active window - before hiding the last window - - * src/list.c (set_active_window): unhide the new active window - before hiding the last window. - -2001-08-18 Shawn <sabetts@hotdog> - - * src/actions.c (cmd_bind): Gobble whitespace between keystroke and command. - (cmd_help): keystrokes and commands no longer overlap. - - * src/events.c (configure_request): grant Iconized and Withdrawn - windows any geometry they like. - - * src/list.c (is_transient_ancestor): make sure tmp is a valid - pointer before testing if it is a transient. - - * src/main.c (read_rc_file): free the command's result string. - - * src/list.h (get_window_list): new prototype - - * src/list.c (get_window_list): new function - - * src/events.c (handle_key): free the command's result string. - (receive_command): send the command's result string if there is - one, otherwise send NULL. - - * src/communications.c (recieve_command_result): only print the - result if the string is not empty. - - * src/bar.c (update_window_names): calls get_window_list. - - * src/actions.c (cmd_windows): return a list of the windows when - called non-interactively. - (cmd_colon): free the command result. - - * src/actions.c: command functions have been changed to return a - result string and take a parameter that tells the function if it - was called interactively or not. All callers updated. - - * src/split.c (split_frame): unhide transient_for windows as well - as the active window. - (remove_all_splits): hide transient_for windows as well as the - frame's active window. - - * src/manage.c (unhide_below_window): always lower the window - - * src/list.h (hide_transient_for_between): new prototype - (is_transient_ancestor): likewise - - * src/list.c (hide_transient_for_between): new function - (hide_transient_for): calls hide_transient_for_between - (is_transient_ancestor): new function - (set_active_window): don't temporarily hide windows that the newly - active window is a transient for (removes unnecessary flicker). - - * src/events.c (cleanup_frame): don't temporarily hide windows that the new - window is a transient for (removes unnecessary flicker). - -2001-08-07 Ryan Yeske <rcyeske@vcn.bc.ca> - - * doc/ratpoison.texi: Fix spelling and grammar. - -2001-06-29 Gergely Nagy <8@free.bsd.hu> - - * Makefile.am: do not include debian/ in the tarball - * configure.in: better xterm checking, fixes #430631 - -2001-06-11 shawn <sabetts@diggin.lamenet.tmp> - - * src/events.c (grab_rat): wrap in ifdef - (ungrab_rat): likewise - (handle_key): only change the mouse icon if USE_WAITFORKEY_CURSOR is - defined. - - * src/conf.h (USE_WAITFORKEY_CURSOR): new define - -2001-06-10 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c (cmd_generate): return if there is no current - window. - - * src/split.c (split_frame): empty frames can be split. - - * src/main.c (rp_rat_bits): remove - (rp_rat_mask_bits): remove include <X11/cursorfont.h> - (sighandler): only increment kill_signalled - (hup_handler): only increment hup_signalled - (alrm_handler): only increment alarm_signalled - (read_startup_files): use PRINT_ERROR for error messages. - (init_rat_cursor): Use a standard X cursor for the screen's rat. - - * src/events.h (unmap_notify): remove prototype - (delegate_event): likewise - (key_press): likewise - (keymapstate): likewise - (map_request): likewise - - * src/events.c: includes <signal.h> <sys/time.h> and <error.h> - (new_window): static function - (unmap_notify): likewise - (map_request): likewise - (destroy_window): likewise - (configure_notify): likewise - (configure_request): likewise - (key_press): likewise - (property_notify): likewise - (colormap_notify): likewise - (delegate_event): likewise - (get_event): new function - (more_destroy_events): remove function - (handle_events): call get_event. - - * src/data.h: rp_current_event is an XEvent dependant code - updated. new globals alarm_signalled, kill_signalled, - hup_signalled. - - * src/actions.c (initialize_default_keybindings): new bindings for - "split" and "vsplit". - -2001-06-06 Shawn Betts <sabetts@van.gobasis.com> - - * src/list.c (unhide_transient_for): abort if the transient_for - window can't be found. - (hide_transient_for): likewise - -2001-06-01 Shawn Betts <sabetts@van.gobasis.com> - - * src/events.c (map_request): If the window is iconified call - set_active_window on it. - -2001-06-05 shawn <sabetts@diggin.lamenet.tmp> - - * src/list.c (set_active_window): calls give_window_focus which - was accidentally removed. - - * src/actions.c (parse_keydesc): return NULL if the keydesc is a - '-'. - - * src/manage.c (hide_window): ignore only StructureNotify events. - - * src/data.h (WIN_EVENTS): Add StructureNotifyMask. - - * src/events.c (unmap_notify): ignore SubstructureNotify unmaps. - -2001-06-02 shawn <sabetts@diggin.lamenet.tmp> - - * src/split.c (blank_frame): hide transient's transient_for. - - * src/manage.c (unhide_below_window): new function - - * src/manage.h (unhide_below_window): new prototype - - * src/list.h (unhide_transient_for): new prototype - (hide_transient_for): likewise - - * src/list.c (unhide_transient_for): new function - (hide_transient_for): likewise - (set_active_window): print the name of the last and new windows. - (set_active_window): unhide new window's transient_for. hide old - window's transient_for. - - * src/events.c (cleanup_frame): hide any transients for the old - window and unhide any transients for the new one. - - * src/manage.c (hide_window): ignore unmap_notify events when - unmapping the window. - - * src/list.c (add_to_window_list): use WIN_EVENTS in XSelectInput. - - * src/data.h (struct rp_window): remove iconizing field. remove - code using iconizing. - (WIN_EVENTS): new define - -2001-06-01 shawn <sabetts@diggin.lamenet.tmp> - - * src/events.c (cleanup_frame): hide the frame's window's - transient_for windows. - -2001-05-24 Shawn Betts <sabetts@van.gobasis.com> - - * src/events.c (colormap_notify): ignore badwindows when - retrieving and installing the colormap. - - * src/manage.c (withdraw_window): ignore badwindows during all - Xlib calls. - -2001-05-22 Shawn Betts <sabetts@van.gobasis.com> - - * src/actions.c (cmd_generate): only generate the event if there - is a current window. - -2001-05-18 Shawn Betts <sabetts@van.gobasis.com> - - * src/input.c (update_modifier_map): rename from - init_modifier_map. all callers updated. prototype updated. - - * src/events.c (mapping_notify): new function - (delegate_event): handle MappingNotify events. - -2001-05-09 Gergely Nagy <8@free.bsd.hu> - - * ratpoison.spec: spec file for rpm-based systems - -2001-05-03 Gergely Nagy <8@free.bsd.hu> - - * debian/control: adjust build-depends to potato - * debian/rules: fixed, so it works under both potato - and woody/sid - -2001-04-19 Shawn Betts <sabetts@van.gobasis.com> - - * src/manage.c (unhide_window): map and raise the window. - -2001-04-18 shawn <sabetts@diggin.lamenet.tmp> - - * src/input.c (keysym_to_string): handles control, meta, alt, - hyper, and super modifiers. Returns full keysym names. - - * src/actions.c (parse_keydesc): parses control, meta, alt, hyper, - and super modifiers. - (cmd_clock): sets the last character in msg to 0. - -2001-04-15 shawn <sabetts@diggin.lamenet.tmp> - - * src/split.c (show_frame_indicator): contents of - update_frame_indicator merged into here. - (update_frame_indicator): remove function - - * src/number.h (add_window_number): new prototype - - * src/number.c (add_window_number): renamed from - add_to_list. Dependant code updated. - - * src/messages.h (MESSAGE_WINDOW_INFORMATION): new define - - * src/list.h (print_window_information): new prototype - - * src/list.c (print_window_information): new function - - * src/actions.h (cmd_number): new prototype - - * src/actions.c (cmd_clock): remove newline from date string. - (cmd_rename): passes current_screen() to update_window_names. - (cmd_number): new function - - * src/messages.h (MESSAGE_WELCOME): new define - - * src/manage.c (scanwins): ignore the help window - (hide_window): increment window's iconizing variable - - * src/main.c (main): display welcoming message - (init_screen): create the help window - (init_screen): don't map the frame indicator window - (clean_up): destroy the help window - - * src/list.c (add_to_window_list): initialize iconizing to 0 - - * src/events.c (new_window): skip help_window - (unmap_notify): skip normal processing if the event is from - iconizing the window. - (unmap_notify): clean up the window's frame if it is being - withdrawn. - - * src/data.h (struct screen_info): new variable help_window - - * src/bar.c (update_window_names): only print the window list if - the bar is already displaying the window list. - - * src/actions.h (cmd_help): new prototype - (cmd_quit): likewise - - * src/actions.c (initialize_default_keybindings): new keybinding for "help" - (cmd_quit): new function - (cmd_help): likewise - -2001-04-13 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c (cmd_clock): doesn't allocate memory. displays the - date. - - * src/split.h (blank_frame): new prototype - - * src/split.c (split_frame): calls unhide_window after maximizing - the new frame's window. - (remove_all_splits): hide all windows but the current one - (remove_all_splits): maximize the current window in its newly - resized frame. - (remove_frame): hide the frame's window after removing it from the - list. - (blank_frame): new function - - * src/manage.h (withdraw_window): new prototype - (hide_window): likewise - (unhide_window): likewise - - * src/manage.c (scanwins): glob ignored windows into 1 if - statement. - (scanwins): set the window's state to NormalState before calling - map_window. - (set_state): sets win->state - (map_window): calls set_state - (hide_window): new function - (unhide_window): likewise - (withdraw_window): new function - - * src/main.c (main): setup error handlers after --command, - --restart, and --kill commands have been processed. - (main): doesn't call set_active_window - (init_screen): XSync's after selecting ewents on the root window. - (clean_up): map iconized windows - - * src/list.h (give_window_focus): prototype updated - - * src/list.c (give_window_focus): takes a second argument, - last_win. - (give_window_focus): calls unhide_window - (give_window_focus): uses last_win instead of current_window() - (set_active_window): hides the last window and unhides the new - window. - (set_active_window): calls give_window_focus - - * src/events.c (cleanup_frame): maximizes the frame's new window - (unmap_notify): do nothing if the window is in the iconic - state. Withdraw the window if it is in the normal state. - (map_request): calls unhide_window if the window is iconized. Do - nothing if it is already mapped. - (destroy_window): tightened up - (client_msg): detects iconize requests from clients. - - * src/data.h (STATE_UNMAPPED): remove. Dependant code uses - WithdawnState in its stead. - (STATE_MAPPED): likewise. Dependant code uses NormalState in its - stead - - * src/actions.c (initialize_default_keybindings): new keybinding - - bound to "select -" - (cmd_select): the string "-" selects a blank window - -2001-04-12 shawn <sabetts@badbox.secure.basis.org> - - * src/main.c (main): calls XCloseDisplay before exitting after - sending a kill, restart, or command message. - -2001-04-10 Gergely Nagy <algernon@debian.org> - - * src/main.c (main): initialize command to NULL, silences an - annoying warning - - * debian/rules: sync it up a bit, so it works with both - the current CVS ratpoison - - * debian/ratpoison.examples: new file listing examples installed - to /usr/share/doc/ratpoison/examples - -2001-04-08 shawn <sabetts@diggin.lamenet.tmp> - - * src/main.c (clean_up): destroys resources stored in screens - (init_rat_cursor): frees the pixmaps - -2001-04-06 shawn <sabetts@diggin.lamenet.tmp> - - * src/split.h (hide_frame_indicator): new prototype - (show_frame_indicator): likewise - - * src/split.c: include <unistd.h> - (split_frame): set the new_frame's window to NULL - (split_frame): calls show_frame_indicator once the split is done. - (set_active_frame): only call show_frame_indicator if the frame - has no window or if we switched to a different frame. - (update_frame_indicator): prints FRAME_STRING in the frame - indicator window. - (hide_frame_indicator): new function - (show_frame_indicator): likewise - - * src/main.c (rp_rat_bits): new variable - (rp_rat_mask_bits): likewise - (alrm_handler): calls hide_frame_indicator - (init_rat_cursor): new function - (init_screen): calls init_rat_cursor - - * src/events.c (unmap_notify): calls set_active_frame if the - window being unmapped was in the current frame - (destroy_window): calls set_active_frame if the - window being destroyed was in the current frame - (grab_rat): new function - (grab_rat): likewise - (handle_key): calls grab_rat and ungrab_rat - - * src/data.h (struct screen_info): new variable rat - - * src/conf.h (FRAME_INDICATOR_TIMEOUT): new #define - (FRAME_STRING): likewise - (RAT_HEIGHT): likewise - (RAT_WIDTH): likewise - (RAT_HOT_X): likewise - (RAT_HOT_Y): likewise - - * src/actions.h (cmd_curframe): new prototype - - * src/actions.c (initialize_default_keybindings): new key binds - for "curframe" - (user_commands): new command "curframe" - (cmd_curframe): new function - - * src/split.c (remove_all_splits): only maximize the current - window if there is one. - (maximize_frame): remove unused code to retrieve the current - screen_info. - - * src/actions.c (cmd_h_split): calls h_split_frame on the current - frame. - (cmd_v_split): likewise - (cmd_only): even if the current frame is empty, call - remove_all_splits. - - * src/split.c (maximize_frame): new function - (create_initial_frame): calls maximize_frame to fill in the - initial frame's fields. - (num_frames): comment out - (remove_frame): remove special case when there is only 1 frame - left. - - * src/split.h (h_split_frame): renamed frome h_split_window - (v_split_frame): renamed frome v_split_window - (split_frame): renamed frome split_window - (remove_all_splits): renamed frome remove_all_frames - (find_windows_frame): new prototype - (find_frame_next): likewise - (find_frame_prev): likewise - (current_window): likewise - (init_frame_list): likewise - (set_active_frame): likewise - - * src/split.c (create_initial_frame): new function - (init_frame_list): likewise - (find_windows_frame): likewise - (find_frame_next): likewise - (find_frame_prev): likewise - (current_window): likewise - (update_frame_indicator): likewise - (set_active_frame): likewise - (split_frame): rename from split_window - (v_split_frame): rename from v_split_window - (h_split_frame): rename from h_split_window - (remove_all_splits): renamed frome remove_all_frames - (total_frame_area): traverses rp_window_frame list - (num_frames): likewise - (frame_overlaps): likewise - (remove_frame): likewise - (remove_frame): calls delete_frame_from_list - - * src/manage.c (scanwins): skips the frame_window - (maximize_transient): finds the window's frame - (maximize_normal): likewise - - * src/main.c (main): calls init_frame_list - (init_screen): create and map the frame_window - - * src/list.c (give_window_focus): new function - (goto_window): likewise - (set_active_window): calls give_window_focus - - * src/list.h (give_window_focus): new prototype - (goto_window): likewise - - * src/events.c (new_window): the screen's frame_window is not - managed - (cleanup_frame): new function - (unmap_notify): calls cleanup_frame if window exists in a frame - (destroy_window): likewise - - * src/data.h (struct screen_info): remove frame field - (struct rp_window_frame): new fields win, prev, next - (rp_window_frame_sentinel): new global - - * src/actions.c (cmd_prev): jumps to last accessed window if - current frame is empty. - (cmd_next): likewise - (cmd_remove): nothing is done if only 1 frame exists - - * src/data.h (struct screen_info): new field frame_window - (rp_current_frame): new global - (rp_current_window): removed. All dependant code updated. - -2001-04-04 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c: add :banish to user_commands. - (initialize_default_keybindings): Add keybinding for :banish. - (cmd_banish): New function. - -2001-04-01 shawn <sabetts@diggin.lamenet.tmp> - - * src/manage.c (maximize_normal): fixed maximizing problems for - windows with resize hints. - (maximize_transient): likewise - -2001-03-31 shawn <sabetts@diggin.lamenet.tmp> - - * src/split.h (find_window_for_frame): new function prototype - (find_window_for_frame): likewise - (find_window_for_frame): likewise - (find_window_for_frame): likewise - (find_window_for_frame): likewise - - * src/split.c (window_fits_in_frame): new function - (find_window_for_frame): likewise - (split_window): likewise - (v_split_window): likewise - (h_split_window): likewise - (remove_all_frames): likewise - (frame_is_below): likewise - (frame_is_above): likewise - (frame_is_left): likewise - (frame_is_right): likewise - (total_frame_area): likewise - (num_frames): likewise - (frames_overlap): likewise - (frame_overlaps): likewise - (remove_frame): likewise - - * src/ratpoison.h: includes "split.h" - - * src/manage.c (unmanage): calls free_window - (maximize_transient): takes the window's frame into account - (maximize_normal): likewise - - * src/list.h (find_window_prev_with_frame): new function prototype - (find_window_next_with_frame): likewise - (free_window): likewise - - * src/list.c (free_window): new function - (add_to_window_list): initialize new window's frame to NULL. - (find_window_prev): skips windows with frames - (find_window_next): likewise - (find_window_other): likewise - (find_window_prev_with_frame): new function - (find_window_next_with_frame): new function - (set_active_window): returns if the specified window is already - the current window. - (set_active_window): If the new window has no frame it inherits - the current window's frame. - (set_active_window): maximize and raise the newly active window. - - * src/events.c (unmap_notify): handles window frames. - (destroy_window): simplified - - * src/data.h (struct rp_window_frame): new struct - (struct rp_window): add frame variable - - * src/conf.h (WINDOW_BORDER_WIDTH): set to 1 - - * src/actions.h (cmd_next_frame): new function prototype - (cmd_prev_frame): likewise - (cmd_h_split): likewise - (cmd_v_split): likewise - (cmd_only): likewise - (cmd_remove): likewise - - * src/actions.c (initialize_default_keybindings): new default - bindings for "split", "vsplit", "focus", "only", "remove" - (user_commands): new user commands "split", "vsplit", "focus", - "only", "remove" - (cmd_prev_frame): new function - (cmd_next_frame): likewise - (cmd_h_split): likewise - (cmd_v_split): likewise - (cmd_only): likewise - (cmd_remove): likewise - - * src/Makefile.am (ratpoison_SOURCES): new files split.c split.h - -2001-03-31 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * doc/ipaq.ratpoisonrc: Use keysym names. - -2001-03-28 Shawn <sabetts@vcn.bc.ca> - - * src/main.c (main): initialize rp_command_request and - rp_command_result. - - * src/data.h (rp_command_request): new global - (rp_command_result): new global - - * src/events.c (execute_remote_command): new function - (receive_command): loops through the list of command requests - calling execute_remote_command on each one. - (property_notify): better detection of command requests. - - * src/communications.c (recieve_command_result): new function - (send_command): creates a new window to attach the command - to. Waits for confirmation that the command has been executed. - - * src/actions.h (cmd_echo): new prototype - - * src/actions.c (cmd_echo): new function - (user_commands): update "echo" entry - -2001-03-22 Gergely Nagy <8@free.bsd.hu> - - * debian/control: removed build-dependency on x-terminal-emulator, - downgraded xterm | x-terminal-emulator dependency to a recommends - only - -2001-03-19 shawn <sabetts@diggin.lamenet.tmp> - - * src/main.c (ratpoison_longopts): add --command to recognized - command-line options. - - * src/communications.h (send_command): new function prototype - - * src/data.h (rp_command): new global variable - - * src/events.c (receive_command): new function - (property_notify): handles rp_command Atoms - - * src/communications.c (send_command): new function - - * src/main.c (print_help): prints help for --command - (main): handles --command command-line option - -2001-03-14 shawn <sabetts@diggin.lamenet.tmp> - - * src/events.c (delegate_event): calls focus_change on FocusOut - and FocusIn events. - (focus_change): new function - - * src/list.c (add_to_window_list): add FocusChangeMask to the - window's event mask. - -2001-03-13 shawn <sabetts@diggin.lamenet.tmp> - - * configure.in: warn the user if the x terminal emulator cannot be - found. - - * src/conf.h: replaced the silly c++ style comment around - HIDE_MOUSE with a REAL comment. - - * src/manage.c (update_window_information): updates the window's - border width. - - * src/conf.h (WINDOW_BORDER_WIDTH): new constant - - * src/manage.c (maximize_normal): Set the border width to - WINDOW_BORDER_WIDTH. takes the border width into account when - calculating the position, width, and height. - (maximize_transient): likewise - (maximize): calls XSetWindowBorderWidth to set the window's border - width. - (force_maximize): likewise - -2001-03-07 shawn <sabetts@diggin.lamenet.tmp> - - * doc/Makefile.am (EXTRA_DIST): Added sample.ratpoisonrc and - ipaq.ratpoisonrc - -2001-03-07 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * doc/ipaq.ratpoisonrc: New file. - -2001-03-07 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c (string_to_keysym): New function. - (parse_keydesc): Call string_to_keysym. - - * src/main.c (read_startup_files): Use PRINT_DEBUG to report failure - to load rc files. - - * src/main.c (read_rc_file): Check for comment character '#' in first - column. - (read_rc_file): Fix typo that was resulting in exhausting virtual - memory when parsing rc files. - -2001-03-06 shawn <sabetts@diggin.lamenet.tmp> - - * src/input.c (init_modifier_map): rp_modifier_info masks are or'd - with existing value. - (init_modifier_map): Resolves alt-meta conficts just like emacs. - (cook_keycode): returns a KeySym string. Updated Dependant code. - (read_key): likewise - (get_more_input): copies the KeySym string passed back from - read_key into the input buffer. - - * src/data.h (struct modifier_info): commented out - mode_switch_mask. Dependant code commented out. - - * src/actions.c (cmd_select): the search is not carried out on empty - strings. - - * src/events.c (configure_request): Handles restacking requests. - - * src/main.c: removed rp_mode_switch and rp_numlock. Added - rp_modifier_info global. - (main): calls init_modifier_map. - (init_screen): windows no longer select on KeyRelease and - KeymapState events. - - * src/input.h (init_modifier_map): new prototype - - * src/input.c (init_modifier_map): new function - (cook_keycode): uses rp_modifier_info to get Mode_switch modifier - mask. - (read_key): only listens for key presses. - - * src/events.c (keymap_state): removed function - (key_release): likewise - (delegate_event): removed case for KeymapNotify. - - * src/data.h (struct modifier_info): added mode_switch_mask, removed - shift_lock_mask. removed rp_mode_switch, and - rp_numlock. dependant code updated. - -2001-03-05 shawn <sabetts@diggin.lamenet.tmp> - - * configure.in: bumped version to 0.1.1-cvs - -2001-03-05 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c: remove silly C,M,A,S,H #defines and propagate - changes. - - * src/bar.c (update_window_names): Print a '+' for the last accessed - window. - -2001-03-05 shawn <sabetts@diggin.lamenet.tmp> - - * src/events.c (key_press): set rp_mode_switch to 0 before processing - the key. - - * src/main.c: new globals rp_mode_switch, rp_numlock. - (init_screen): selects on KeyRelease events for the root window, - input_window, and key_window. - (init_screen): selects on KeymapState events for input_window and - key_window. - - * src/input.c (cook_keycode): Handles Mode_switch (aka AltGr). - (read_key): listens for KeyRelease and KeymapState events. - (read_key): updates rp_mode_switch status - - * src/events.h (keymap_state): new prototype - - * src/events.c (keymap_state): new function - (key_release): new function - (key_press): uses cook_keycode to get the event's keysym. - (key_press): updates rp_mode_switch status - (delegate_event): handles KeymapNotify events. - - * src/data.h (struct modifier_info): new struct - new globals rp_mode_switch and rp_numlock. - -2001-03-04 shawn <sabetts@diggin.lamenet.tmp> - - * configure.in: bumbped version number to 0.1.0 - -2001-03-04 Gergely Nagy <8@free.bsd.hu> - - * debian/changelog: bumped version number to 0.1.0 - - * debian/rules: fixed clean target, it failed when there - was no Makefile - - * doc/ratpoison.1: some indentitation fixes, removed the note - that upstream doesn't have a manpage, because it has - -2001-03-03 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c (cmd_bind): Do not pollute the message bar with - chatter about the keybinding. - -2001-03-03 shawn <sabetts@livingston> - - * src/manage.c (maximize_normal): windows with resize increments - resize properly when their original size is > the screen size. - (maximize_transient): likewise - -2001-03-02 shawn <sabetts@diggin.lamenet.tmp> - - * configure.in: adds -g to CFLAGS when debugging is turned on. - - * doc/Makefile.am (EXTRA_DIST): man page comes with the distro. - - * Makefile.am (SUBDIRS): removed man/ - - * configure.in (AC_OUTPUT): removed man/Makefile - removed references to emacs. - - * doc/Makefile.am (man_MANS): ratpoison.1 moved to doc/ - - * doc/ratpoison.texi: minor updates. - - * man/ratpoison.1: added changes from texinfo docs. - -2001-03-02 shawn <sabetts@diggin.lamenet.tmp> - - * src/main.c (print_version): updated copyright notice. - - * src/actions.c (initialize_default_keybindings): removed emacs - binding. - -2001-03-01 shawn <sabetts@diggin.lamenet.tmp> - - * doc/ratpoison.texi (Commands): filled in remaining commands and - keys. - -2001-03-01 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/ratpoison.h (xmalloc, xrealloc, fatal): Prototype. - - * src/main.c (xmalloc): Move here from sbuf.c. - (xrealloc): Likewise. - (fatal): Likewise. - - * src/number.c (find_empty_cell): Use xrealloc, remove error check. - (init_numbers): Likewise. - - * src/manage.c (get_window_name): Likewise. - - * src/main.c (main): Likewise. - - * src/list.c (add_to_window_list): Likewise. - (add_to_window_list): Likewise. - - * src/events.c (handle_key): Likewise. - - * src/input.c (keysym_to_string): Likewise. - (get_more_input): Use xrealloc, remove error check. - - * src/actions.c (cmd_source): Open the file. Error report as - appropriate. - (cmd_windows): Call current_screen() to find the current screen. - (cmd_clock): Show the clock even if no windows are open. - (cmd_clock): Use xmalloc, remove error check. - (initialize_default_keybindings): Use xmalloc. - (cmd_bind): Use xmalloc. - (cmd_rename): Use xmalloc, remove error check. - (add_keybinding): Use xrealloc. - (replace_keybinding): Use xrealloc. - - * src/main.c (read_rc_file): Take a file pointer rather than a - filename. - (read_startup_files): If ~/.ratpoisonrc is not readable try - /etc/ratpoisonrc. - - * src/actions.c: Use PRINT_DEBUG instead of fprintf. Put useful error - text in calls to message(). - (cmd_select): Show the window list if there is no such window - number. - -2001-02-28 shawn <sabetts@badbox.secure.basis.org> - - * src/manage.c (map_window): calls update_window_information. - - * src/manage.h (map_window): new prototype. - - * src/events.c (new_window): calls update_window_information on new windows. - (map_request): calls map_window on managed unmapped windows. - (configure_request): removed commented out old crusty - code. Updates window's structure based on what bits are set in the - event's value_mask. Doesn't honour resize request. Windows are - always maximized. - (property_notify): doesn't call maximize when WM_NORMAL_HINTS are - updated. - - * src/manage.c (manage): no longer maps the window, this code is in - map_window. - (map_window): new function - (maximize): no longer sends a synthetic configure event. - (scanwins): calls map_window on viewable windows. - (update_window_information): renamed from manage. dependant code - updated. - -2001-02-27 shawn <sabetts@diggin.lamenet.tmp> - - * doc/ratpoison.texi (Commands): added escape command - -2001-02-27 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c (cmd_escape): updates the "other" command keybinding - - * src/manage.h (ungrab_prefix_key): new prototype - (grab_prefix_key): likewise - - * src/manage.c (ungrab_prefix_key): new function - - * src/main.c (main): calls initialize_default_keybindings after - init_window_list. - - * src/data.h (struct rp_action): key is of type KeySym. state is - unsigned int. - - * src/conf.h (KEY_PREFIX): set to XK_t - - * src/actions.h (cmd_escape): new prototype - - * src/actions.c (cmd_escape): new function - - * src/data.h (struct key): move from actions.h - (struct rp_key): rename from struct key. dependant code updated. - (prefix_key): new global variable. code dependant on KEY_PREFIX - and MODIFIER_PREFIX updated to use this. - - * src/actions.c: "maximize" user command calls cmd_maximize - (initialize_default_keybindings): initializes prefix_key. - Added "escape" command. - - * src/manage.c (force_maximize): moved from actions.c - (maximize): likewise - (maximize_normal): likewise - (maximize_transient): likewise - - * src/actions.c (cmd_maximize): New function - - * src/main.c (handler): Prepends error message with "ERROR: ". - Displays error in message bar. Returns 0. - - * src/events.c (destroy_window): sets rp_current_window to NULL when - there are no more mapped windows. - (destroy_window): calls set_current_window and find_window_other - directly instead of cmd_other. - -2001-02-26 shawn <sabetts@diggin.lamenet.tmp> - - * src/list.c (save_mouse_position): stores the mouse position relative - to the root window. - (set_active_window): warps the mouse relative to the root window. - - * src/actions.h: prototype for force_maximize added - - * src/actions.c: the user command "maximize" calls force_maximize - (force_maximize): New function - -2001-02-25 shawn <sabetts@diggin.lamenet.tmp> - - * configure.in (AC_OUTPUT): added man/Makefile - - * Makefile.am (SUBDIRS): added man dir - -2001-02-25 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/main.c (read_rc_file): rename from load_rc_file. Remove static - keyword. - (read_startup_files): rename from read_initialization_files. - - * src/actions.c (cmd_prev): Handle situation when there is no other - window. - (cmd_next): Likewise. - (cmd_other): Likewise. - (cmd_source): New function. - -2001-02-24 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/main.c (load_rc_file): new function - (read_initialization_files): new function - (main): read the initialization files - - * src/conf.h: remove themes support - - * src/themes.h: remove file - - * src/actions.c (replace_keybinding): add function - (cmd_bind): handle binding of previously bound key - -2001-02-23 shawn <sabetts@diggin.lamenet.tmp> - - * src/main.c (main): passes return value of find_window_other() to - set_active_window(). - - * src/list.h (remove_from_window_list): removed prototype - (find_window_in_list): new prototype - (append_to_list): likewise - (insert_into_list): likewise - (remove_from_list): likewise - - * src/list.c: propogated use of rp_unmapped_window_sentinel and - rp_mapped_window_sentinel. - (find_window_in_list): new function - (find_window): calls find_window_in_list to search mapped and - unmapped window lists. - (remove_from_window_list): removed function - (init_window_list): initialized sentinels - (find_window_prev): searches only the mapped window list. - (find_window_next): likewise - (find_window_other): likewise - (append_to_list): new function - (insert_into_list): new function - (remove_from_list): new function - - * src/events.c (unmap_notify): Searches only the mapped window - list. moves the window from the unmapped window list to the mapped - window list. - - * src/data.h: removed rp_window_head and rp_window_tail, updated - dependant files. Added rp_mapped_window_sentinel and - rp_unmapped_window_sentinel globals. - - * src/bar.c (update_window_names): loops only through mapped window - list. - -2001-02-21 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * configure.in: change version to 0.0.6-cvs - -2001-02-21 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/manage.c (manage): comment out broken sort_window_list_by_number - call - - * src/actions.h (key): new structure - - * src/actions.c (find_keybinding): return an rp_action*, not a char* - (user_commands): add bind command - (parse_keydesc): new function - (cmd_bind): new function - - * src/actions.h: update find_keybinding prototype - - * src/events.c (handle_key): handle new return value of - find_keybinding - - * src/actions.c (cmd_generate): Send the modifier prefix state as well - as the keycode. - (find_keybinding): Do not strdup the key action data. - (add_keybinding): Strdup the key action data. - -2001-02-19 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * autogen.sh: Run aclocal before autoheader. - -2001-02-19 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/events.c (handle_key): Call find_keybinding() instead of looping - through keytable here. - - * src/main.c (main): Call initialize_default_keybindings. - - * src/actions.c (find_keybinding): Added. - (add_keybinding): Added. - (initialize_default_keybindings): Added. Do not use static table - of keybindings. Instead call add_keybinding() for each key. - - * src/Makefile.am (ratpoison_SOURCES): add themes.h - - * src/main.c (FONT_NAME): Rename to FONT - (BAR_BG_COLOR): Rename to BACKGROUND - (BAR_FG_COLOR): Rename to FOREGROUND - - * src/list.c (find_window_by_number): Rename to find_window_number. - (find_window_by_name): Rename to find_window_name. - (goto_window_name): Remove. - (find_window_prev): Clean up. - (find_window_next): Clean up. - - * src/list.h: Update prototypes. - - * src/conf.h: Include "themes.h". - - * src/actions.c (cmd_generate): Fix typo. - (prev_window): Remove. - (next_window): Remove. - (last_window): Remove. - (cmd_prev): Add. - (cmd_next): Add. - (cmd_other): Add. - (string_to_window_number): Add. - (cmd_select): Add. - (cmd_rename): Add. - (delete_window): Remove. - (cmd_delete): Add. - (cmd_delete): Remove. - (cmd_kill): Add. - (show_version): Remove. - (cmd_version): Add. - (command): Remove. - (command): Remove. - (cmd_colon): Deal with partial input. - (cmd_exec): Add. - (cmd_newwm): Remove. - (cmd_newwm): Add. - (cmd_clock): Remove. - (cmd_clock): Add. - (cmd_clock): Remove. - (cmd_windows): Add. - (goto_window_number): Remove. - (abort_keypress): Remove. - (cmd_abort): Add. - - * src/actions.c: Make :select command handle numbers. - (cmd_unimplemented): new function. - - Commands are all cmd_ prefixed. Major changes within this file. - * src/input.c (get_more_input): New function. Used to collect input - on top of some existing input. - (get_input): Calls get_more_input to do work. - - * src/conf.h (THEME): added themes support. - - * src/bar.h (message): New macro. Calls marked_message with (0, 0) - highlight parameters. - - * src/bar.c (marked_message): New function - - * src/actions.h: Update prototypes. - -2001-02-19 shawn <sabetts@diggin.lamenet.tmp> - - * src/manage.c (manage): calls sort_window_list_by_number - - * src/list.h (sort_window_list_by_number): Added prototype - - * src/list.c (swap_list_elements): Added - (sort_window_list_by_number): Added - - * src/input.c (update_input_window): Added - (get_input): calls update_input_window in place of xlib calls. - (get_input): exits if realloc fails - - * src/conf.h: Added INPUT_WINDOW_SIZE - - * src/bar.c (update_window_names): loops through window list from head - to tail. - -2001-02-18 Gergely Nagy <8@free.bsd.hu> - - * NEWS: mention that ALL of the fixed size buffers are fixed. - -2001-02-18 shawn <sabetts@diggin.lamenet.tmp> - - * src/conf.h: restructured comments. Added #define for AUTO_CLOSE. - - * src/manage.c (unmanage): kills ratpoison when there are no more - windows. - -2001-02-17 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * Makefile.am (SUBDIRS): Source dir before documentation dirs. - - * autogen.sh: Do not continue if a step fails. - -2001-02-17 Gergely Nagy <8@free.bsd.hu> - - * man/ratpoison.1, - * doc/ratpoison.texi: removed reference to :center - and :resize - -2001-02-17 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c (generate_key_event): Send KEY_PREFIX. - -2001-02-17 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/manage.c (current_screen): Rename get_screen() and move to this - file. - - * src/input.c (get_input): Remove screen_info as paramater. Call - current_screen() to get screen_info. - - * src/actions.c (get_screen): Remove. - -2001-02-17 Gergely Nagy <8@free.bsd.hu> - - * src/actions.c (goto_window_by_name, rename_current_window, command) - (shell_command, switch_to, xterm_command): changed static char[100]s - to dynamic char *s, as get_input() now supports this - * src/input.h: reflect get_input change - * src/input.c (get_input): use dynamically allocated strings - -2001-02-15 Gergely Nagy <8@free.bsd.hu> - - * autogen.sh: added autoheader call - - * debian/control: bumped Standards-Version - * debian/copyright: changed URL - * debian/patches/00list: removed 01-xterm - * debian/patches/01-xterm.dpatch: removed, useless with 0.0.6 - * debian/rules: rewritten using a newer version of my - build system - - * man/Makefile.am: new file - * Makefile.am (SUBDIRS): added man - (debian_FILES): new variable, added to EXTRA_DIST - - * debian/ratpoison.1: moved... - * man/ratpoison.1: ...here, and updated to include all - the new keystrokes - * doc/ratpoison.texi: updated - * doc/ratpoison.info: regenerated - - * configure.in: fixed --enable-debug, added --with-emacs, - added man/Makefile to AC_OUTPUT - -2001-02-15 Gergely Nagy <8@free.bsd.hu> - - * src/getopt.c: fixed a warning - - * src/events.c (handle_key): use dynamically allocated strings - - * src/bar.c (display_msg_in_bar), - * src/sbuf.c (xrealloc): changed an fprintf to PRINT_DEBUG - -2001-02-15 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/list.c (save_mouse_position): changed declaration of mask to - unsigned int - (get_mouse_root_position): changed declaration of mask to unsigned - int - - * src/actions.c (xterm_command): added new function. Thanks to Ben - Leslie <benno@sesgroup.net> - (user_commands): added "xterm" - (key_actions): added C-t C-! binding for "xterm" - - * src/messages.h (MESSAGE_PROMPT_XTERM_COMMAND): new message - -2001-02-14 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.h (generate_key_event): added prototype - - * src/actions.c (key_actions): added additional keybindings to include - C- versions for all keys. - (generate_key_event): added command - -2001-02-13 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/bar.c (update_window_names): get indexes around current window - text to pass to display_msg_in_bar - (display_msg_in_bar): xor a rectangle around the text represented - by mark_start and mark_end arguments - - * src/conf.h (BAR_FG_COLOR): changed to black - (BAR_BG_COLOR): changed to white - (FONT_NAME): changed to 9x15bold - (BAR_Y_PADDING): changed to zero - (BAR_X_PADDING): changed to zero - - * src/data.h (struct screen_info): removed bold_gc - - * src/events.c (handle_key): can no longer over modify keystrokes - (handle_key): updated call to display_msg_in_bar to take extra - highlighting parameters. - - * src/main.c (init_screen): removed bold_color - (XGCValues gv): made global - - * src/actions.h (user_command): new struct - (argtype): new enumeration - - * src/actions.h: many updated prototypes - - * src/actions.c (key_actions): every command is now executed by - calling command() with a string version of the command, rewrote - this table to reflect that. - (user_commands): new symbol table added, a mapping between strings - and functions and arguments. - (spawn): now handles commands with arguments by calling them - through "/bin/sh -c" - (get_screen): new function. - - * src/actions.c: all calls to display_msg_in_bar updated to call with - 2 additional highlight parameters. - - * src/actions.c (goto_win_by_name, rename_current_window, ...): most - all user functions that need arguments will prompt the user for - them, unless they are supplied. Allows the same function to be - used interactively or internally. - - * src/bar.h (display_msg_in_bar): updated prototype - - * src/bar.c (display_msg_in_bar): takes two additional int arguments - which are offsets into the string describing which part of the - text to draw highlighted. - (update_window_names): highlight current window - -2001-02-12 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c (spawn): will now execute commands with arguments by - execl'ing through /bin/sh -c - -2001-02-11 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * autogen.sh: added to repository - -2001-02-11 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/ratpoison.h: #include "sbuf.h" - removed duplicate #include "messages.h" - - * src/Makefile.am (ratpoison_SOURCES): added sbuf.c sbuf.h - - * src/bar.c (calc_bar_width): removed function - (update_window_names): now builds up the entire window list string - in dynamic storage before printing the window list. No longer - displays the current window in a different colour. - -2001-02-11 shawn <sabetts@diggin.lamenet.tmp> - - * src/main.c (set_sig_handler): Added - (main): Uses set_sig_handler() instead of signal() - - * src/manage.h (set_state): Added prototype - - * src/manage.c (send_configure): Now sends the window's x,y,width,height - coordinates. - (set_state): Added - - * src/events.c (map_request): Calls set_state when mapping an unmapped - window. - - * src/actions.c (maximize_transient): takes an rp_window as the - argument. Removed code to handle void *data. Incremental resizing - only happens if the maximum size isn't set. Removed actual X - maximization code. - (maximize): Moved meat to maximize_normal(). - -2001-02-10 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/ratpoison.h: #include "messages.h" - - * src/list.h (goto_window_number): moved prototype to actions.h - - * src/actions.h (goto_window_number): added prototype - (goto_window): removed prototype - - * src/Makefile.am (ratpoison_SOURCES): added messages.h - - * src/actions.c (prev_window): display correct message when there is - no other window or there are no windows at all. - (next_window): display correct message when there is no other - window or there are no windows at all. - (key_actions): all number keys call goto_window_number with an - argument instead of a dedicated function. - (key_actions): XK_exclam now runs execute_command - - * src/actions.c: replaced all user message strings with #define'd - messages. - - * src/actions.h (goto_window): removed - (goto_window_0): removed - (goto_window_1): removed - (goto_window_2): removed - (goto_window_3): removed - (goto_window_4): removed - (goto_window_5): removed - (goto_window_6): removed - (goto_window_7): removed - (goto_window_8): removed - -2001-02-10 shawn <sabetts@diggin.lamenet.tmp> - - * src/communications.c (send_restart, send_kill): Added - - * src/ratpoison.h: includes communications.h - - * src/main.c (send_restart, send_kill): Moved to communications.c - - * src/list.c (get_mouse_root_position): Added - (add_to_window_list): Initialize new rp_window fields - (save_mouse_position): Added - (set_active_window): Added code to save and restore the position - of the mouse - - * src/events.c (property_notify): Added code to listen for a - WM_TRANSIENT_FOR property change. - - * src/data.h (struct rp_window): Added transient, transient_for, mouse_x, mouse_y. - - * src/actions.c (maximize_transient): Added - (maximize): Added code to handle transient windows differently - - * src/Makefile.am (ratpoison_SOURCES): Added communications.h and communications.c - -2001-02-04 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * doc/ratpoison.texi: added keystroke for `Show current time.' - - * debian/ratpoison.1: added keystroke for `Show current time.' - -2001-01-02 shawn <sabetts@diggin.lamenet.tmp> - - * src/communications.c (send_restart): moved from main.c - (send_kill): moved from main.c - - * src/main.c: Removed send_kill, send_restart - - * src/input.h: Added copyright notice. - - * src/input.c: Added copyright notice. - - * src/actions.c: Added copyright notice. - -2001-02-04 Ryan Yeske <rcyeske@cut.hotdog.tmp> - - * src/actions.c (prev_window): do not set active window when - recursing. - (next_window): do not set active window when recursing. - -2001-01-28 Ryan Yeske <rcyeske@soya.hotdog.tmp> - - * src/actions.c: changed rename_current_window key to `A', bound `a' - to show_clock - -2001-01-02 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.h (show_clock): added prototype - - * src/actions.c (show_clock): added - -2000-12-15 shawn <sabetts@badbox.secure.basis.org> - - * src/actions.c (maximize): increment size in hints->width_inc and - hints->height_inc intervals - - * src/manage.c (manage): set the dimension members of the rp_window struct - -2000-12-15 shawn <sabetts@diggin.lamenet.tmp> - - * src/manage.c (manage): added ColormapChangeMask and - StructureNotifyMask to events listened for on managed windows. - - * src/main.c (main): propagated changes to set_active_window usage - - * src/events.c: propagated changes to set_active_window usage - - * src/data.h (struct rp_window): Added colormap member - - * src/list.c (set_active_window): Installs colormap - (set_active_window): sets rp_current_window to window passed in as - parameter - - * src/actions.c (prev_window): No longer uses rp_current_window to - keep track of state - (next_window): No longer uses rp_current_window to keep track of - state - - * src/list.c (add_to_window_list): sets member colormap to the - DefaultColormap - - * src/manage.c (update_window_name): fixed memory leak. Not freeing - the win->name before updating it. - (manage): Gets the colormap now. - - * src/list.c (add_to_window_list): Added init code for `hints' - - * src/events.c (property_notify): Added handler for XA_WM_NORMAL_HINTS. - - * src/data.h (struct rp_window): Added XSizeHints member - - * src/actions.c (maximize): Adhere to the window's Size Hints - -2000-12-14 shawn <sabetts@diggin.lamenet.tmp> - - * src/manage.h (update_normal_hints): added prototype - - * src/manage.c (update_normal_hints): added - - * src/list.c (add_to_window_list): added comment describing function - -2000-12-13 shawn <sabetts@diggin.lamenet.tmp> - - * src/actions.c: removed gross tabs from key_actions definition. Add - C-t space to go to next window. - -2000-12-09 shawn <sabetts@diggin.lamenet.tmp> - - * src/data.h (struct rp_window): added x, y, width, height, border; - - * src/events.c (configure_request): Now honours request, but then - maximizes it afterwards. - (configure_request): updates the rp_window's geometry fields - - * src/manage.c (manage): commented out XMoveResizeWindow call - (send_configure): added - - * src/actions.h (maximize): added prototype - - * src/actions.c (maximize): added - - * src/input.c (cook_keycode): properly handle LockMask - (cook_keycode): updated comments - - * src/input.h: added prototype for keysym_to_string - - * src/input.c (keysym_to_string): added - - * src/bar.c (show_bar): update_window_names(s) is called whether the - bar is raised or not. - - * src/conf.h: Added BAR_Y_PADDING BAR_X_PADDING - - * src/list.c (goto_window_name): return success or failure - - * src/list.h: updated prototype for goto_window_name - - * src/events.c (handle_key): Added a message indicating an unbound - key. - - * src/bar.c (display_msg_in_bar): added - (update_window_names): uses BAR_X_PADDING instead of `5' - (update_window_names): Updated BAR_PADDING to BAR_Y_PADDING - - * src/input.c (cook_keycode): mod is now an usigned int - (read_key): Ignores modifier keys. Now returns keysym and - modifiers. - (get_input): Updated BAR_PADDING to BAR_Y_PADDING and - BAR_X_PADDING. - - * src/events.c (handle_key): uses read_key instead of XMaskEvent to - read a key. - - * src/actions.c (goto_window_number): window list is displayed on failure. - (bye): added - (switch_to): added - (execute_command): no longer seg faults when no windows exist. - -2000-12-03 shawn <sabetts@diggin.lamenet.tmp> - - * src/input.h (cook_keycode): added prototype - - * src/actions.c: key_actions now uses the #define'd keysyms from X11/keysym.h - - * src/events.c (handle_key): calls cook_keycode() before processing the keysym. - - * src/input.c (read_key): calls cook_keycode() before returning the keysym - (cook_keycode): added. - -2000-12-01 shawn <sabetts@diggin.lamenet.tmp> - - * src/list.c (find_window_by_name): added check to make sure the - window's state is not STATE_UNMAPPED. - -2000-11-27 shawn <sabetts@diggin.lamenet.tmp> - - * src/events.c (handle_key): Code to generate the prefix event has - been moved to generate_prefix(). - - * src/actions.h (toggle_bar): added prefixes for generate_prefix, and - abort_keypress. - - * src/actions.c (generate_prefix): added. - (abort_keypress): added. - -2000-11-04 Ryan Yeske <rcyeske@vcn.bc.ca> - - * src/Makefile.am (ratpoison_SOURCES): added getopt.c, getopt1.c and - getopt.h - -2000-10-30 Ryan Yeske <rcyeske@vcn.bc.ca> - - * src/actions.h (execute_command): added prototype - - * src/actions.c (rename_current_window): added test to skip renaming - if user entered an empty string - (execute_command): added command - (key_actions): execute_command is called by pressing ':' - -2000-10-30 shawn <sabetts@badbox.secure.basis.org> - - * src/conf.h: added HIDE_MOUSE - -2000-10-24 Ryan Yeske <rcyeske@vcn.bc.ca> - - * src/bar.c (bar_x): rightmost border is no longer off screen - -2000-10-20 shawn <sabetts@badbox.secure.basis.org> - - * src/events.c (key_press): fixed MODIFIER_PREFIX bug - -2000-10-19 Ryan yeske <rcyeske@van.gobasis.com> - - * src/manage.c (unmanaged_window): added. - - * src/conf.h (PADDING_LEFT, PADDING_TOP, PADDING_RIGHT, - PADDING_BOTTOM, UNMANAGED_WINDOW_LIST): added. Windows listed in - UNMANAGED_WINDOW_LIST will not be managed. Space reserved for - unmanaged windows can be defined with PADDING_* - -2000-10-19 shawn <sabetts@badbox.secure.basis.org> - - * src/manage.c (get_window_name): added - -2000-10-17 shawn <sabetts@vcn.bc.ca> - - * src/events.c (configure_request): resize windows to the max-1. Call - XConfigureWindow as well as XSendEvent. - - * src/manage.c (scanwins): Now only maps visible windows - - * src/conf.h: Removed keystroke related defines - - * src/actions.c: Moved all key activated functions here. Added - key_actions array. - - * src/events.c (unmap_notify): now properly unmaps windows - - * src/data.h: added ignore_badwindow - - * src/main.c (handler): added ability to ignore BadWindow errors - -2000-10-15 shawn <sabetts@vcn.bc.ca> - - * src/main.c, src/data.h, src/events.c: Added ability to kill and - hup running ratpoison processes. @@ -1,3 +0,0 @@ -Find the FAQ on the ratpoison wiki: - -http://ratpoison.wxcvbn.org/cgi-bin/wiki.pl/FAQ diff --git a/INSTALL b/INSTALL deleted file mode 100644 index b42a17a..0000000 --- a/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/MERCHANDISE b/MERCHANDISE deleted file mode 100644 index 9a0b4ee..0000000 --- a/MERCHANDISE +++ /dev/null @@ -1,22 +0,0 @@ -We are now accepting orders for *official* ratpoison MERCHANDISE! - -We have patches, posters and much, much more! - -Everything is HAND-MADE by the ratpoison developers themselves, in -their FREETIME! - -Check out - - http://www.nongnu.org/ratpoison/merchandise - -or send mail to - - RATPOISON HQ CANADIA - c/o Ryan Yeske - 2684 Kitchener St. BSMT - Vancouver, BC - V5K 3C8 CANADA - -for a complete catalogue! - -$Id: MERCHANDISE,v 1.3 2006/04/02 20:25:57 rcyeske Exp $ diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 9f2cce0..0000000 --- a/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -## Process this file with automake to produce Makefile.in -## Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> -## -## This file is part of ratpoison. -## -## ratpoison 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. -## -## ratpoison 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 -## -## $Id: Makefile.am,v 1.12 2006/11/21 17:03:31 brl Exp $ - -ACLOCAL_AMFLAGS = -I m4 --install - -CLEANFILES = *~ gmon.out -MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure src/config.h.in \ - build-aux/depcomp build-aux/install-sh \ - build-aux/missing build-aux/texinfo.tex - -SUBDIRS = src doc contrib - -doc_DATA = AUTHORS COPYING ChangeLog NEWS README - -EXTRA_DIST = $(doc_DATA) - -dist-hook: - chmod -R go-w $(distdir) - -sense: - @echo 42 - -.PHONY: dist-hook sense @@ -1,660 +0,0 @@ -ratpoison NEWS --- history of user-visible changes. -*- outline -*- - -Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts -Copyright (C) 2013 Jérémie Courrèges-Anglas - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. - -* Changes since 1.4.5 -** *Lots* of reliability fixes in ratpoison itself -Please check out the ChangeLog for more details. - -** Build process cleanup -e.g. detection of getline() was fixed, build is ok with old gcc's (2.95) - -** ratpoison -c now reports errors ($? != 0) - -** UTF-8 text is now printed correctly -Both with and without Xft support. - -** contrib/ cleanup -Scripts should be more portable, ruby bindings work with newer ruby versions. - -** New newwindow and titlechanged hooks - -** Functionality was added to rpws -It can now move windows to other workspaces; workspaces can be dumped and -restored. - -* Changes since 1.4.4 -** bug fixes to history and xft - -* Changes since 1.4.3 -** add commands ratinfo, ratrelinfo, banishrel - -** add history to input bar when libhistory is not used - -** add settings historysize and historycompaction - -** new window formatters %p, %M -prints the pid of the window and whether its a maxsize window. - -** new commands grename, gother - -** new bindings C-t N and C-t P -bound to nextscreen/prevscreen - -** new settings, bwcolor and fwcolor -For setting the border color of focused and unfocused windows. - -** netwm dialog type windows supported -These windows are treated as transients. Some Firefox popup windows -are tagged as dialog windows and should now work with ratpoison as -expected. - -** new format character %M -This expands to Maxsize if the window is a maxsize window, nothing if not. - -** ratpoison can use xft -If xft is found on your system ratpoison will use it unless explicitely told not to using --without-xft - -* Changes since 1.4.2 -** key event handling -top level key bindings are grabbed "asynchronously" instead of -"synchronously." This should eliminate the freezes some people have -experienced in previous versions. - -* Changes since 1.4.1 -Just bug fixes. - -* Changes since 1.4.0 -** set padding affects bar location -On OSX the bar and top of each window is hidden by the menu bar. set -padding corrects the window problem but not the bar problem. So this -change fixes that. - -** new set variable framefmt -See docs for info. - -** new commands swap, exchangeleft, exchangeright, exchangeup, exchangedown -See docs for info - -** new commands execa and execf -See docs for info. - -** default font change -It is now "-*-fixed-bold-r-normal-*-15-*-*-*-c-*-*-*" which hopefully -fixes some i18n issues. - -** new command set topkmap -See info manual. - -** build date in ratpoison -v - -** new command sfrestore -restores frame configurations for multiple screens. - -** support for i18n fonts - -* Changes since 1.4.0-beta4 -** new parameters in frame dumps -:screenh and :screenw specify the size of the screen the frame was -on. using these values (when present) ratpoison will scale the frames -to fit the new screen size (if different). - -** New window format characters -See the info file for details. - -** info takes optional argument and new infofmt setting -the info command takes an optional formatting argument. if no argument -is supplied a default fmt is used. To change the default use 'set -infofmt'. See the manual for details. - -** shell commands do not insert trailing space -Until now all completions had a trailing space. Now shell command -completion doesn't to make it easier to tab complete directories. The -previous behavior one had to delete the space then type / and -continue. - -** aspect ratio hint honoured -windows with aspect ratio hints are treated as transients and are -given the same default gravity as maxsize windows. - -** new hook deletewindow -When a window is deleted this hook is called. - -** _net_wm_pid property supported -ratpoison will put windows that have the _net_wm_pid property into the -frame & group that was current when the windows' client was -launched. for example: - - ratpoison -c split -c gnew -c "exec firefox" -c focus -c gnext - -will Do The Right Thing. - -** set warp change -the mouse position relative to the window is now used, instead of -relative to the root window. - -** new compat command -the old def* aliases are depricated and have been moved to this -command. Execute it to restore these bindings. - -** new command redo - -** new editor bindings C-m and C-h - -* Changes since 1.4.0-beta2 -** meta takes a key argument -This can be used to stuff keys. - -* Changes since 1.4.0-beta1 -** RATPOISON environment variable -RATPOISON is set to the location of the ratpoison binary. This is -useful for scripts. - -* Changes since 1.3.0 -** command arguments can be wrapped in double quotes. -To include a space in a command argument, wrap the argument with ". - -** New command undefinekey -not passing a 3rd argument to definekey and bind no longer unbind the -key. You must use undefinekey and unbind now. - -** ratpoison -c prints errors to stderr -You can now capture errors and output seperately depending on whether -its printed to stderr or stdout. - -** the mouse warp feature is now turned off by default -to turn it back on, run 'warp on'. - -** version now displays the date and time - -** new command, sselect -sselect lets you jump to an X11 screen by number. - -** configure script warns about missing history lib -Rather than error out, now, ratpoison will just be built without history. - -** new commands ratwarp, ratrelwarp, and ratclick - -** more new commands -inext, iprev, iother, cnext, cprev, cother, prompt, dedicate, -describekey, focusprev, sdump, sfdump. - -** yet two more new commands: putsel, getsel -putsel puts the specified text into the X11 selection so other clients -can yank it. getsel returns the current selection. - -* Changes since 1.3.0-rc2-beta2 -** new format option %f -This options displays the frame number the window is in or a space if -it is not in a window. - -** Super modifier changed from S to s. S is now the shift modifier - -** window list style is columnar by default - -* Changes since 1.3.0-rc2-beta1 -** New command 'set' -set replaces the def* commands. For example 'defwinliststyle column' -is now 'set winliststyle column'. - -The old def* commands now alias to their 'set' version. - -* Changes since 1.3.0-rc1 -** Top level keymap -The keymap named 'top' is now a top level keymap. No prefix key need -be pressed to access its bindings. In fact, the prefix key is now a -binding in the 'top' keymap. - -** hsplit and vsplit switched -To be compatible with emacs these command names have been -switched. The bindings are the same but custom scripts and aliases -will have to make the switch. - -** new command defframesels -Allow you to customize the keys used to select frames with fselect. - -** Xinerama support -Each xinerama screen is handled as X11 screens normally are. The only -different is that each xinerama screen can select from all the -managed windows. - -** focuslast finds the last focused frame among all screens - -** fselect selects from frames in all screens - -** new command-line option --file -Used to specify an alternate configuration file. - -* Changes since 1.3.0-beta3 -** new configure option --disable-history - -** new commands readkey, newkmap, delkmap, definekey -These commands operate on the new feature: keymaps. They allow you to -have nested keymaps. - -* Changes since 1.3.0-beta2 -** new command gdelete -Delete a group. - -** contrib/allwindows.sh script -A script that lists all groups and the windows in each group. - -* Changes since 1.2.2 -** Workspace script -rpws is an installed script that adds workspaces to ratpoison. Look at -contrib/rpws for instructions on how to use it. - -** new commands addhook and remhook -There are now hooks for various operations. - -** Completions -You can now type Tab and get completions on window names, group names, -and colon commands. - -** Line editing capabilities -You can now go forward a word, backward a char, delete a word, etc. - -** New commands gnewbg, gselect, groups, gmove, and gmerge -These commands allow further manipulation of window groups. - -** shell commands return status -If a command the user executed (with the exec command) returns with a -non-zero exit status, the command and exit status are reported in a -message. - -** new commands gnew, gnext, gprev -Window are now part of groups. There can be more than one group. - -* Changes since 1.2.0-beta4 -** new commands unmanage and clrunmanaged -Instead of editing conf.h you can use these commands to dynamically -add (and clear) the unmanaged window list. - -* Changes since 1.2.0-beta3 -** new command line argumen --screen -Now you can specify the screen you want to manage. By default -ratpoison manages all screens on the display. - -** new command line argument --display -Now you can specify the display to connect to. - -* Changes since 1.2.0-beta2 - -* Changes since 1.1.1 -** new comand 'defwinliststyle' -when turned on, the window list is displayed in a column, not a row. - -** new command 'verbexec' -prints a message when executing a shell command - -** new commands 'fdump' and 'frestore' -These commands are for saving and restoring frame sets. - -** key presses -All actions now occur after the user has released the key. - -** keybinding changes -fselect is bound to C-t C-f and C-t f, curframe is now bound to C-t F, -and resize is bound to C-t C-r and C-t r. - -** new command fselect -select a frame by its number. - -** new command 'tmpwm' -temporarily run a different window manager, then come back to -ratpoison once it has terminated. - -** error and debug reporting -The format has been changed to the more standard format used by C -compilers. - -** New commands 'resize', 'shrink' -resize resizes a frame and shrink shrinks a frame to the size of the -window in it. - -** Shell command exit status -When a shell command fails to execute then a message is reported in -ratpoison: "Command not found." - -** New command 'warp' -Toggles rat warping. By default ratpoison saves the position of the -rat when leaving a window and when the user returns to the window the -rat's position is restored. This can be counter-intuitive, so now you -can toggle it. - -** split, vsplit, hsplit -These commands now take a single argument. The argument can be a ratio -which divides the frame into two frames sized based on this ratio, or -it can be a number representing the number of pixels the existing -frame will occupy. - -* Changes since 1.1.0 -** new commands "nextscreen" and "prevscreen" - -* Changes since 1.0.0 -** defbarloc changed to defbargravity - -** defbarloc -This command take a gravity argument just like the wingravity -commands. - -** new command defbarborder -This command allows you to customize the border width of ratpoison's -windows. These windows are the input window, the bar window, and the -current frame indication window. - -** "number" command takes additional optional argument -The second argument is used to specify a window other than the -current. - -** new command "alias" -An alias gives a name to a command sequence. For instance, you could -alias 'emacs' to 'exec emacs'. Then you could simply type 'C-t :emacs' -and ratpoison would boot emacs. - -** new command "license" -Display ratpoison's license. This is also bound to C-t V and C-t C-V. - -** input history -All input you type into ratpoison is stored as a history entry. Use -C-p and C-n to cycle through it. - -** new command "defbarpadding" -This command specifies how much ratpoison pads the bar window. See the -documentation for usage. - -** new command "link" -Call the command that a keybinding is bound to. for instance, 'link -C-t' would call the command 'other'. - -** new command "focuslast" -Switch between the current frame and the last focused frame. It is -bound to C-t M-Tab. - -** Raise requests don't change frame focus if rudeness doesn't allow it -If a window in another frame requests to be raised, a message pops up -just like everywhere else. The old behavior was to jump focus to the -windows frame regardless of the rudeness. - -** New windows formatting option %l -Prints a last access number. The higher the number, the more recently -the window was accessed. - -** Remove command line options --kill and --restart -Use -c quit and -c restart instead. - -** New command restart -Restart ratpoison. - -** New command lastmsg -Display the last message. - -** New command info -display information about the current window. - -** New command unsetenv -Remove an environment variable from...well...the environment. - -** New command chdir -Change the current directory. - -** Multiple commands passed to ratpoison via the command-line are now processed -A stream of commands like, `ratpoison -c next -c prev -c next' are -processed in order. - -** clock command renamed to time -This was to improve screen compatibility. - -** New command setenv -Use this to set environment variables for all programs run from -ratpoison thereafter. - -** Command defbartimeout renamed to msgwait -This was done to better mirror screen commands. - -** Command generate renamed to meta -This was done to better mirror screen commands. - -** Comand maximize renamed to redisplay -This was done to better mirror screen commands. It is no longer bound -to C-t m it is now bound to C-t l. - -** Cursor in the input window -There is now a cheap cursor to help you remember where you are. - -** conf.h compile-time customizations moved -They are now accessible through the def* suite of commands. - -** Window alignment -Windows can now be aligned so they stick to the top-left corner of the -screen, the center of the screen, the bottom-right, etc. Use the `pos' -command. There is a customizable default setting for each of the three -'kinds' of windows: `defwinpos' for normal windows, `deftranspos' for -transient windows, and `defmaxsizepos' for normal windows with -maximimum size hints. - -** Window format string -The format of the list of windows dumped by the `windows' command is -now customizable with `defwinfmt'. - -** Different Window naming schemes -Windows now have 3 resources that can be used as their default name: -the WMNAME hint which generally contains transient information such as -what file is currently open, the res_name from the WMCLASS hint, or -the res_class the WMCLASS hint. This affects commands like `select' -which search for a window by name. - -* Changes since 0.1.1 - -** new conf.h customization MAXSIZE_WINDOWS_ARE_TRANSIENTS -determines whether windows with maxsize hints are treated like -transient windows. - -** The frame indicator -The frame indicator never sticks and only appears when there is more -than one frame (i.e. when there are splits). - -** Transient window handling has changed -Transient windows now map ontop of the current window. - -** new command 'rudeness' -This command allows you to fine tune what windows rp will map -when. For instance you can ask rp not to map new windows. Instead it -will notify you with a message: "New window #1 (emacs)". - -** user abort key sequence -When typing input, hit C-g (customizable in conf.h) to abort the -input. - -** new key syntax -keys are now specified with C-, M-, A-, H-, S- which stand for the -control, meta, alt, hyper, and super modifiers. ^ does not denote -control. Before, control t looked like ^t now it looks like C-t. - -** new command 'help' -help brings up a key binding listing. it is bound to C-t ?. - -** new command 'quit' -This command quits ratpoison - -** windows not residing in a frame are hidden -This gets rid of annoying flickers around the edges of active windows -as windows in the back update. - -** rat cursor changes - -When you hit the prefix key the rat cursor changes to a square to tell -you what it is waiting for another key. This feature can be removed in -conf.h. - -** Split windows - -Well, the day is finally here. You can now split windows in -ratpoison. Hit C-t s to split horizontally and C-t S to split -vertically. Have fun! - -** new command-line option --command - -You can now send ratpoison commands (colon-commands) to ratpoison via -the command line. for example to tell ratpoison to go to the next -window type this: - -$ ratpoison --command next - -** window borders are configurable -WINDOW_BORDER_WIDTH has been added to conf.h. This constant determines -the border width for all windows. - -** Rodent handling -A new command, :banish, which will move the rat pointer out of harms -way, has been added. It is bound to 'C-t b' by default. No more -slapping your rat out of the way, as fun as that was. - -* Changes since 0.1.0 - -** Window list changes -A '+' is now drawn between the window number and the window name for -the last accessed window. - -** AltGr (XK_Mode_switch) support - -ratpoison now handles AltGr on all its input. - -* Changes Since 0.0.5 -** C-t e removed - -Since you can custo your own keystrokes, there's not much sense -cluttering things with a binding to launch emacs. - -** XErrorEvents don't bring down ratpoison - -A friendly message pops up displaying the error message. This does -mean that there is a problem with ratpoison and it should be -investigated and reported. But at least your entire session doesn't go -down. - -** Sorted window list - -The window list is now sorted by number. - -** Resizing input window - -The size of the input window can be customized in conf.h by setting -INPUT_WINDOW_SIZE. It also dynamically resizes to accommodate the user -input. - -** Pointer location - -The pointer location is saved on a per window basis. When ratpoison -switches to a window it restores the pointer location to its location -the last time that window had focus. - -** Auto quit ratpoison - -When the auto close feature is enabled, ratpoison will exit when the -last managed window is closed. This feature can be turned on by -uncommenting the line: - -/* #define AUTO_CLOSE */ - -in conf.h - -** Improved shell command -The 'exec' command now calls execl ("/bin/sh", "sh", "-c", cmd, 0) -where cmd is your shell command. In short, you can now make shell -command calls with parameters. - -The default keybinding has been changed from C-: to C-! for the 'exec' -command. - -** Command line -An emulation of screen's colon command has been implemented. This -allows you to make wm commands by name. The current command set -includes: abort, next, prev, exec, select, colon, kill, delete, other, -windows, title, clock, maximize, newwm, and version. To bring up a -command line prompt, type C-:. See the info or man page for details -on the command set and its usage. - -** Keysym reading updates -keystrokes are now handled far better. Shifted keystrokes work. More -uniform key event processing. - -You can no longer "over modify" keys. Previously, if C-tn was bound -to 'next', you could type C-tC-n and get the same result. No longer. -You need to explicity map both C-tn and C-tC-n if you want both to -work. - -** XSizeHints honoured -Windows may not maximize fully now since they use XSizeHints to figure -out how big the window can be. - -** Bold color removed -ratpoison now uses only foreground and background colors. They -default to black and white, respectively. To represent the current -window in the bar, the current window's text is reversed. - -** Colormap support -ratpoison now maintains colormaps - -** New keystrokes -*** C-t space and C-t enter -Do the same as C-tn (next window) -*** C-tA -Shows a the time in the display bar -*** C-tv -Shows the version of ratpoison - -** Messages in the window bar -ratpoison now outputs user error messages. - -** Stability -All fixed length buffer sizes in window names that resulted in -curious segfaults have been fixed. - -** Themes support -There is still no theme support, despite what you might have heard. - - -* Changes Singe 0.0.4 -** added --kill and --restart -These command line options allow the restarting and killing of a -running ratpoison process. - -** Mouse jumps to the bottom of the screen on keypresses -This is pretty annoying if you're using anything other than keyboard -apps. It is disabled by default. - - -* Changes Since 0.0.3 -** Added --enable-debug -This turns on debugging messages - -** Added --version and --help command line options - - -* Changes Since 0.0.2 -** Installation -*** Added automake and autoconf -To build and install ratpoison, you must now do this: - -aclocal -automake -a -c -autoconf -./configure -make -make install - -** Features -*** Added jump to window by name Hit C-t C-' and a box will pop up -asking you for the name of the window to jump to. - -*** Added rename-window -hit C-t C-a and a box will pop up asking you to rename the current -window. Once it has been renamed, it will stay renamed. - -** Bugs and Bug fixes @@ -1,48 +0,0 @@ -Ratpoison - Say good-bye to the rodent --------------------------------------- - -Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. - -About ------ - -ratpoison is a simple Window Manager with no fat library dependencies, -no fancy graphics, no window decorations, and no flashy wank. It is -largely modelled after GNU Screen which has done wonders in virtual -terminal market. - -All interaction with the window manager is done through -keystrokes. ratpoison has a prefix map to minimize the key clobbering -that cripples EMACS and other quality pieces of software. - -Building --------- - -ratpoison uses autoconf. To build it: - -$ ./configure && make - -if you want to install it, simply type 'make install' as a privileged user: - -# make install - -Customization -------------- - -Use the configure option '--enable-debug' to enable debugging symbols. - -Use the configure option '--disable-history' to disable the filesystem rat. - -Use the configure option '--with-xterm=PROG' to set the x terminal -emulator to use. The default is `xterm'. - -Consult the INSTALL file for more information about the configure script. - -Using ------ - -See the info manual for more information. diff --git a/README.developers b/README.developers deleted file mode 100644 index 887db45..0000000 --- a/README.developers +++ /dev/null @@ -1,57 +0,0 @@ --*- outline -*- - -This file is intented to give people who would like to modify -ratpoison an idea the utility functions I've built up in ratpoison and -the structure of the code. - -* Utility Functions - -** String Manipulation - -String manipulation is something C is seriously lacking, and something -everyone does all the time. When writing ratpoison code, you SHOULD -NOT be malloc'ing temporary string buffers then using strcat, strcpy, -etc to patch strings together. The following structures and functions -should give you just about everything you need. - -If there's something you want to do but can't with the following -utils, then you should consider adding that functionality (Don't just -hack it!) to them. Chances are, someone else will want to do it too. - -*** struct sbuf -When you need to build a string by concating a bunch together or some -messy frankensteinish string manipulation sbuf is nice to use. It -handles all the memory allocation and you just say what you want to do -with the sbuf_* commands. See sbuf.h. - -*** char *xstrdup(char *) -If you need to copy a string, use this. - -*** char *xsprintf (char *fmt, ...) If you need to printf something -into a string, don't go xmalloc'ing strlen(s)+20. Use xsprintf, it -returns a new string, which you need to free when you're -done. Guaranteed. - -*** char *xvsprintf (char *fmt, va_list ap) -This is just like xsprintf except it takes a va_list argument. - -*** str_comp (char *s1, char *s2, int len) -Just like strncmp, except that it's case-insensitive. - -** Memory - -*** xmalloc and xrealloc -These functions are exactly like malloc and realloc, but they will -NEVER return NULL. - -** Lists -Ratpoison has taken a double-linked list implementation from the Linux -kernel. Look at linkedlist.h. For an example of how to use it...read -the source! - -* Coding Style - -Ratpoison follows the GNU coding style as described in the GNU Coding -Standards Document (http://www.gnu.org/prep/standards.html). If you -see something not compliant with the GNU Standard, fix it and send me -a patch! @@ -1,35 +0,0 @@ --*- outline -*- - -* command stuff -** general argument parsing strategy -Its a free for all right now. - -** The non-interactive functionality of help - -It should dump all the bindings in an easy to parse format. - -* implement these screen commands (see the screen info for documentation): -command ??? -hardcopy (screenshot) -lockscreen -msgminwait -nethack -redisplay -screen (ratpoison) -shell -shelltitle -sleep -sorendition -stuff ??? - -* Pasting into input buffer -Fix it. - -* window name substring matching. -Do it. - -* allow letters and numbers to be used for frames (in fselect) - -* dump all all def* settings - -* get a set ... command going and create aliases for the def* stuff diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 18a6495..0000000 --- a/autogen.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> -# -# This file is part of ratpoison. -# -# ratpoison 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. -# -# ratpoison 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 -# -# $Id: autogen.sh,v 1.8 2006/03/16 00:33:34 sabetts Exp $ -# -# This file is just a wrapper for autoreconf - -autoreconf -i "$@" diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 099af6f..0000000 --- a/configure.ac +++ /dev/null @@ -1,158 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> -dnl -dnl This file is part of ratpoison. -dnl -dnl ratpoison is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl ratpoison is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -dnl -dnl $Id: configure.in,v 1.54 2006/12/19 22:13:07 sabetts Exp $ - - -AC_INIT([ratpoison], [1.4.7-beta], [ratpoison-devel@nongnu.org]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([src/main.c]) -AM_INIT_AUTOMAKE([-Wall -Werror gnu]) - -AM_MAINTAINER_MODE([enable]) - -AC_CONFIG_HEADER(src/config.h) - -dnl by default turn off debugging -AC_MSG_CHECKING(whether to enable debugging) -AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug],[build with extra debugging messages]), - [if test "x$enableval" != "xno"; then - AC_DEFINE_UNQUOTED(DEBUG, 1, Define this to enable debugging messages) - AC_MSG_RESULT(yes) - CFLAGS="$CFLAGS -g" - else - AC_MSG_RESULT(no) - fi],[AC_MSG_RESULT(no)]) - -AC_ARG_WITH(xterm,AS_HELP_STRING([--with-xterm=PROG],[set the x terminal emulator used by ratpoison]), -term_prog=$withval, term_prog="xterm") -AC_DEFINE_UNQUOTED(TERM_PROG, "$term_prog", X terminal emulator to use) - -XFT_CFLAGS= -XFT_LIBS= -AC_ARG_WITH(xft,AS_HELP_STRING([--without-xft],[Don't use the Xft library even if available]), - xft=$withval, xft=default) -if test "x$xft" != "xno"; then - dnl Configure Xft. - PKG_CHECK_MODULES([XFT], [xft],,[noop=noop]) - AC_MSG_CHECKING(whether to use Xft) - echo "pkg_failed is $pkg_failed" >&5 -dnl pkg_failed can be yes, no or untried (if there is no pkg-config or that does not work). - if test "$pkg_failed" = "no" ; then - AC_DEFINE_UNQUOTED(USE_XFT_FONT, 1, [Define this to use Xft]) - AC_MSG_RESULT(yes) - elif test "x$xft" != "xdefault" ; then -dnl if explicitly requested but not found, bail out: - AC_MSG_RESULT(no) - if test "$pkg_failed" = "untried" ; then - AC_MSG_ERROR([Not Xft library found (this needs a working pkg-config)!]) - else - AC_MSG_ERROR([No Xft library found!]) - fi - else - AC_MSG_RESULT(no) - fi -else - AC_MSG_CHECKING(whether to use Xft) - AC_MSG_RESULT(no) -fi -AC_SUBST(XFT_CFLAGS) -AC_SUBST(XFT_LIBS) - -dnl Checks for programs. -AC_PROG_CC - -if test "x$CC" = "xgcc"; then - CFLAGS="-Wall $CFLAGS" -fi - -dnl check for an x terminal emulator -AC_MSG_CHECKING(terminal emulator) -AC_MSG_RESULT($term_prog) - -dnl Check for the X libs -AC_PATH_X -AC_PATH_XTRA - -if test "x$no_x" = "xyes"; then - AC_MSG_ERROR([*** Can't find X11 headers and libs]) -fi - - -dnl Those who do not learn the lessons of history -dnl are doomed to delete it... yuk yuk. --ttn -AC_ARG_ENABLE(history,AS_HELP_STRING([--disable-history],[ignore libhistory (default: use it if available, only used for ! expansion)]), - [ if test x${enableval} = xyes ; then - check_for_libhistory=yes - else - check_for_libhistory=no - fi],[check_for_libhistory=default]) - -HISTORY_LIBS="" -if test x$check_for_libhistory != xno ; then - AC_CHECK_HEADERS([readline/history.h], - AC_CHECK_LIB(history, add_history, - [HISTORY_LIBS="-lhistory" - AC_DEFINE_UNQUOTED(HAVE_HISTORY, 1, Define this to enable history)], - if test x$check_for_libhistory = xyes ; then - AC_MSG_ERROR([*** Can't find History lib. Install readline dev libs for history expansion.]) - fi), - if test x$check_for_libhistory = xyes ; then - AC_MSG_ERROR([*** Can't find History header. Install readline dev libs for history expansion.]) - fi) -fi -AC_SUBST(HISTORY_LIBS) - -AC_CHECK_LIB(X11, XOpenDisplay, [X_LIBS="-lX11 $X_LIBS"], - AC_MSG_ERROR([*** Can't find libX11]),$X_LIBS $X_EXTRA_LIBS) - -mysavedCPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $X_CFLAGS" -AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [], [], [ -#include <X11/Xlib.h> -]) -CPPFLAGS="$mysavedCPPFLAGS" - -AC_CHECK_LIB(Xext, XMissingExtension, [X_LIBS="-lXext $X_LIBS"],,$X_LIBS $X_EXTRA_LIBS) -AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [X_LIBS="-lXinerama $X_LIBS"; AC_DEFINE(HAVE_LIBXINERAMA,1,[Xinerama])],,$X_LIBS $X_EXTRA_LIBS) -AC_CHECK_LIB(Xtst, XTestFakeButtonEvent, [X_LIBS="-lXtst $X_LIBS"; AC_DEFINE(HAVE_LIBXTST,1,[Xtst])],,$X_LIBS $X_EXTRA_LIBS) - -AC_SUBST(X_LIBS) -AC_SUBST(X_EXTRA_LIBS) -AC_SUBST(X_CFLAGS) - -dnl Check for electric fence library -dnl AC_CHECK_LIB(efence,malloc,,) - -dnl Checks for header files. -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(unistd.h stdarg.h) - -dnl Checks for typedefs, structures, and compiler characteristics. - -dnl Checks for library functions. -AC_CHECK_FUNCS(getline getopt getopt_long setenv setpgid setpgrp setsid) -AC_CHECK_FUNCS(unsetenv usleep vsnprintf) - -AM_LANGINFO_CODESET - -AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile]) -AC_OUTPUT diff --git a/contrib/Makefile.am b/contrib/Makefile.am deleted file mode 100644 index 5ae7445..0000000 --- a/contrib/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> -# -# This file is part of ratpoison. -# -# ratpoison 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. -# -# ratpoison 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 -# - -bin_SCRIPTS = rpws - -pkgdata_DATA = ratpoison.el split.sh genrpbindings rpws allwindows.sh clickframe.pl rpshowall.sh unrat.c sloppy.c -EXTRA_DIST = ratpoison.el split.sh genrpbindings rpws allwindows.sh clickframe.pl rpshowall.sh unrat.c sloppy.c -MAINTAINERCLEANFILES = Makefile.in diff --git a/contrib/allwindows.sh b/contrib/allwindows.sh deleted file mode 100755 index a1c291b..0000000 --- a/contrib/allwindows.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Copyright (C) 2003 Rupert Levene -# Author: Rupert Levene <r.levene@lancaster.ac.uk> - -# List all groups and the windows in each group. - -# we want to cope with spaces in group names -IFS=' -' - -#initialize our list -list='' - -# Allow external scripts to tell it where ratpoison is -if [ -z "$RATPOISON" ]; then - RATPOISON=ratpoison -fi - -GROUPLIST=$($RATPOISON -c groups) -SED_GET_NUM='s/^\([0-9]*\).*/\1/' - -FIRSTGROUPNUM=$(echo "$GROUPLIST"|head -n 1|sed -e "$SED_GET_NUM") -LASTGROUP=$(echo "$GROUPLIST"|tail -n 1) -CURRENTGROUPNUM=$(echo "$GROUPLIST"|grep '^[0-9]*\*'|sed -e "$SED_GET_NUM") - -$RATPOISON -c "gselect $FIRSTGROUPNUM" - -for i in $GROUPLIST; do - list=$(printf '%s%s\n%s' "$list" "$i" "$($RATPOISON -c windows|sed -e 's/^/ /')"); - if [ "$i" != "$LASTGROUP" ]; then - list="${list} -" - fi - $RATPOISON -c gnext -done; - -$RATPOISON -c "echo $list" -$RATPOISON -c "gselect $CURRENTGROUPNUM" diff --git a/contrib/clickframe.pl b/contrib/clickframe.pl deleted file mode 100644 index 4268074..0000000 --- a/contrib/clickframe.pl +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright (C) 2003,2004 Shawn Betts -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. -# -# clickframe.pl is a utility to switch frames by clicking the -# mouse. You must apply the patch below to xbindkeys for this script -# to work. And add an entry like this to your .xbindkeysrc file: -# -# # bind C-mouse1 to ratpoison click focus hack -# "perl /home/sabetts/src/ratpoison/contrib/clickframe.pl &" -# control + b:1 -# -# Requires xbindkeys-1.6.4 with the patch at the end of this file -# applied. This file can be fed directly to patch. - -# Make sure the env vars are there -$ENV{XBINDKEYS_BUTTONLOC} || die '$XBINDKEYS_BUTTONLOC not bound'; - -# Parse the required environment variables -$ratpoison_bin = $ENV{RATPOISON} || 'ratpoison'; -($x_loc,$y_loc) = split(/,/, $ENV{XBINDKEYS_BUTTONLOC}); - -# Rip the frameset from ratpoison -$frameset = `$ratpoison_bin -c fdump`; -@framelist = split(/,/,$frameset); - -# Check each frame to see if the mouse was clicked in that frame. -# FIXME: it goes through all the frames even if it found one. -foreach $frame (@framelist) { - ($num,$left,$top,$width,$height,$win,$access) = split(/ /,$frame); - if ($x_loc > $left && $x_loc < $left + $width && $y_loc > $top && $y_loc < $top + $height) { - # Tell ratpoison to switch to the frame - print "User clicked in frame $num\n"; - system ("$ratpoison_bin -c \"fselect $num\""); - } -} - -__END__ - ---- xbindkeys.c~ 2003-04-06 08:43:27.000000000 -0700 -+++ xbindkeys.c 2003-09-24 11:46:20.000000000 -0700 -@@ -143,7 +143,15 @@ - - - -+void -+add_button_env (int x, int y) -+{ -+ char *env; - -+ env = malloc (256 * sizeof (char)); -+ snprintf (env, 255, "XBINDKEYS_BUTTONLOC=%d,%d", x, y); -+ putenv (env); -+} - - - static void -@@ -240,6 +248,8 @@ - | Button1Mask | Button2Mask | Button3Mask - | Button4Mask | Button5Mask); - -+ add_button_env (e.xbutton.x, e.xbutton.y); -+ - for (i = 0; i < nb_keys; i++) - { - if (keys[i].type == BUTTON && keys[i].event_type == PRESS) -@@ -266,6 +276,8 @@ - | Button1Mask | Button2Mask | Button3Mask - | Button4Mask | Button5Mask); - -+ add_button_env (e.xbutton.x, e.xbutton.y); -+ - for (i = 0; i < nb_keys; i++) - { - if (keys[i].type == BUTTON && keys[i].event_type == RELEASE) diff --git a/contrib/expose.pl b/contrib/expose.pl deleted file mode 100644 index 0a7127e..0000000 --- a/contrib/expose.pl +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/env perl -# Maintainer: Trent Buck <[EMAIL PROTECTED]> -# License: Public Domain - -# Changelog: -# 2003-11-16 cantsin rpshowall.sh -# 2003-11-19 various Misc. fixes to rpshowall -# 2003-11-20 twb expose.pl -# 2003-11-20 cantsin minor changes -# 2003-11-22 twb new algorithm, broke script -# 2004-05-21 bkhl posted on wiki -# 2004-06-22 twb full rewrite, changelog started -# 2004-06-24 twb release candidate -# 2004-07-07 twb toggle logic for fselect (line 43) -# 2005-07-05 ivan updated for the new fdump format (works with 1.4.0-beta4) - -# Description: -# Duplicates OS-X 10.3's Expose' functionality for ratpoison. -# You should apply the TWBPatch or reverse the logic at line 43. - -#-- tweaking ------------------------------------------------------------------- - -require "assert.pl"; #used for validation. -use strict; -my $N_LIMIT = 2; -my $LIMIT = 0.01; #smaller number --> slower, but more accurate -my $RATPOISON = $ENV{RATPOISON} || 'ratpoison'; - -#-- main ----------------------------------------------------------------------- - -#&th_ratio (1400, 1050, 23); -#&th_split (\&split, 5, (0, 0, 1400, 1050)); - -# my $id = &xid2num(8388638); -# print "'$id'\n"; -# exit 0; - -my @xids = &rp('windows %i'); chomp @xids; -my $n = @xids; #@ in $ context evals to length of @. -my $frames_old = &rp('fdump'); chomp $frames_old; -my @r; # Sub-optimal way of grabbing screen x,y,w,h. - -#fixed to use sdump -($_, $r[0], $r[1], $r[2], $r[3]) = split(/ /,&rp ('sdump')); - -my $ret = join(", ", &rp_split(\@xids, \&split, $n, \@r)); - -&rp("frestore $ret"); - -$ret = &rpi('fselect'); - -&rp('only'); - -#-- subroutines ---------------------------------------------------------------- - -#-- rp-specific -------------------------------------------- - -sub rp { return `$RATPOISON -c "@_"`; } -sub rpi { return `$RATPOISON -i -c "@_"`; } - -sub rpb { - my @accum = (); - for (@_) - { - push @accum, "-c \"$_\""; - } - return `$RATPOISON @accum`; -} - -sub rp_split -{ - # Prints partitions in :fdump format. - my ($xids, $alg, $n, $r) = @_; - my @ret = (); - my $num = 0; - my $i; - - foreach $i (&$alg($n, @$r)) - { - my ($x, $y, $w, $h) = @$i; - my $xid = pop(@$xids); - push @ret, "(frame :number $num :x $x :y $y :width $w :height $h :window $xid)"; - $num++; - } - return @ret; -} - - -# sub frame2xid { -# my ($fnum) = @_; -# my ($frame, $num, $xid); -# foreach $frame ( split(/,/, &rp('sfdump')) ) -# { -# ($num, $_, $_, $_, $_, $xid) = split(/ /, $frame); -# if ($num eq $fnum) -# { -# chomp $xid; -# return $xid; -# } -# } -# return -1; # canthappen -# } - -# sub xid2num { -# my ($xid) = @_; -# my @windows = &rp('windows %i %n'); -# my ($window, $id, $num); -# foreach $window ( @windows ) -# { -# ($id, $num) = split(/ /, $window); -# if ($id eq $xid) -# { -# chomp $num; -# return $num; -# } -# } -# return -1; # canthappen -# } - - -#-- generic ------------------------------------------------ - - -sub isint { #from http://google.com/groups?selm=BECK.95Oct20135611%40visi5.qtp.ufl.edu - my $x = shift; - return 0 if ($x eq ""); - my $sign ='^\s* [-+]? \s*'; - my $int ='\d+ \s* $ '; - return ($x =~ /$sign $int/x) ? 1 : 0; -} - - -sub isnum { #from http://google.com/groups?selm=90ra0g%24u0m%241%40nnrp1.deja.com - my $x = shift; - return ($x eq $x+0) ? 1:0; -} - -sub ratio { - my ($t, $n) = @_; - my $ret = 1; - my $i; - &assert(&isnum($t) and &isint($n) and $n >= 0); - - for $i ( 2 .. $n ) - { - if ( &isint($n / $i) # $j must also be an integer. - and abs(($i**2 / $n) - $t) < abs(($ret**2 / $n) - $t) ) - { - $ret = $i; - } - } - #Third return value is `error', used by split(). - return ( $ret, $n / $ret, abs(($ret**2 / $n) - $t)); -} - -sub hsplit ($@) { - my ($n, $rx, $ry, $rw, $rh) = @_; - my @ret = (); - my $i; - &assert(isint($n) and $n >= 0); - &assert(isint($rx) and isint($ry) and isint($rw) and isint($rh)); - &assert($rx>=0 and $ry>=0 and $rw>0 and $rh>0); - &assert($rw >= $n); - - # remove remainder from rw, add to the last rectangle. - my $rem = $rw % $n; - $rw -= $rem; - &assert(0 == $rw % $n); - - for $i (1 .. $n) - { - push @ret, [ ($rx + ($i-1)*$rw/$n, - $ry, - $rw/$n + ($i==$n?$rem:0), - $rh) ]; - } - return @ret; -} - -sub vsplit ($@) { - my ($n, $rx, $ry, $rw, $rh) = @_; - my @ret = (); - my $i; - &assert(isint($n) and $n >= 0); - &assert(isint($rx) and isint($ry) and isint($rw) and isint($rh)); - &assert($rx>=0 and $ry>=0 and $rw>0 and $rh>0); - &assert($rh >= $n); - - # remove remainder from rh, add to the last rectangle. - my $rem = $rh % $n; - $rh -= $rem; - &assert(0 == $rh % $n); - - for $i (1 .. $n) - { - push @ret, [ ($rx, - $ry + ($i-1)*$rh/$n, - $rw, - $rh/$n + ($i==$n?$rem:0)) ]; - } - return @ret; -} - -sub boxsplit ($@) { - my ($n, $rx, $ry, $rw, $rh) = @_; - my @ret = (); - my ($rows, $cols) = &ratio($rw/$rh, $n); - my $i; - &assert(isint($n) and $n >= 0); - &assert(isint($rx) and isint($ry) and isint($rw) and isint($rh)); - &assert($rx>=0 and $ry>=0 and $rw>0 and $rh>0); - &assert(($rh * $rw) >= $n); - - foreach $i (&vsplit($rows, ($rx, $ry, $rw, $rh))) - { - @ret = (@ret, &hsplit($cols, @$i)); - } - return @ret; -} - -sub split ($@) { - my ($n, $rx, $ry, $rw, $rh) = @_; - my ($rows, $cols, $prox) = &ratio($rw/$rh, $n); - - # if base case, palm off to boxsplit() - if ($n < $N_LIMIT or $prox < $LIMIT) - { - return &boxsplit($n, $rx, $ry, $rw, $rh); - } - else - { - my @ret = (); - my $nA = int($n/2); #fixme: int() is bad. Use POSIX::floor? - my $x = $nA / ($n - $nA); - my $i; - &assert(isint($n) and $n >= 0); - &assert(isint($rx) and isint($ry) and isint($rw) and isint($rh)); - &assert($rx>=0 and $ry>=0 and $rw>0 and $rh>0); - &assert(($rh * $rw) >= $n); - - if ($rw > $rh) # Divide the larger dimension - { - my $k = int($rw * $x / (1 + $x)); #fixme: bad int(). - @ret = (@ret, &split($nA, ($rx, $ry, $k, $rh))); - @ret = (@ret, &split($n - $nA, ($rx+$k, $ry, $rw-$k, $rh))); - } - else - { - my $k = int($rh * $x / (1 + $x)); #fixme: bad int(). - @ret = (@ret, &split($nA, ($rx, $ry, $rw, $k ))); - @ret = (@ret, &split($n - $nA, ($rx, $ry+$k, $rw, $rh-$k))); - } - return @ret; - } -} - -#-- test harnesses ------------------------------------------------------------- - -# Commented out to speed up compilation. - -# sub th_ratio -# { -# my ($num, $denom, $n) = @_; -# my ($row, $col, $prox) = &ratio ($num / $denom, $n); -# print "$n = $row * $col, proximity $prox\n"; -# } - -# sub th_split -# { # Prints partitions as a SVG. See inkscape.org for info. -# my ($alg, $n, @r) = @_; -# my $i; - -# print "<svg width=\"$r[2]\" height=\"$r[3]\">\n"; -# foreach $i (&$alg($n, @r)) -# { -# my ($x, $y, $w, $h) = @$i; -# print "<rect x=\"$x\"\ty=\"$y\"\twidth=\"$w\"\theight=\"$h\"", -# " style=\"fill:white;stroke:black;\"/>\n"; -# } -# print "</svg>\n"; -# } - diff --git a/contrib/genrpbindings b/contrib/genrpbindings deleted file mode 100755 index 0f924d3..0000000 --- a/contrib/genrpbindings +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env perl -# genrpbindings -- generate ratpoison bindings for various languages -# -# Copyright (C) 2003, 2004 Ryan Yeske, Doug Kearns, Shawn Betts -# -# currently generates bindings for: -# * Perl (Ratpoison.pm) Ryan Yeske <rcyeske@sfu.ca> -# * Emacs Lisp (ratpoison-cmd.el) Ryan Yeske <rcyeske@sfu.ca> -# * Ruby (ratpoison.rb) Doug Kearns <djkea2@mugc.its.monash.edu.au> -# * Common Lisp (ratpoison.lisp) Shawn Betts <sabetts@vcn.bc.ca> -# * Python (ratpoison.py) Mike O'Connor <stew@vireo.org> -# add more languages! -# -# Bindings are just very thin wrappers, no argument checking is done. -# All of the functions return a string. -# -# Example: ratpoison --command='echo hello world' -# -# #!perl -# use Ratpoison; -# Ratpoison::echo ("hello world") -# -# ;;; elisp -# (require 'ratpoison-cmd) -# (ratpoison-echo "hello world") -# -# #!ruby -# require "ratpoison" -# Ratpoison.echo ("hello world") -# -# ;;; Common Lisp -# (load "ratpoison.lisp") -# (ratpoison:rp-echo "hello world") -# -# #!python -# import ratpoison -# ratpoison.echo( "hello world" ) - -use warnings; - -$\="\n"; - -# set this to your rp binary -$RATPOISON=$ENV{RATPOISON} || "ratpoison"; - -# open source file -$ACTIONS_C="../src/actions.c"; -open ACTIONS_C or die "Can't open $ACTIONS_C"; - -# open target files -$PERL_FILE="./Ratpoison.pm"; -$ELISP_FILE="./ratpoison-cmd.el"; -$RUBY_FILE="./ratpoison.rb"; -$COMMONLISP_FILE="./ratpoison.lisp"; -$PYTHON_FILE="./ratpoison.py"; -open PERL, ">$PERL_FILE" or die "Can't create $PERL_FILE"; -open ELISP, ">$ELISP_FILE" or die "Can't create $ELISP_FILE"; -open RUBY, ">$RUBY_FILE" or die "Can't create $RUBY_FILE"; -open COMMONLISP, ">$COMMONLISP_FILE" or die "Can't create $COMMONLISP_FILE"; -open PYTHON, ">$PYTHON_FILE" or die "Can't create $PYTHON_FILE"; - -# PERL preamble -print PERL 'package Ratpoison;'; -print PERL '$RATPOISON="',$RATPOISON,'";'; -print PERL 'sub command { my $a = "@_"; $a =~ s/(\')/\'\\\\\'\'/g; return `$RATPOISON -c \'$a\'`; }'; - -# ELISP preamble -print ELISP '(defvar ratpoison-program "',$RATPOISON,'")'; -print ELISP <<PREAMBLE; - -(defmacro defun-ratpoison (cmd) - `(progn (defun ,(intern (concat "ratpoison-" (symbol-name cmd))) (&rest args) - (apply 'ratpoison-cmd ,(symbol-name cmd) args)))) - -(defun ratpoison-cmd (cmd &rest args) - (with-temp-buffer - (call-process ratpoison-program nil (current-buffer) t - "-c" (format "%s %s" - cmd - (mapconcat (lambda (x) - (if (stringp x) - x - (prin1-to-string x))) - args " "))) - (buffer-substring (point-min) (if (> (point-max) 1) - (- (point-max) 1) - (point-max))))) -PREAMBLE - -# RUBY preamble -print RUBY <<PREAMBLE; -module Ratpoison - - RATPOISON="$RATPOISON" - - def command(command, *args) - return `#{RATPOISON} -c "#{command} #{args.join(' ')}"` - end - module_function :command -PREAMBLE - -# Scheme preamble - -print COMMONLISP <<PREAMBLE; -(defpackage :ratpoison - (:use :cl)) - -;; Needs the CLOCC PORT package -(asdf:operate 'asdf:load-op :port) - -(in-package :ratpoison) - -(defvar ratpoison-program "$RATPOISON") - -(defmacro defun-ratpoison (cmd) - (let ((sym (intern (concatenate 'string "RP-" (symbol-name cmd))))) - `(progn (defun ,sym (&rest args) - (apply 'ratpoison-cmd ,(string-downcase (symbol-name cmd)) args)) - (export ',sym)))) - -(defun ratpoison-cmd (cmd &rest args) - (labels ((mapconcat (fn list sep) - (apply 'concatenate 'string - (loop for x on list - collect (if (cdr x) - (concatenate 'string (funcall fn (car x)) sep) - (funcall fn (car x)))))) - (build-cmd (cmd args) - (mapconcat (lambda (x) - (if (stringp x) - x - (prin1-to-string x))) - (nconc (list cmd) args) " "))) - (let ((stream (port:pipe-input ratpoison-program - "-c" (build-cmd cmd args)))) - (do ((line (read-line stream nil nil) - (read-line stream nil nil)) - (accum nil (cons line accum))) - ((null line) accum))))) -PREAMBLE - -# python preamble - -print PYTHON <<PREAMBLE; -import os -ratpoison="ratpoison -c " -def rp_command( *args ): - p = os.popen( ratpoison + '"' + (' '.join( args ) ) + '"', 'r' ) - r = p.readlines(); - p.close(); - return r - -PREAMBLE - -# bindings -while (<ACTIONS_C>) { - if (m!/\*\@begin !) { - while (<ACTIONS_C>) - { - last if (m!/\*\@end !); - if (/\s*add_command\s*\(\"([^\"]+)\",\s*[^\"]+,\s*([0-9]+),\s*[0-9]+,\s*([0-9]+)/) { - my $name = $1; - my $numargs = $2; - my $optargs = $3; - - # Skip the arguments - for (my $i=0; $i<$numargs; $i++) { - <ACTIONS_C>; - } - - $nbindings++; - print PERL "sub $name { return command (\"$name\", \@_); }"; - print ELISP "(defun-ratpoison $name)"; - print COMMONLISP "(defun-ratpoison $name)"; - print RUBY " def $name(*args)"; - print RUBY " return command(\"$name\", args)"; - print RUBY " end"; - print RUBY " module_function :$name\n"; - print PYTHON "def rp_$name( *args ): return rp_command ( '$name ' + ' '.join( args ) )"; - } - } - } -} -print "$nbindings bindings."; - -# PERL postamble -# nothing - -# ELISP postamble -print ELISP '(provide \'ratpoison-cmd)'; - -# RUBY postamble -print RUBY "end"; - -# PYTHON postamble -# nothing - -close PERL; -print "Created $PERL_FILE"; -close ELISP; -print "Created $ELISP_FILE"; -close RUBY; -print "Created $RUBY_FILE"; -close COMMONLISP; -print "Created $COMMONLISP_FILE"; -close PYTHON; -print "Created $PYTHON_FILE"; diff --git a/contrib/nogaps.el b/contrib/nogaps.el deleted file mode 100644 index 033c963..0000000 --- a/contrib/nogaps.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; Copyright (C) 2003, 2004 Shawn Betts -;;; -;;; Copying and distribution of this file, with or without modification, -;;; are permitted in any medium without royalty provided the copyright -;;; notice and this notice are preserved. - -(eval-when-compile - (require 'cl)) - -(require 'ratpoison-cmd) - -(defun ratpoison-nogaps () - (let ((wins (mapcar 'string-to-number (split-string (ratpoison-windows "%n"))))) - (loop for n in wins - for i from 1 to (length wins) - do (ratpoison-number i n)))) diff --git a/contrib/ratpoison.el b/contrib/ratpoison.el deleted file mode 100644 index 993ca7f..0000000 --- a/contrib/ratpoison.el +++ /dev/null @@ -1,199 +0,0 @@ -;;; ratpoison.el --- ratpoison support for Emacs -;; -;; Copyright (C) 2003 Gergely Nagy, Shawn Betts, Jay Belanger -;; -;; Authors: Gergely Nagy <algernon@debian.org>, -;; Shawn Betts <sabetts@users.sourceforge.net>, -;; Jay Belanger <belanger@truman.edu>, -;; Maintainer: Gergely Nagy <algernon@debian.org> -;; Version: 0.2 -;; Keywords: faces, ratpoison, X -;; CVS Id: $Id: ratpoison.el,v 1.5 2006/03/16 00:33:34 sabetts Exp $ -;; Last updated: <2001/10/05 17:58:38 algernon> - -;; This file is NOT part of GNU Emacs. - -;; 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 - -;;; Commentary: -;; -;; This file provides a major mode for editing .ratpoisonrc files, and -;; functions to access ratpoison from within Emacs. - -;;; History: -;; Version 0.2: -;; - Added command-interpreter (from Shawn and Jay) -;; - Added info-lookup functions (from Jay) -;; - renamed to ratpoison.el -;; - far better font-locking -;; Version 0.1: -;; - initial version - -;;; Todo: -;; - auto-completion of commands -;; - probably a bunch of other things - -(require 'font-lock) -(require 'generic-x) - -(defvar ratpoison-commands-0 - (list - "abort" - "banish" - "clock" - "curframe" - "delete" - "focus" - "focusup" - "focusdown" - "focusleft" - "focusright" - "meta" - "help" - "info" - "kill" - "lastmsg" - "redisplay" - "restart" - "next" - "only" - "other" - "prev" - "quit" - "remove" - "split" - "hsplit" - "version" - "vsplit" - )) - -(defvar ratpoison-commands-rest - (list - "bind" - "chdir" - "colon" - "defbarloc" - "msgwait" - "defborder" - "deffont" - "definputwidth" - "defmaxsizepos" - "defpadding" - "deftranspos" - "defwaitcursor" - "defwinfmt" - "defwinname" - "defwinpos" - "deffgcolor" - "defbgcolor" - "escape" - "echo" - "exec" - "newwm" - "number" - "pos" - "rudeness" - "select" - "setenv" - "source" - "startup_message" - "title" - "unbind" - "unsetenv" - "windows" - )) - -;; ratpoisonrc-mode -(define-generic-mode 'ratpoisonrc-mode - ;; comments - (list ?#) - ;; keywords - nil - ;; font-lock stuff - (list - ;; commands without arguments - (generic-make-keywords-list - ratpoison-commands-0 font-lock-builtin-face "^[ \t]*") - ;; commands with arguments - (generic-make-keywords-list - ratpoison-commands-rest font-lock-builtin-face "^[ \t]*" "[ \t]+") - ;; exec <arg> - (list "^[ \t]*\\(exec\\)[ \t]+\\(.*\\)" - '(1 'font-lock-builtin-face) - '(2 'font-lock-string-face)) - ;; arguments, the first is a keyword, the rest is tring - (list (concat - (car (generic-make-keywords-list - ratpoison-commands-rest font-lock-builtin-face "^[ \t]*" "[ \t]+")) - "\\([0-9a-zA-Z\\/\\.\\-]+\\)[ \t]*\\(.*\\)") - '(2 'font-lock-keyword-face) - '(3 'font-lock-string-face))) - ;; auto-mode alist - (list "\\.ratpoisonrc\\'") - ;; additional setup functions - (list 'ratpoisonrc-mode-setup) - "Generic mode for ratpoison configuration files.") - -(defun ratpoisonrc-mode-setup() - (defvar ratpoisonrc-mode-keymap (make-sparse-keymap) - "Keymap for ratpoisonrc-mode") - (define-key ratpoisonrc-mode-keymap "\C-c\C-e" 'ratpoison-line) - (use-local-map ratpoisonrc-mode-keymap)) - -(provide 'ratpoisonrc-mode) - -;; Ratpoison access -; Groups & Variables -(defgroup ratpoison nil "Ratpoison access" - :group 'languages - :prefix "ratpoison-") - -(defcustom ratpoison-program "ratpoison" - "The command to call the window manager." - :group 'ratpoison - :type 'string) - -; Command stuff -(defun ratpoison-command (command) - (interactive "sRP Command: ") - (call-process ratpoison-program nil nil nil "-c" command)) - -(defun ratpoison-command-on-region (start end) - (interactive "r") - (mapcar 'ratpoison-command - (split-string (buffer-substring start end) - "\n"))) - -(defun ratpoison-line () - "Send the current line to ratpoison." - (interactive) - (ratpoison-command - (buffer-substring-no-properties - (line-beginning-position) - (line-end-position)))) - -;; Documentation -(defun ratpoison-manual () - "Call up the ratpoison info page." - (interactive) - (info "ratpoison")) - -(defun ratpoison-manual-commands () - "Call up the info page listing the ratpoison commands." - (interactive) - (info "(ratpoison) Commands")) - -(provide 'ratpoison) diff --git a/contrib/rpbatch.pl b/contrib/rpbatch.pl deleted file mode 100644 index 0f1c50e..0000000 --- a/contrib/rpbatch.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright (C) 2003 Shawn Betts -# Execute a sequence of commands read from stdin. - -$ratpoison = $ENV{RATPOISON} || 'ratpoison'; - -while (<>) { - chomp; - push @accum, "-c"; - push @accum, "\"$_\""; -} - -system ("$ratpoison @accum"); diff --git a/contrib/rpshowall.sh b/contrib/rpshowall.sh deleted file mode 100644 index 458f2fa..0000000 --- a/contrib/rpshowall.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -# rpshowall -# ratpoison script to show all open windows -# Copyright (C) 2003 Florian Cramer <cantsin@zedat.fu-berlin.de> - -# Usage : -# -# rpshowall [no arguments] -# if called from a terminal, show all open windows and -# restore previous frame layout upon keystroke -# -# rpshowall [n>1] -# show all open windows for n seconds, -# then restore previous frame layout -# -# rpshowall 0 -# show all open windows, do not restore previous frame layout - -if [ -z "$RATPOISON" ]; then - RATPOISON=ratpoison -fi - -# Parse input argument - -case $# in - 0) wait=-1 - ;; - 1) - wait=$1 - ;; - *) - printf '%s\n' "Usage: $0 [sleep_seconds]" >&2 - exit 1 - ;; -esac - -# Save current frameset - -framecount=`$RATPOISON -c windows | wc -l | sed -e "s/[ ]*//g"` -curframe=`$RATPOISON -c windows | grep "^[0-9]*\*" | sed -e "s/^\([0-9]*\).*/\1/"` -curlayout=`$RATPOISON -c fdump` - - -# Create split view of all open windows - -$RATPOISON -c only -i=2 -while [ "$i" -le "$framecount" ]; do - if [ "$i" -le $(($framecount/2)) ] ; then - $RATPOISON -c vsplit - else - $RATPOISON -c hsplit - fi - $RATPOISON -c focus - $RATPOISON -c focus - i=$(($i+1)); -done - -# Depending on the argument the script was executed with, -# 1- select a new window and exit opening it fullscreen -# 2- restore frameset after keyboard input -# 3- restore frameset after $wait seconds of delay - -$RATPOISON -c "select $curframe" -if [ $wait -eq 0 ]; then - $RATPOISON -i -c fselect - $RATPOISON -c only -else - $RATPOISON -i -c windows - if [ "$wait" -eq -1 ]; then - printf '%s' "Hit return to restore window layout. " - read i - else - sleep "$wait" - fi - $RATPOISON -c "frestore $curlayout" -fi diff --git a/contrib/rpws b/contrib/rpws deleted file mode 100755 index 49105c5..0000000 --- a/contrib/rpws +++ /dev/null @@ -1,343 +0,0 @@ -#!/usr/bin/env perl - -# -# Copyright (c) 2009 Hatem Nassrat <hnassrat@gmail.com> -# All rights reserved. Modifications under same license as original script. -# ChangeLog: -# -# Added C-M-Right and C-M-Left for next and prev workspace -# Added move window to next prev workspace -# Added dump/restore workspaces -# -# Copyright (c) 2005 Mike O'Connor -# All rights reserved. -# Author Mike O'Connor <stew@vireo.org> -# -# Modified by Shawn Betts. -# -# code was adapeted from rpws that comes from ratpoison containing the follwing copyright: -# Copyright (C) 2003 Shawn Betts -# Author: Shawn Betts -# - -use strict; -use warnings; -use Fcntl qw (:flock); -use Getopt::Std; - -my $ratpoison = $ENV{ "RATPOISON" } || "ratpoison"; -my $tmp=$ENV{ "TMP" } || "/tmp"; -my $lockfile = $ENV{ "RPWS_LOCKFILE" } || "$tmp/rpws.$<.lock"; - -sub help -{ - system("pod2usage", $0); - print( "for more detailed documentation run \"perldoc $0\"\n" ); -} - -sub rp_call -{ - my $result = `$ratpoison -c "@_"`; - chomp( $result ); - chomp( $result ); - return $result; -} - -sub ws_init_ws -{ - - my $num = shift; - - rp_call( "gnew wspl$num" ); - my $fd = fdump(); - rp_call( "setenv fspl$num $fd" ); -} - -sub fdump -{ - return rp_call( "fdump" ); -} - -sub ws_init -{ - my $num = shift; - - $num >= 2 || die "You must create at least 2 workspaces."; - - # Backup the frames - my $fd = fdump(); - - rp_call( "select -" ); - rp_call( "only" ); - - my $i; - for my $i (2..$num) - { - ws_init_ws( $i ); - } - - # Workspace 1 uses the 'default' group. - # Start in workspace 1. - $fd = fdump(); - rp_call( "gselect default" ); - rp_call( "setenv fspl1 $fd" ); - rp_call( "setenv wspl 1" ); - - # Keep track of workspace count - rp_call( "setenv wspc $num" ); - - # restore the frames - rp_call( "frestore $fd" ); - - if( -e "$lockfile" ) - { - unlink ("$lockfile" ); - } -} - -sub ws_save -{ - my $ws = rp_call( "getenv wspl" ); - my $fd = fdump(); - rp_call( "setenv fspl$ws $fd" ); -} - -sub ws_restore -{ - my $which = shift; - my $which_name; - my $move; - - # Step1: determine which workspace to move to - - if ( $which =~ /^move/ ) - { - $move = 1; - $which = substr($which, 4); - } - - if ( $which =~ /^(?:next|prev)$/ ) - { - my $ws = rp_call( "getenv wspl" ); - my $wspc = rp_call( "getenv wspc" ); - - if ( $which eq 'next' ) - { - $ws++; - } - else - { - $ws--; - } - $which = ( ( $ws - 1 ) % $wspc ) + 1; - } - - if ( $which == 1 ) - { - $which_name = "default"; - } - else - { - $which_name = "wspl$which"; - } - - # Step 2a: Moving Window if necessary - if ( $move ) - { - rp_call( "gmove $which_name" ); - rp_call( "select -" ); - rp_call( "prev" ); - } - - # Step2: Process the workspace switch - ws_save(); - rp_call( "gselect $which_name"); - my $last = rp_call( "getenv fspl$which" ); - rp_call( "frestore $last" ); - rp_call( "setenv wspl $which" ); - - # Step 2x: Display the moved Window - if ( $move ) - { - rp_call( "next" ); - } - - rp_call( "echo Workspace $which" ); - -} - -sub ws_dump -{ - my $ws_dumpf = shift; - my $wspc = rp_call( "getenv wspc" ); - - open WSDUMP, ">$ws_dumpf" or die $!; - - ws_save(); - - for my $i (1..$wspc) - { - print WSDUMP rp_call( "getenv fspl$i" )."\n"; - } - - close WSDUMP; - - rp_call( "echo Workspaces dumped to $ws_dumpf" ); -} - -sub ws_dumprestore -{ - my $ws_dumpf = shift; - my $ws = rp_call( "getenv wspl" ); - my $wspc = rp_call( "getenv wspc" ); - - # Get dumped frame info - open WSDUMP, "$ws_dumpf" or die $!; - my @wsdata=<WSDUMP>; - close WSDUMP; - - my $wspc_dump = scalar @wsdata; - - if ($wspc < $wspc_dump) - { - # Number of workspaces to restore more than available - die "Cannot restore all workspaces (dump_count = " . $wspc_dump . ", rp_count = " . $wspc . ")"; - } - - # Restoring all workspaces - for my $i (1..$wspc_dump) - { - # calculating previous workspace number - my $j = ( $wspc + $i - 2 ) % $wspc + 1; - # moving to workspace $i -1 - ws_restore( $j ); - # restoring workspace $i - rp_call( "setenv fspl$i $wsdata[$i-1]" ); - } - - # goto the originally visible workspace - ws_restore( $ws ); - - rp_call( "echo Workspaces loaded from $ws_dumpf" ); -} - -sub add_aliases -{ - my $n = shift; - foreach my $i (1..$n) { - # Switch Workspace - rp_call ( "alias rpws$i exec $0 $i" ); - # Move Window to wrokspace - rp_call ( "alias rpwsm$i exec $0 move$i" ); - } - rp_call ( "alias rpwsn exec $0 next" ); - rp_call ( "alias rpwsp exec $0 prev" ); - rp_call ( "alias rpwsmn exec $0 movenext" ); - rp_call ( "alias rpwsmp exec $0 moveprev" ); - - -} - -sub add_keys -{ - my $n = shift; - foreach my $i (1..$n) { - # Switch Workspace - rp_call ( "definekey top M-F$i rpws$i" ); - # Move Window to wrokspace - rp_call ( "definekey top C-M-S-F$i rpwsm$i" ); - } - rp_call ( "definekey top C-M-Right rpwsn" ); - rp_call ( "definekey top C-M-Left rpwsp" ); - rp_call ( "definekey top C-M-greater rpwsmn" ); - rp_call ( "definekey top C-M-less rpwsmp" ); -} - -my $arg = shift @ARGV || 'help'; - -if( $arg eq "help" ) { - help(); -} elsif( $arg eq "init" ) { - my $num = shift @ARGV; - my %opts; - ws_init( $num ); - getopts('ka', \%opts); - add_aliases( $num ) if $opts{'a'} || $opts{'k'}; - add_keys ( $num ) if $opts{'k'}; -} elsif( $arg eq "dump" ) { - my $filename = shift @ARGV; - ws_dump($filename); -} elsif( $arg eq "restore" ) { - my $filename = shift @ARGV; - ws_dumprestore($filename); -} else { - open LOCK, ">>$lockfile" or die "Cannot open lockfile: $lockfile"; - flock(LOCK, LOCK_EX); - ws_restore( $arg ); -} - -__END__ - -=head1 NAME - -rpws - Implements multiple workspaces in ratpoison - -=head1 SYNOPSIS - - rpws init n [-k] [-a] - setup rpws with n workspaces. - -a sets up command aliases; - -k sets up key bindings and aliases. - rpws dump <fname> - dumps the current layout to <fname> - rpws restore <fname> - restores rpws workspaces from <fname> - rpws help - this documentation - rpws n - switch to this workspace - - -=head1 DESCRIPTION - - B<rpws> implements multiple workspaces in ratpoison by making calls - to fdump, freestore. It was adapted from rpws which comes with - ratpoison in the contrib directory. - -=head1 USAGE - -Add the following line in ~/.ratpoisonrc - - exec /path/to/rpws init 6 -k - -This creates 6 aliases rpws1, rpws2, etc. It also binds the keys M-F1, -M-F2, etc to each rpwsN alias. Moreover, rpwsn (Next) and rpwsp (Prev) are -created, and C-M-{Right,Left} are bound to rpws{n,p}. Full list of keybindings -created are: - - M-F$i Goto workspace $i - C-M-Right Goto Next workspace - C-M-Left Goto Prev workspace - C-M-S-F$i Move window to workspace $i - C-M-greater Move current window to next workspace - C-M-less Move current window to prev workspace - -=head1 FILES - - rpws requires use of a lockfile. It defaults to using -/tmp/rpws.<UID>.lock but this can be changed by setting the -environment variable RPWS_LOCKFILE to your desired lockfile. - -=head1 AUTHOR - - Mike O'Connor <stew@vireo.org> - -=head1 COPYRIGHT - - Copyright (c) 2005 Mike O'Connor - All rights reserved. - - 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. diff --git a/contrib/sloppy.c b/contrib/sloppy.c deleted file mode 100644 index 623e57e..0000000 --- a/contrib/sloppy.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Sloppy focus - * - * Copyright (C) 2005 Shawn Betts <sabetts@vcn.bc.ca> - * - * unrat 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, or (at your option) - * any later version. - * - * unrat 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <X11/Xos.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xproto.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/wait.h> - -int (*defaulthandler)(); - -int -errorhandler(Display *display, XErrorEvent *error) -{ - if(error->error_code!=BadWindow) - (*defaulthandler)(display,error); - return 0; -} - -int -spawn(char *cmd) -{ - int pid; - - pid = fork(); - if (pid == 0) - { - execl("/bin/sh", "sh", "-c", cmd, 0); - _exit(EXIT_FAILURE); - } - return pid; -} - -int -main (int argc, char **argv) -{ - Display *display; - int i, numscreens; - - display = XOpenDisplay(NULL); - if(!display) - { - perror("could not open display"); - exit(1); - } - - defaulthandler = XSetErrorHandler(errorhandler); - numscreens = ScreenCount(display); - - for (i=0; i<numscreens; i++) - { - unsigned int j, nwins; - Window dw1, dw2, *wins; - - XSelectInput(display,RootWindow(display, i), SubstructureNotifyMask); - XQueryTree(display, RootWindow(display, i), &dw1, &dw2, &wins, &nwins); - for (j=0; j<nwins; j++) - XSelectInput(display, wins[j], EnterWindowMask); - } - - while (1) - { - XEvent event; - do - { - XNextEvent(display,&event); - if (event.type == CreateNotify) - XSelectInput(display, event.xcreatewindow.window, EnterWindowMask); - } while(event.type != EnterNotify); - - /* A window was entered. select it. */ - { - char shell[256]; - snprintf (shell, 255, "$RATPOISON -c \"select `$RATPOISON -c 'windows %%i %%n' | grep '%ld' | awk '{print $2}'`\"", event.xcrossing.window); - //printf ("%s\n", shell); - spawn (shell); - wait (NULL); - } - } - - XCloseDisplay (display); - - return 0; -} - -/* -Local Variables: *** -compile-command: "gcc -g -Wall -O2 -I/usr/X11R6/include -o sloppy sloppy.c -L/usr/X11R6/lib -lX11" *** -End: *** -*/ diff --git a/contrib/split.sh b/contrib/split.sh deleted file mode 100755 index 1c8c009..0000000 --- a/contrib/split.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2003 Shawn Betts -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# -# Split the current frame into 16 little frames. This is an example of -# how to script ratpoison. - -if [ -z "$RATPOISON" ]; then - RATPOISON=ratpoison -fi - -# $RATPOISON -c only - -#split into 4 frames - -$RATPOISON -c split -$RATPOISON -c hsplit -$RATPOISON -c focusdown -$RATPOISON -c hsplit - -# split each new frame into 4 - -$RATPOISON -c split -$RATPOISON -c hsplit -$RATPOISON -c focusdown -$RATPOISON -c hsplit - -$RATPOISON -c focusup -$RATPOISON -c focusup - -$RATPOISON -c split -$RATPOISON -c hsplit -$RATPOISON -c focusdown -$RATPOISON -c hsplit - -$RATPOISON -c focusright -$RATPOISON -c focusright - -$RATPOISON -c split -$RATPOISON -c hsplit -$RATPOISON -c focusdown -$RATPOISON -c hsplit - -$RATPOISON -c focusdown - -$RATPOISON -c split -$RATPOISON -c hsplit -$RATPOISON -c focusdown -$RATPOISON -c hsplit diff --git a/contrib/unrat.c b/contrib/unrat.c deleted file mode 100644 index 272ed6e..0000000 --- a/contrib/unrat.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Warp the pointer to the bottom right corner of the screen any time a key is pressed. - * - * Copyright (C) 2005 Shawn Betts <sabetts@vcn.bc.ca> - * - * unrat 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, or (at your option) - * any later version. - * - * unrat 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -/* -This is what I used to compile it: - -gcc -g -Wall -O2 -I/usr/X11R6/include -o unrat unrat.c -L /usr/X11R6/lib -lX11 -*/ - -#include <X11/Xos.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xproto.h> -#include <stdio.h> -#include <stdlib.h> - -int (*defaulthandler)(); - -int -errorhandler(Display *display, XErrorEvent *error) -{ - if(error->error_code!=BadWindow) - (*defaulthandler)(display,error); - return 0; -} - -int -main (int argc, char **argv) -{ - Display *display; - int i, numscreens; - - display = XOpenDisplay(NULL); - if(!display) - { - perror("could not open display"); - exit(1); - } - - defaulthandler = XSetErrorHandler(errorhandler); - numscreens = ScreenCount(display); - - for (i=0; i<numscreens; i++) - { - unsigned int j, nwins; - Window dw1, dw2, *wins; - - XSelectInput(display,RootWindow(display, i), KeyReleaseMask | SubstructureNotifyMask); - XQueryTree(display, RootWindow(display, i), &dw1, &dw2, &wins, &nwins); - for (j=0; j<nwins; j++) - XSelectInput(display, wins[j], KeyReleaseMask); - } - - while (1) - { - XEvent event; - do - { - XNextEvent(display,&event); - if (event.type == CreateNotify) - XSelectInput(display, event.xcreatewindow.window, KeyReleaseMask); - } while(event.type != KeyRelease); - - /* A key was pressed. warp the rat. */ - for (i=0; i<numscreens; i++) - { - int x, y, wx, wy; - unsigned int mask; - Window root, child; - - XQueryPointer (display, RootWindow(display, i), - &root, &child, - &x, &y, &wx, &wy, - &mask); - if (x < DisplayWidth (display, i)-1 - || y < DisplayHeight (display, i)-1) - XWarpPointer (display, None, RootWindow(display, i), 0, 0, 0, 0, DisplayWidth (display, i), DisplayHeight (display, i)); - } - } - - XCloseDisplay (display); - - return 0; -} diff --git a/debian/README.Debian b/debian/README.Debian deleted file mode 100644 index 2ee73e6..0000000 --- a/debian/README.Debian +++ /dev/null @@ -1,18 +0,0 @@ -ratpoison for Debian --------------------- - -Beside some patches stolen from the ratpoison mailinglist or directly from -ratpoison's cvs to fix some bugs, the Debian version of ratpoison has the -following feature-extending patches applied: - -brl-enlarge.diff: - Add remove{left,right,up,down} extending the current - frame deleting frames in the given direction. -brl-menu.diff: - add default alias "menu" with binding "." and advertise it. - -For information how to tweak the menu (setting your favorite colours, -using another program or how it works at all, read the comments within -/etc/X11/ratpoison/ratpoisonmenu ) - - -- Bernhard R. Link <brlink@debian.org>, Sat, 20 May 2006 13:45:34 +0200 diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index 95d32e0..0000000 --- a/debian/README.source +++ /dev/null @@ -1,35 +0,0 @@ -This Debian package uses the tar files upstream releases -and applies some patches on top. Those patches are already -applied in the Debian source package, so if you unpackaged -the Debian source package, you can just modify what you want -and build and ignore everything less. - -If you want to package a new upstream release: ----------------------------------------------- - -Just decide which patches from debian/patches you want to -apply and build the package. - - -If you want to build a package from git: ----------------------------------------- - -If you want to build from git, you might also want to apply -some of the patches. Additionally you either need to increase the -build dependencies (or ignore that your package has not enough) -or generate an .orig.tar file with all the needed files processes. -(This usually happens by calling make dist). - -To get packages from the current git you for example an do: - -sudo apt-get install git-core devscripts autoconf automake texinfo # ... -sudo apt-get build-dep ratpoison -git clone git://git.sv.gnu.org/ratpoison.git -cd ratpoison -autoreconf -i -rm -r autom4te.cache -./configure -make dist -mv ratpoison-1.4.6-GIT.tar.gz ../ratpoison_1.4.6~git$(date +%Y%m%d).orig.tar.gz -dch -v "1.4.6~git$(date +%Y%m%d)-0" "local git package" -dpkg-buildpackage -rfakeroot -us -uc diff --git a/debian/callmenu.sh b/debian/callmenu.sh deleted file mode 100644 index ad0c3de..0000000 --- a/debian/callmenu.sh +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/sh -# ratpoison helper script to start up an menu -# change this line to globally set options -# (like -fg, -bg or -font) -options="-popup" - -if [ "$#" -ne "1" ] ; then - echo "Syntax: /etc/X11/ratpoison/ratpoisonmenu <menufile>" - exit 1 -fi -file="$1" -parent="`echo "$file" | sed -e 's/\.[^.]*\.menu$/.menu/'`" -if [ -f "$HOME/.ratpoison_menu/$file" ] ; then - dir="$HOME/.ratpoison_menu" -elif [ -f "/etc/X11/ratpoison/menu/$file" ] ; then - # To allow a global override of single files... - # (additionally to the easy changing of what - # update-menus generates... - dir="/etc/X11/ratpoison/menu" -else - dir="/var/lib/ratpoison/menu" -fi -if [ -f /etc/X11/ratpoison/ratpoisonmenu.options ] ; then - # for those that do not like changing this file directly... - . /etc/X11/ratpoison/ratpoisonmenu.options -fi -if [ -f "$HOME/.ratpoison_menu/options" ] ; then - # parse file, so you can set $options - # like options="$options -fg blue -bg black" - # You can even exec in there, if you do not like 9menu - . "$HOME/.ratpoison_menu/options" -fi -if ! which 9menu >/dev/null ; then - if which ratmenu >/dev/null && [ -x "/etc/X11/ratmenu/$file" ] ; then - ratpoison -c "echo 9menu not installed, using ratmenu instead" - exec "/etc/X11/ratmenu/$file" - else - exec ratpoison -c "echo 9menu not installed" - fi -fi -if ! [ -f "$dir/$file" ] ; then - if [ "$file" = "debian.menu" ] ; then - exec ratpoison -c "echo no menu definition found (package 'menu' missing?)" - else - exec ratpoison -c "echo no definition for $file found!" - fi -fi -if [ "$file" = "debian.menu" ] ; then - exec 9menu $options -file "$dir/$file" '(cancel):exec' -else - exec 9menu $options -file "$dir/$file" ..:"$0 \"$parent\"" -fi diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 833cc68..0000000 --- a/debian/changelog +++ /dev/null @@ -1,455 +0,0 @@ -ratpoison (1.4.6~git-0) UNRELEASED; urgency=low - - * new upstream version - * remove patches already in the upstream version - - -- Bernhard R. Link <brlink@debian.org> Fri, 30 Oct 2009 18:39:12 +0100 - -ratpoison (1.4.5-2) unstable; urgency=low - - * switch to source format 3.0 (quilt) - * add DEP3 headers to patches - * cherry-pick fix to avoid getline problems with newer glibc - (Closes: 552894) - - -- Bernhard R. Link <brlink@debian.org> Thu, 29 Oct 2009 16:38:10 +0100 - -ratpoison (1.4.5-1) unstable; urgency=low - - * new upstream version - - non-interactive exec no longer adds to history (Closes: 478977) - - fix fgcolor/bgcolor broken by libXft (Closes: 526174) - * make bash-features using sh-script a bash-script (Closes: 530176) - * manually remove info/dir.gz, as Debian now uses gnu install-info - - -- Bernhard R. Link <brlink@debian.org> Tue, 14 Jul 2009 15:40:00 +0200 - -ratpoison (1.4.4-1) unstable; urgency=low - - * new upstream version - - now with libXft support, thus new dependencies - - fixes tempwm issuses (Closes: 478979) - - new prevscreen and nextscreen binding (Closes: 498348) - - new input history: - no longer needs libreadline and separate histories (Closes: 478977) - * make patches compatible with v3 dsc (Closes: 484957) - * bump Standards-Version - - support parallel in DEB_BUILD_OPTIONS - - noopt and nostrip only space delmited - * no longer needs config.guess and config.sub (and thus no autotools-dev) - - -- Bernhard R. Link <brlink@debian.org> Mon, 27 Apr 2009 13:55:42 +0200 - -ratpoison (1.4.3-1) unstable; urgency=low - - * new upstream version - * fix warning in manpage parsing - - -- Bernhard R. Link <brlink@debian.org> Thu, 21 Feb 2008 14:34:20 +0100 - -ratpoison (1.4.2-2) unstable; urgency=low - - * increase standards-version to 3.7.3 - * recode debian/copyright to utf-8 - * add Homepage and Vcs headers - * clean up debian/rules a bit - * don't link against libXext - - -- Bernhard R. Link <brlink@debian.org> Sun, 30 Dec 2007 15:01:18 +0100 - -ratpoison (1.4.2-1) unstable; urgency=low - - * new upstream version - - obsoletes restorededication.patch, memoryhole.patch, - noabortonvoncerterror.diff, nodoubleclassreading.diff, - nodoubleclassreading.diff, utf8locale.diff - - mimic emacs X key naming more closely. A modifier being both - Hyper and Super should only be treated as one and not as both - (Closes: 419882) - - -- Bernhard R. Link <brlink@debian.org> Sun, 7 Oct 2007 11:29:55 +0200 - -ratpoison (1.4.1-5) unstable; urgency=low - - * backport of some patches to 1.4.1: - - nodoubleclassreading.diff: reduce X server communication a bit - - noabortonconverterror.diff: don't abort (by requesting infinite - amount of memory) if there is an string truncation error. (Closes: 423141) - - utf8locale.diff: also handle utf8 window titles correctly if ratpoison - itself is running in utf8 locale. (Closes: 438063) - * adopt to new menu layout - - -- Bernhard R. Link <brlink@debian.org> Wed, 15 Aug 2007 12:24:28 +0200 - -ratpoison (1.4.1-4) unstable; urgency=low - - * close memory hole in dealing with utf-8 window titles (Closes: 423141) - - -- Bernhard R. Link <brlink@debian.org> Fri, 01 Jun 2007 20:04:18 +0200 - -ratpoison (1.4.1-3) unstable; urgency=low - - * change doc-base file to satisfy new doc-base package (Closes: 419783) - - -- Bernhard R. Link <brlink@debian.org> Wed, 18 Apr 2007 10:05:48 +0200 - -ratpoison (1.4.1-2) unstable; urgency=low - - * first upload to unstable of new upstream version - - slit.sh fixed (Closes: 398048) - - supports window titles in different encodings (Closes: 376067) - * install rpws into /usr/bin instead of doc/examples/ - * fix bug to not restore dedicateness of frames - * some little cleanups of the packaging - - -- Bernhard R. Link <brlink@debian.org> Tue, 17 Apr 2007 12:09:14 +0200 - -ratpoison (1.4.1-1) experimental; urgency=low - - * new upstream version - * re-add doc-base file listing info document. - * update brl-menu.diff to current cvs. - * drop texinfo build-dependency, update x-dev dependency - - -- Bernhard R. Link <brlink@debian.org> Tue, 20 Dec 2006 20:23:00 +0100 - -ratpoison (1.4.1~CVS20061026-1) experimental; urgency=low - - * experimental cvs snapshot - - incorporates most of the previous patches - - has some further fontset support needing testing - - -- Bernhard R. Link <brlink@debian.org> Sun, 29 Oct 2006 14:14:18 +0100 - -ratpoison (1.4.0.dfsg-7) unstable; urgency=medium - - * call dh_installinfo, so that info files get indexed at installation - (Closes: 384910) - - -- Bernhard R. Link <brlink@debian.org> Sat, 28 Oct 2006 21:55:35 +0200 - -ratpoison (1.4.0.dfsg-6) unstable; urgency=low - - * fix bug in remove{left,up,right,down} which could corrupt the - frame data. - * document max width support in format string (Closes: 382299) - * do not ignore exitcode of make distclean - * give configure a --disable-dependency-tracking on normal compile - * install python bindings using python-support if installed - (Copied from dh_pysupport to avoid build-depending on python). - - -- Bernhard R. Link <brlink@debian.org> Sun, 3 Sep 2006 16:07:15 +0200 - -ratpoison (1.4.0.dfsg-5) unstable; urgency=low - - * add avoidupdates.diff to not update window name window - on property events not changing anything. - Thanks to Chris Lesniewski-Laas for this. - (Closes: 375157) - * add dontprolong.diff to not reset the timer when updateing - window names window. (Makes the bug even more impossible to happen again) - * remove windows_loop_workaround.diff (superseded by the two before) - - -- Bernhard R. Link <brlink@debian.org> Sun, 16 Jul 2006 21:58:46 +0200 - -ratpoison (1.4.0.dfsg-4) unstable; urgency=low - - * fix mention of 1.4.1 in info document - * do not restart bar window when windows command is issued - while the window is still active. (Works around: #375157) - * patch doc/Makefile to not generate dir.gz files - - -- Bernhard R. Link <brlink@debian.org> Mon, 26 Jun 2006 10:56:35 +0200 - -ratpoison (1.4.0.dfsg-3) unstable; urgency=low - - * add info page from current cvs (minus the two commands not in this version) - * downgrade depedency on 9menu to recommends (Closes: 368548) - dropping x-w-m priority to 20 because of that - * remove x-w-m alternative on deconfigure, - readd on abort-remove and abort-deconfigure (Closes: 374474) - * add example to manpage how to use -c (Closes: 369612) - - -- Bernhard R. Link <brlink@debian.org> Thu, 22 Jun 2006 15:00:58 +0200 - -ratpoison (1.4.0.dfsg-2) unstable; urgency=low - - * include ratpoison-cmd.el forgotten in the first try (Closes: 368317) - * make emacsen-install script less sensitive - * add debian/patches/avoid-segfault.diff working around segfault with - remote commands - - -- Bernhard R. Link <brlink@debian.org> Sun, 21 May 2006 15:48:12 +0200 - -ratpoison (1.4.0.dfsg-1) unstable; urgency=low - - * new maintainer (Closes: 368067) - * new upstream version (Closes: 364488) - - fixes the tmpwm freeze (Closes: 357905) - * removed the info page from the upstream tarball - (GFDL and does not include the license as mandated by the license) - * repackaged from scratch - - change description (and include a Homepage:) - - use 9menu to provide menus - - install the bindings for emacs-lisp, perl, python and ruby - - add a watch file - - no longer ship a .desktop file as already registered in the Debian menu - * add debian/patches/net_wm_pid.diff to work around problems of qt programs - * add debian/patches/from-cvs-hook.diff from cvs to fix the hook command. - * add debian/patches/from-cvs-raise.diff from cvs to fix raise notifiers. - * add debian/patches/brl-enlarge.diff adding remove{left,right,up,down} - * add debian/patches/brl-xchange.diff adding exchange{left,right,up,down} - * add debian/patches/brl-menu.diff advertising the menu - (configure changes in debian/patches/brl-menu.reconf) - - -- Bernhard R. Link <brlink@debian.org> Sat, 20 May 2006 17:18:22 +0200 - -ratpoison (1.4.0-beta4-10) unstable; urgency=low - - * Added Suggests: for xclip, a very cool program - - -- Jonathan Walther <krooger@debian.org> Sun, 12 Mar 2006 18:10:52 -0700 - -ratpoison (1.4.0-beta4-9) unstable; urgency=low - - * Fixed typo in package description. Thank you Dan Jacobson. - * Added a versioned debhelper build-depends. Thank you lintian. - - -- Jonathan Walther <krooger@debian.org> Tue, 28 Feb 2006 13:31:52 -0700 - -ratpoison (1.4.0-beta4-8) unstable; urgency=low - - * Fixed installation of gdm/kdm support, as per Martin Samuelsson's - suggestions. - Closes: #348036 - - -- Jonathan Walther <krooger@debian.org> Sat, 14 Jan 2006 19:31:52 -0700 - -ratpoison (1.4.0-beta4-7) unstable; urgency=low - - * Added Martin Samuelsson's addhook patch to fix a crashing bug. - Closes: #347023 - - -- Jonathan Walther <krooger@debian.org> Thu, 12 Jan 2006 12:21:52 -0700 - -ratpoison (1.4.0-beta4-6) unstable; urgency=low - - * Added dpatch as a Build-Depends to make buildd work. - * Fixed typo in debian/rules that prevented building. - - -- Jonathan Walther <krooger@debian.org> Tue, 10 Jan 2006 14:54:52 -0700 - -ratpoison (1.4.0-beta4-5) unstable; urgency=low - - * Added Martin Samuelsson's numbering bug patch. - * Added dpatch support to the package to manage any future - patches. - - -- Jonathan Walther <krooger@debian.org> Mon, 9 Jan 2006 16:28:52 -0700 - -ratpoison (1.4.0-beta4-4) unstable; urgency=low - - * Added libxtst-dev Build-Depends to fix buildd breakage. - - -- Jonathan Walther <krooger@debian.org> Mon, 9 Jan 2006 10:46:52 -0700 - -ratpoison (1.4.0-beta4-3) unstable; urgency=low - - * Adding Mike O'Connor's suggested Build-Depends. - Closes: #347023 - - -- Jonathan Walther <krooger@debian.org> Mon, 9 Jan 2006 10:20:52 -0700 - -ratpoison (1.4.0-beta4-2) unstable; urgency=low - - * Use most current config.guess and config.sub files, as explained in - /usr/share/doc/autotools-dev/README.Debian.gz - Closes: #347183 - - -- Jonathan Walther <krooger@debian.org> Mon, 9 Jan 2006 01:16:52 -0700 - -ratpoison (1.4.0-beta4-1) unstable; urgency=low - - * Updating to most recent upstream, which includes X.org fixes. - Closes: #327196 - * Adding more scripting examples. - Closes: #343883 - - -- Jonathan Walther <krooger@debian.org> Sun, 8 Jan 2006 19:03:52 -0700 - -ratpoison (1.3.0-8) unstable; urgency=low - - * xlibs-dev depend no longer valid. See the following message. - http://lists.debian.org/debian-devel-announce/2005/11/msg00022.html - Closes: #347023 - - -- Jonathan Walther <krooger@debian.org> Sun, 8 Jan 2006 18:38:52 -0700 - -ratpoison (1.3.0-7) unstable; urgency=low - - * Applied Luca Capello's patch for GDM support. Closes: #307779 - - -- Jonathan Walther <krooger@debian.org> Thu, 5 May 2005 16:46:52 -0700 - -ratpoison (1.3.0-6) unstable; urgency=low - - * Applied Mike O'Connor's fix for tmpwm race. Closes: #305955 - - -- Jonathan Walther <krooger@debian.org> Sat, 23 Apr 2005 00:15:52 -0700 - -ratpoison (1.3.0-5) unstable; urgency=low - - * Fixed missing '=' in menu file. Closes: #294466 - - -- Jonathan Walther <krooger@debian.org> Wed, 9 Feb 2005 13:44:52 -0700 - -ratpoison (1.3.0-4) unstable; urgency=low - - * Fixed lintian warning about no DEBHELPER symbol in {pre,post}{rm,inst} - * Removed ChangeLog from docs file, since dh_installchangelogs is now used. - * Silenced other lintian warnings. - - -- Jonathan Walther <krooger@debian.org> Wed, 2 Feb 2005 14:15:12 -0700 - -ratpoison (1.3.0-3) unstable; urgency=low - - * Fixed lintian bitching about upstream changelogs - - -- Jonathan Walther <krooger@debian.org> Tue, 1 Feb 2005 19:40:36 -0700 - -ratpoison (1.3.0-2) unstable; urgency=low - - * Copied twm's alternative handling. Closes: #293221 - - -- Jonathan Walther <krooger@debian.org> Tue, 1 Feb 2005 18:36:52 -0700 - -ratpoison (1.3.0-1) unstable; urgency=low - - * Add a Build-Depends for autotools and use latest config.sub and - config.guess. Allows compilation on amd64 platforms. Thank you for the - patch, Andreas. Closes: #293172 - * Created orig.tar.gz, because this isn't a native package. - - -- Jonathan Walther <krooger@debian.org> Tue, 1 Feb 2005 09:05:18 -0700 - -ratpoison (1.3.0) unstable; urgency=low - - * New upstream version. Closes: #257098 - * Removed build-depends on automaken. Thank you Mike. Closes: #289743 - * Fixed manpage installation. Thank you Shyamal and Jari. - Closes: #267475, #292578 - * Frameset management is in this version. Closes: #208427 - * Bumped Standards-Version to 3.6.1.1 - - -- Jonathan Walther <krooger@debian.org> Mon, 31 Jan 2005 00:17:16 -0700 - -ratpoison (1.2.1) unstable; urgency=low - - * Removed version in Build-depends for automake (Closes: #166283) - * Now suggests xbindkeys instead of keylaunch - * Defaults to x-terminal-emulator instead of xterm (Closes: #196343) - * Changed the doc-base section to WindowManagers (Closes: #186244) - * Made this package from tarball, not CVS (Closes: #169662) - - -- Jonathan Walther <krooger@debian.org> Sun, 8 Jun 2003 12:20:37 -0700 - -ratpoison (1.2.0.cvs.20020425-3) unstable; urgency=low - - * Added Build-Depends for automake (Closes: #149500) - - -- Jonathan Walther <krooger@debian.org> Sun, 9 Jun 2002 22:32:41 -0700 - -ratpoison (1.2.0.cvs.20020425-2) unstable; urgency=low - - * Changed Maintainer field; Gergely has gotten busy with Real Life - * Updated build dependancies - * Cleaned up the rules file a bit - - -- Jonathan Walther <krooger@debian.org> Sat, 8 Jun 2002 12:25:33 -0700 - -ratpoison (1.2.0.cvs.20020425) unstable; urgency=low - - * CVS snapshot of release candidate 1.2.0 - * Many bugfixes better described in the ChangeLog - - -- Jonathan Walther <krooger@debian.org> Wed, 5 Jun 2002 22:21:24 -0700 - -ratpoison (1.0.0.cvs.20020117-1) unstable; urgency=low - - * CVS snapshot release on 2002-01-17: - + Documentation about `colon' corrected (Closes: #115158) - + BadWindow misbehaviour fixed (Closes: #123942, #123379, #128563) - - -- Gergely Nagy <algernon@debian.org> Thu, 17 Jan 2002 21:13:03 +0100 - -ratpoison (1.0.0.cvs.20011208-1) unstable; urgency=low - - * CVS snapshot release on 2001-12-08 - * Recommend ratmenu (Closes: #113624) - * debian/control: Do not recommend xterm, but xvt, that fits better with - the ratpoison idea - * debian/control: Changed Maintainer field, and added SirDibos and - myself to Uploaders - * debian/ratpoison.examples: include most of contrib/ - - -- Gergely Nagy <algernon@debian.org> Sat, 8 Dec 2001 23:40:32 +0100 - -ratpoison (1.0.0-1) unstable; urgency=medium - - * New upstream release! - + Contains a fixed ratpoison.texi (Closes: #107939) - - -- Gergely Nagy <algernon@debian.org> Thu, 6 Sep 2001 16:41:41 +0200 - -ratpoison (0.2.0.cvs.20010806-1) unstable; urgency=low - - * CVS snapshot release as of 2001-08-06. - * Bumped Standards-Version to 3.5.6 - * Changed maintainer e-mail address - - -- Gergely Nagy <algernon@debian.org> Mon, 6 Aug 2001 13:36:57 +0200 - -ratpoison (0.1.1-3) unstable; urgency=low - - * Do not try to send C-t to the underlying window if there - is none (Closes: #101625) - - -- Gergely Nagy <8@free.bsd.hu> Wed, 20 Jun 2001 17:02:21 +0200 - -ratpoison (0.1.1-2) unstable; urgency=low - - * Build-Depend on x-terminal-emulator. (Closes: Bug#89272) - - -- Gergely Nagy <8@free.bsd.hu> Sun, 11 Mar 2001 18:22:21 +0100 - -ratpoison (0.1.1-1) unstable; urgency=low - - * New upstream release. - - -- Gergely Nagy <8@free.bsd.hu> Tue, 6 Mar 2001 19:36:45 +0100 - -ratpoison (0.1.0-1) unstable; urgency=low - - * New upstream release. - - -- Gergely Nagy <8@free.bsd.hu> Sun, 4 Mar 2001 01:09:29 +0100 - -ratpoison (0.0.5-20001216) unstable; urgency=low - - * CVS version as of 2000/12/16 - - -- Gergely Nagy <8@free.bsd.hu> Sat, 16 Dec 2000 18:13:19 +0100 - -ratpoison (0.0.5-2) unstable; urgency=low - - * Does not include /usr/info anymore. Whoops... - * Modified menu entry (Closes: Bug#79072). - * Fixed debian/rules#clean, I'm terribly sorry, won't happen again. - - -- Gergely Nagy <8@free.bsd.hu> Mon, 11 Dec 2000 12:33:55 +0100 - -ratpoison (0.0.5-1) unstable; urgency=low - - * Initial Release. - - -- Gergely Nagy <8@free.bsd.hu> Mon, 4 Dec 2000 21:52:54 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index e3c1360..0000000 --- a/debian/control +++ /dev/null @@ -1,28 +0,0 @@ -Source: ratpoison -Section: x11 -Priority: extra -Maintainer: Bernhard R. Link <brlink@debian.org> -Build-Depends: debhelper (>= 5), libx11-dev, libxext-dev, x11proto-core-dev, libxinerama-dev, libxtst-dev, libxft-dev, perl -Standards-Version: 3.8.3 -Homepage: http://www.nongnu.org/ratpoison/ -Vcs-Browser: http://git.savannah.nongnu.org/gitweb/?p=ratpoison.git -Vcs-Git: git://git.savannah.nongnu.org/ratpoison.git - -Package: ratpoison -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Recommends: 9menu (>= 1.6), menu, rxvt | x-terminal-emulator -Suggests: xbindkeys, xclip -Provides: x-window-manager -Description: keyboard-only window manager - ratpoison is a simple window manager with no fancy graphics, - no window decorations, and no rodent dependence. - It is largely modelled after GNU Screen. - . - The screen can be split into non-overlapping frames. All - windows are kept maximized inside their frames to take - full advantage of your precious screen real estate. - . - All interaction with the window manager is done through - keystrokes. ratpoison has a prefix map to minimize - key clobbering. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 5a9a002..0000000 --- a/debian/copyright +++ /dev/null @@ -1,95 +0,0 @@ -This package was debianized by Bernhard R. Link <brlink@debian.org> on -Sat, 20 May 2006 13:45:34 +0200. - -It was downloaded from http://savannah.nongnu.org/download/ratpoison/ - -Upstream Authors: - -Shawn Betts (sabetts@users.sourceforge.net) -Ryan Yeske (rcyeske@vcn.bc.ca) - -Other Contributors: - -Ben Leslie <benno at sesgroup dot net> -Chr. v. Stuckrad <stucki at math dot fu-berlin dot de> -Dan Aloni <da-x at gmx dot net> -Doug Kearns <djkea2 at mugc dot its dot monash dot edu dot au> -Gergely Nagy <algernon at debian dot org> -Henrik Enberg <henrik at enberg dot org> -Jonathan Walther <krooger at debian dot org> -Martin Samuelsson <rp-contrib at cos dot user dot lysator dot liu dot se> -Mike Meyer <mwm at mired dot org> -Nicklas Lindgren <nili at lysator dot liu dot se> -Pasi Kallinen <pkalli at cs dot joensuu dot fi> -Rupert <rupert dot debian at hotpop dot com> -Tim Goodwin <tjg at star dot le dot ac dot uk> -Joshua Neuheisel <jneuheisel at msn dot com> -Thien-Thi Nguyen <ttn at surf dot glug dot org> -Joshua Neuheisel <jneuheisel at msn dot com> -Sylvain BEUCLER <beuc at beuc dot net> -Cameron Patrick <cameron at patrick dot wattle dot id dot au> -Trent Buck <fubarbaz at bigpond dot com> -jesus c. meyendriesch <jesus at qplay dot org> -Bernhard R. Link <brlink at debian dot org> -Tobias C. Rittweiler <tcr at freebits dot de> -Antti Nykänen <aon at iki dot fi> -rubikitch <rubikitch at ruby-lang dot org> -Florian E.J. Fruth <fejf at rommel stw uni-erlangen dot de> -Tim Cooijmans <tim at aapopfiets dot nl> -Andreas Seltenreich <uwi7 at rz dot uni-karlsruhe dot de> -Steve Folta <steve at folta dot net> -Midare Kiyura <puce at gmx dot com> -Joshua Neuheisel -Philip Hudson <phil.hudson at iname dot com> -Ali Gholami Rudi <aliqrudi at gmail dot com> -Hatem Nassrat <hnassrat at gmail dot com> -J.R. Mauro <jrm8005 at gmail dot com> -Kipling Inscore <k at bijna dot net> -Rob Paisley <paisley at www rpaisley dot com> - -License: - Copyright (C) 2000-2009 Shawn Betts <sabetts@vcn.bc.ca> - - ratpoison 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, or (at your option) - any later version. - - ratpoison 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 software; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1301, USA. - -On Debian systems, the complete text of the GNU General -Public License can be found in `/usr/share/common-licenses/GPL-2'. - -The autotools related files in the source are -Copyright (C) 1994 X Consortium -Copyright (C) 1996-2007 Free Software Foundation, Inc. -and available under GPLv2 or more permissive licenses. - -src/getopt.h and src/getopt1.c are -Copyright (C) 1989-97 Free Software Foundation, Inc. - -src/linkedlist.* is also -Copyright (C) 2003 Linus Torvalds - -src/format.c is -Copyright (C) 2006 Antti Nykänen - -src/xinerama.* is -Copyright (C) 2003 Cameron Patrick - -rpws is: -Copyright (c) 2009 Hatem Nassrat <hnassrat@gmail.com> -Copyright (c) 2005 Mike O'Connor -Copyright (C) 2003 Shawn Betts -and under GPLV2+ as everything else. - -rpshowall.sh is -Copyright (C) 2003 Florian Cramer <cantsin@zedat.fu-berlin.de> diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index d527b30..0000000 --- a/debian/dirs +++ /dev/null @@ -1,7 +0,0 @@ -usr/bin -etc/X11/ratpoison -var/lib/ratpoison/menu -usr/share/emacs/site-lisp/ratpoison -usr/share/perl5 -usr/share/python-support/ratpoison -usr/lib/ruby/1.8 diff --git a/debian/docs b/debian/docs deleted file mode 100644 index edc0071..0000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -NEWS diff --git a/debian/emacsen-install b/debian/emacsen-install deleted file mode 100644 index e9adcbd..0000000 --- a/debian/emacsen-install +++ /dev/null @@ -1,46 +0,0 @@ -#! /bin/sh -e -# /usr/lib/emacsen-common/packages/install/ratpoison - -# Written by Jim Van Zandt <jrv@vanzandt.mv.com>, borrowing heavily -# from the install scripts for gettext by Santiago Vila -# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>. -# modified for ratpoison by Bernhard R. Link <brlink@debian.org> - -FLAVOR="$1" -PACKAGE=ratpoison -ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} -ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} -FILES=ratpoison-cmd.el - -if [ ${FLAVOR} = emacs ]; then - exit 0 -fi -for file in ${FILES} ; do - if [ ! -f ${ELDIR}/${file} ]; then - echo "Warning: missing file ${ELDIR}/${file}!" >&2 - exit 0 - fi -done - -echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} - -FLAVORTEST=`echo $FLAVOR | cut -c-6` -if [ ${FLAVORTEST} = xemacs ] ; then - SITEFLAG="-no-site-file" -else - SITEFLAG="--no-site-file" -fi -FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" - -install -m 755 -d ${ELCDIR} -cd ${ELDIR} -cp ${FILES} ${ELCDIR} -cd ${ELCDIR} - -cat << EOF > path.el -(setq load-path (cons "." load-path) byte-compile-warnings nil) -EOF -${FLAVOR} ${FLAGS} ${FILES} -rm -f *.el path.el - -exit 0 diff --git a/debian/emacsen-remove b/debian/emacsen-remove deleted file mode 100644 index d272529..0000000 --- a/debian/emacsen-remove +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -e -# /usr/lib/emacsen-common/packages/remove/ratpoison - -FLAVOR=$1 -PACKAGE=ratpoison - -if [ ${FLAVOR} != emacs ]; then - echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} - rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} -fi diff --git a/debian/menu b/debian/menu deleted file mode 100644 index 3914777..0000000 --- a/debian/menu +++ /dev/null @@ -1,2 +0,0 @@ -?package(ratpoison):needs="wm" section="Window Managers" \ - title="ratpoison" command="/usr/bin/ratpoison" diff --git a/debian/menu-method b/debian/menu-method deleted file mode 100644 index 50ccfad..0000000 --- a/debian/menu-method +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/install-menu - -!include menu.h - -compat="menu-1" - -function menufilename($s) = ifempty($s,"debian") replacewith($s," /","_.") ".menu" -function runmenu($s) = "/etc/X11/ratpoison/ratpoisonmenu \"" esc(menufilename($s),"\"") "\"" - -startmenu="" -genmenu=menufilename(ifelse($command,parent($section),parent($section))) -endmenu="" - -rootsection="debian" -rootprefix="/var/lib/ratpoison/menu" -userprefix=".ratpoison_menu" -treewalk="(m)c" -function q($s) = replacewith($s,":",".") -supported -ratpoisonspecial = "\\" q(title()) ":exec " $command "\n" -x11 = "\\" q(title()) ":exec " $command "\n" -text= "\\" q(title()) ":exec " term() "\n" -wm= "\\" q(title()) ":exec /usr/bin/ratpoison -c \"newwm " esc($command,"\"") "\"\n" -endsupported - -submenutitle= "\\" q(title()) ":exec " runmenu($section) "\n" -preoutput="#Automatically generated file. Do not edit (see /usr/share/doc/menu/html)\n#\n" diff --git a/debian/patches/530176.diff b/debian/patches/530176.diff deleted file mode 100644 index 3b1779e..0000000 --- a/debian/patches/530176.diff +++ /dev/null @@ -1,14 +0,0 @@ -Author: Bernhard R. Link <brlink@debian.org> -Description: rpshowall.sh needs bash, so use #!/bin/bash -Bug: 530176 - -Index: ratpoison-1.4.5/contrib/rpshowall.sh -=================================================================== ---- ratpoison-1.4.5.orig/contrib/rpshowall.sh 2009-07-14 15:10:18.000000000 +0200 -+++ ratpoison-1.4.5/contrib/rpshowall.sh 2009-07-14 15:10:25.000000000 +0200 -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/bin/bash - - # rpshowall - # ratpoison script to show all open windows diff --git a/debian/patches/README b/debian/patches/README deleted file mode 100644 index 1101a32..0000000 --- a/debian/patches/README +++ /dev/null @@ -1,22 +0,0 @@ -This directory lists patches used by the Debian package. It is not used -by the normal Debian package build, as the patches are already applied -by the .diff.gz all together. - -* If you are NMUing the Debian package: - - Just ignore this directory (unless it helps you to understand what I did). - Everything applicaple to your .orig.tar.gz should already be in the - .diff.gz you have. Just modify the actual code, submit a patch with what - you did to the BTS and let me sort it out and include the patch in this - directory. - -* If you do a locally modified package: - - Your choice. But you can savely ignore this directory. Nothing in the - build system uses it. - -* If you are preparing a new version - - Start with the clean source from git or the tarball. Choose which of the patches - from this directy you want to apply and apply them. Copy the debian directory - and build. diff --git a/debian/patches/brl-enlarge.diff b/debian/patches/brl-enlarge.diff deleted file mode 100644 index 513faee..0000000 --- a/debian/patches/brl-enlarge.diff +++ /dev/null @@ -1,425 +0,0 @@ -Author: Bernhard R. Link <brlink@debian.org> -Subject: add removeleft/up/right/down commands - -This patch adds new removeleft/up/right/down commands to extend the current -frame in the given direction, removing all frames in the way. -Default key-bindings are C-t M-arrow-keys. - -Index: ratpoison-1.4.4/ChangeLog -=================================================================== ---- ratpoison-1.4.4.orig/ChangeLog 2009-04-27 04:05:45.000000000 +0200 -+++ ratpoison-1.4.4/ChangeLog 2009-04-27 14:43:28.000000000 +0200 -@@ -1,3 +1,20 @@ -+2005-06-28 Bernhard R. Link <brlink@debian.org> -+ -+ * src/split.c: new functions enlarge_frame_{left,up,right,down} -+ to enlarge a frame in a given direction, optionally removing all -+ direct adjacent frames. -+ (remove_frame): moved code to new rotine maximaize_all_in_frame. -+ (find_frame_{left,up,right,down}): try harder to find a frame in -+ the specified direction. (So that it also works with parts of -+ the screen not beeing in any frame). -+ -+ * src/split.h: added prototypes for enlarge_frame_{left,up,right,down} -+ -+ * src/actions.{c,h}: Added cmd_remove{left,up,right,down} calling -+ enlarge_frame_*, added C-t M-{Left,Right,Up,Down} as keybindings. -+ -+ * doc/ratpoison.1: Document the new commands and keybindings. -+ - commit 18ee1ed3b3839d44e08e5aefd0e926d29d252654 - Author: Shawn Betts <sabetts@gmail.com> - Date: Fri Apr 24 15:28:27 2009 -0700 -Index: ratpoison-1.4.4/doc/ratpoison.1 -=================================================================== ---- ratpoison-1.4.4.orig/doc/ratpoison.1 2009-04-13 14:31:28.000000000 +0200 -+++ ratpoison-1.4.4/doc/ratpoison.1 2009-04-27 14:43:28.000000000 +0200 -@@ -511,6 +511,18 @@ - .cmd remove ( C\-t R ) - Remove the current frame and extend some frames around to fill the remaining - gap. -+.cmd removedown ( C\-t M\-Down ) -+Kill frames directly below the current frame, extending the current -+frame as much as possible. -+.cmd removeleft ( C\-t M\-Left ) -+Kill frames directly left of the current frame, extending the current -+frame as much as possible. -+.cmd removeup ( C\-t M\-Up ) -+Kill frames directly above the current frame, extending the current -+frame as much as possible. -+.cmd removeright ( C\-t M\-Right ) -+Kill frames directly right of the current frame, extending the current -+frame as much as possible. - .cmd resize [ deltax deltay ] ( C\-t r ) - If \fIdeltax\fP and \fIdeltay\fP are supplied, resize the current frame - by that (i.e. move the bottom right corner by the given offsets and then -Index: ratpoison-1.4.4/src/actions.c -=================================================================== ---- ratpoison-1.4.4.orig/src/actions.c 2009-04-13 14:49:08.000000000 +0200 -+++ ratpoison-1.4.4/src/actions.c 2009-04-27 14:43:28.000000000 +0200 -@@ -324,6 +324,10 @@ - "Hook: ", arg_HOOK, - "Command: ", arg_COMMAND); - add_command ("remove", cmd_remove, 0, 0, 0); -+ add_command ("removeup", cmd_removeup, 0, 0, 0); -+ add_command ("removedown", cmd_removedown, 0, 0, 0); -+ add_command ("removeleft", cmd_removeleft, 0, 0, 0); -+ add_command ("removeright", cmd_removeright, 0, 0, 0); - add_command ("resize", cmd_resize, 2, 0, 2, - "", arg_NUMBER, - "", arg_NUMBER); -@@ -785,6 +789,10 @@ - add_keybinding (XK_Down, 0, "focusdown", map); - add_keybinding (XK_Q, 0, "only", map); - add_keybinding (XK_R, 0, "remove", map); -+ add_keybinding (XK_Left, RP_META_MASK, "removeleft", map); -+ add_keybinding (XK_Right, RP_META_MASK, "removeright", map); -+ add_keybinding (XK_Up, RP_META_MASK, "removeup", map); -+ add_keybinding (XK_Down, RP_META_MASK, "removedown", map); - add_keybinding (XK_f, 0, "fselect", map); - add_keybinding (XK_f, RP_CONTROL_MASK, "fselect", map); - add_keybinding (XK_F, 0, "curframe", map); -@@ -2957,6 +2965,38 @@ - } - - cmdret * -+cmd_removeup (int interactive UNUSED, struct cmdarg **args UNUSED) -+{ -+ push_frame_undo (current_screen()); /* fdump to stack */ -+ enlarge_frame_up (current_frame(), 1); -+ return cmdret_new(RET_SUCCESS, NULL); -+} -+ -+cmdret * -+cmd_removedown (int interactive UNUSED, struct cmdarg **args UNUSED) -+{ -+ push_frame_undo (current_screen()); /* fdump to stack */ -+ enlarge_frame_down (current_frame(), 1); -+ return cmdret_new(RET_SUCCESS, NULL); -+} -+ -+cmdret * -+cmd_removeleft (int interactive UNUSED, struct cmdarg **args UNUSED) -+{ -+ push_frame_undo (current_screen()); /* fdump to stack */ -+ enlarge_frame_left (current_frame(), 1); -+ return cmdret_new(RET_SUCCESS, NULL); -+} -+ -+cmdret * -+cmd_removeright (int interactive UNUSED, struct cmdarg **args UNUSED) -+{ -+ push_frame_undo (current_screen()); /* fdump to stack */ -+ enlarge_frame_right (current_frame(), 1); -+ return cmdret_new(RET_SUCCESS, NULL); -+} -+ -+cmdret * - cmd_shrink (int interactive UNUSED, struct cmdarg **args UNUSED) - { - push_frame_undo (current_screen()); /* fdump to stack */ -Index: ratpoison-1.4.4/src/actions.h -=================================================================== ---- ratpoison-1.4.4.orig/src/actions.h 2009-04-13 14:02:34.000000000 +0200 -+++ ratpoison-1.4.4/src/actions.h 2009-04-27 14:43:28.000000000 +0200 -@@ -168,6 +168,10 @@ - RP_CMD (redisplay); - RP_CMD (remhook); - RP_CMD (remove); -+RP_CMD (removedown); -+RP_CMD (removeup); -+RP_CMD (removeleft); -+RP_CMD (removeright); - RP_CMD (rename); - RP_CMD (resize); - RP_CMD (restart); -Index: ratpoison-1.4.4/src/split.c -=================================================================== ---- ratpoison-1.4.4.orig/src/split.c 2009-04-13 03:52:16.000000000 +0200 -+++ ratpoison-1.4.4/src/split.c 2009-04-27 14:47:10.000000000 +0200 -@@ -701,6 +701,147 @@ - return 0; - } - -+ -+static void -+delete_frame (rp_frame *frame) -+{ -+ rp_screen *s; -+ rp_window *win; -+ -+ if (frame == NULL) return; -+ -+ s = frames_screen (frame); -+ -+ list_del (&frame->node); -+ win = find_window_number (frame->win_number); -+ hide_window (win); -+ hide_others (win); -+ -+ frame_free (s, frame); -+} -+ -+static void -+maximize_all_in_frame (rp_frame *frame) -+{ -+ rp_window *win; -+ -+ /* The current frame fits into the new space so keep its -+ new frame parameters and maximize the window to fit -+ the new frame size. */ -+ if (frame->win_number != EMPTY) -+ { -+ win = find_window_number (frame->win_number); -+ maximize_all_windows_in_frame (frame); -+ XRaiseWindow (dpy, win->w); -+ } -+} -+ -+void -+enlarge_frame_left (rp_frame *frame, int remove) -+{ -+ rp_screen *s = frames_screen (frame); -+ rp_frame *cur; -+ struct list_head *tmp, *iter; -+ -+ int new_x = screen_left(s); -+ -+ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node) -+ { -+ if (frame_top(frame) < frame_bottom(cur) -+ && frame_top(cur) < frame_bottom(frame)) -+ { -+ int cur_border = frame_right (cur); -+ -+ if (remove && cur_border == frame_left(frame)) -+ delete_frame(cur); -+ else if (cur_border <= frame_left(frame) && cur_border > new_x ) -+ new_x = cur_border; -+ } -+ } -+ frame->width += frame->x - new_x; -+ frame->x = new_x; -+ maximize_all_in_frame(frame); -+} -+ -+void -+enlarge_frame_right (rp_frame *frame, int remove) -+{ -+ rp_screen *s = frames_screen (frame); -+ rp_frame *cur; -+ struct list_head *tmp, *iter; -+ -+ int new_x = screen_right(s); -+ -+ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node) -+ { -+ if (frame_top(frame) < frame_bottom(cur) -+ && frame_top(cur) < frame_bottom(frame)) -+ { -+ int frame_border = frame_right(frame); -+ -+ if (remove && frame_border == frame_left(cur)) -+ delete_frame(cur); -+ else if (frame_border <= frame_left(cur) && frame_left(cur) < new_x ) -+ new_x = cur->x; -+ } -+ } -+ frame->width = new_x - frame->x; -+ maximize_all_in_frame(frame); -+} -+ -+void -+enlarge_frame_up (rp_frame *frame, int remove) -+{ -+ rp_screen *s = frames_screen (frame); -+ rp_frame *cur; -+ struct list_head *tmp, *iter; -+ -+ int new_y = screen_top(s); -+ -+ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node) -+ { -+ if (frame_left(frame) < frame_right(cur) -+ && frame_left(cur) < frame_right(frame)) -+ { -+ int cur_border = frame_bottom (cur); -+ -+ if (remove && cur_border == frame_top(frame)) -+ delete_frame(cur); -+ else if (cur_border <= frame_top(frame) && cur_border > new_y ) -+ new_y = cur_border; -+ } -+ } -+ frame->height += frame->y - new_y; -+ frame->y = new_y; -+ maximize_all_in_frame(frame); -+} -+ -+void -+enlarge_frame_down (rp_frame *frame, int remove) -+{ -+ rp_screen *s = frames_screen (frame); -+ rp_frame *cur; -+ struct list_head *tmp, *iter; -+ -+ int new_y = screen_bottom(s); -+ -+ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node) -+ { -+ if (frame_left(frame) < frame_right(cur) -+ && frame_left(cur) < frame_right(frame)) -+ { -+ int frame_border = frame_bottom(frame); -+ -+ if (remove && frame_border == frame_top(cur)) -+ delete_frame(cur); -+ else if (frame_border <= frame_top(cur) && frame_top(cur) < new_y ) -+ new_y = frame_top(cur); -+ } -+ } -+ frame->height = new_y - frame->y; -+ maximize_all_in_frame(frame); -+} -+ - void - remove_frame (rp_frame *frame) - { -@@ -798,17 +939,7 @@ - } - - if (fits) -- { -- /* The current frame fits into the new space so keep its -- new frame parameters and maximize the window to fit -- the new frame size. */ -- if (cur->win_number != EMPTY) -- { -- rp_window *new = find_window_number (cur->win_number); -- maximize_all_windows_in_frame (cur); -- XRaiseWindow (dpy, new->w); -- } -- } -+ maximize_all_in_frame(cur); - else - { - memcpy (cur, &tmp_frame, sizeof (rp_frame)); -@@ -1030,16 +1161,24 @@ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - -+ rp_frame *best_frame_yet = NULL; -+ int best_x_yet = frame->x + frame->width + 1; -+ - list_for_each_entry (cur, &s->frames, node) - { - if (frame->y == cur->y + cur->height) - { - if (frame->x >= cur->x && frame->x < cur->x + cur->width) - return cur; -+ if (cur->x >= frame->x && cur->x < best_x_yet ) -+ { -+ best_x_yet = cur->x; -+ best_frame_yet = cur; -+ } - } - } - -- return NULL; -+ return best_frame_yet; - } - - rp_frame * -@@ -1048,16 +1187,24 @@ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - -+ rp_frame *best_frame_yet = NULL; -+ int best_x_yet = frame->x + frame->width + 1; -+ - list_for_each_entry (cur, &s->frames, node) - { - if (frame->y + frame->height == cur->y) - { - if (frame->x >= cur->x && frame->x < cur->x + cur->width) - return cur; -+ if (cur->x >= frame->x && cur->x < best_x_yet ) -+ { -+ best_x_yet = cur->x; -+ best_frame_yet = cur; -+ } - } - } - -- return NULL; -+ return best_frame_yet; - } - - rp_frame * -@@ -1066,16 +1213,24 @@ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - -+ rp_frame *best_frame_yet = NULL; -+ int best_y_yet = frame->y + frame->height + 1; -+ - list_for_each_entry (cur, &s->frames, node) - { - if (frame->x == cur->x + cur->width) - { - if (frame->y >= cur->y && frame->y < cur->y + cur->height) - return cur; -+ if (cur->y >= frame->y && cur->y < best_y_yet ) -+ { -+ best_y_yet = cur->y; -+ best_frame_yet = cur; -+ } - } - } - -- return NULL; -+ return best_frame_yet; - } - - rp_frame * -@@ -1084,16 +1239,24 @@ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - -+ rp_frame *best_frame_yet = NULL; -+ int best_y_yet = frame->y + frame->height + 1; -+ - list_for_each_entry (cur, &s->frames, node) - { - if (frame->x + frame->width == cur->x) - { - if (frame->y >= cur->y && frame->y < cur->y + cur->height) - return cur; -+ if (cur->y >= frame->y && cur->y < best_y_yet ) -+ { -+ best_y_yet = cur->y; -+ best_frame_yet = cur; -+ } - } - } - -- return NULL; -+ return best_frame_yet; - } - - rp_frame * -Index: ratpoison-1.4.4/src/split.h -=================================================================== ---- ratpoison-1.4.4.orig/src/split.h 2009-04-13 03:52:16.000000000 +0200 -+++ ratpoison-1.4.4/src/split.h 2009-04-27 14:43:28.000000000 +0200 -@@ -33,6 +33,10 @@ - void resize_frame_horizontally (rp_frame *frame, int diff); - void resize_frame_vertically (rp_frame *frame, int diff); - void remove_frame (rp_frame *frame); -+void enlarge_frame_left (rp_frame *frame, int remove); -+void enlarge_frame_up (rp_frame *frame, int remove); -+void enlarge_frame_right (rp_frame *frame, int remove); -+void enlarge_frame_down (rp_frame *frame, int remove); - rp_window *find_window_for_frame (rp_frame *frame); - rp_frame *find_windows_frame (rp_window *win); - rp_frame *find_frame_next (rp_frame *frame); diff --git a/debian/patches/brl-menu.diff b/debian/patches/brl-menu.diff deleted file mode 100644 index 61998da..0000000 --- a/debian/patches/brl-menu.diff +++ /dev/null @@ -1,151 +0,0 @@ -Author: Bernhard R. Link <brlink@debian.org> -Subject: add --with-menu - -This patch adds an --with-menu that allows to specify a menu command -that will be available with :menu and with "C-t ." - -Index: ratpoison-1.4.4/ChangeLog -=================================================================== ---- ratpoison-1.4.4.orig/ChangeLog 2009-04-27 14:43:28.000000000 +0200 -+++ ratpoison-1.4.4/ChangeLog 2009-04-27 14:47:28.000000000 +0200 -@@ -1,3 +1,9 @@ -+2005-01-15 Bernhard R. Link <brlink@debian.org> -+ -+ * configure.in: add --with-menu to specify a menu program -+ * src/action.c: add menu alias and binding if menu specified -+ * src/main.c: tell menu command if menu specified -+ - 2005-06-28 Bernhard R. Link <brlink@debian.org> - - * src/split.c: new functions enlarge_frame_{left,up,right,down} -Index: ratpoison-1.4.4/src/main.c -=================================================================== ---- ratpoison-1.4.4.orig/src/main.c 2009-04-13 11:15:46.000000000 +0200 -+++ ratpoison-1.4.4/src/main.c 2009-04-27 14:47:28.000000000 +0200 -@@ -467,7 +467,13 @@ - { - rp_action *help_action; - char *prefix, *help; -+ const char *help_show; - rp_keymap *map; -+#ifdef MENU_PROG -+ rp_action *menu_action; -+ char *menu; -+ const char *menu_show; -+#endif - - prefix = keysym_to_string (prefix_key.sym, prefix_key.state); - -@@ -476,27 +482,44 @@ - /* Find the help key binding. */ - help_action = find_keybinding_by_action ("help " ROOT_KEYMAP, map); - if (help_action) -- help = keysym_to_string (help_action->key, help_action->state); -- else -- help = NULL; -- -- -- if (help) - { -+ help = keysym_to_string (help_action->key, help_action->state); - /* A little kludge to use ? instead of `question' for the help - key. */ - if (!strcmp (help, "question")) -- marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, "?"); -+ help_show = "?"; - else -- marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, help); -- -- free (help); -+ help_show = help; -+ } -+ else -+ { -+ help = NULL; -+ help_show = ":help"; -+ } -+#ifdef MENU_PROG -+ /* Find the menu key binding. */ -+ menu_action = find_keybinding_by_action ("menu", map); -+ if (menu_action) -+ { -+ menu = keysym_to_string (menu_action->key, menu_action->state); -+ if (!strcmp (menu, "period")) -+ menu_show = "."; -+ else -+ menu_show = menu; - } - else - { -- marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, ":help"); -+ menu = NULL; -+ menu_show = ":menu"; - } - -+ marked_message_printf (0, 0, MESSAGE_WELCOME_MENU, prefix, help_show, -+ prefix, menu_show); -+ free(menu); -+#else -+ marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, help_show); -+#endif -+ free(help); - free (prefix); - } - -Index: ratpoison-1.4.4/src/actions.c -=================================================================== ---- ratpoison-1.4.4.orig/src/actions.c 2009-04-27 14:43:28.000000000 +0200 -+++ ratpoison-1.4.4/src/actions.c 2009-04-27 14:47:28.000000000 +0200 -@@ -725,6 +725,9 @@ - add_keybinding (prefix_key.sym, prefix_key.state, "other", map); - add_keybinding (prefix_key.sym, 0, "meta", map); - add_keybinding (XK_g, RP_CONTROL_MASK, "abort", map); -+#ifdef MENU_PROG -+ add_keybinding (XK_period, 0, "menu", map); -+#endif - add_keybinding (XK_0, 0, "select 0", map); - add_keybinding (XK_1, 0, "select 1", map); - add_keybinding (XK_2, 0, "select 2", map); -@@ -811,6 +814,10 @@ - add_alias ("unbind", "undefinekey " ROOT_KEYMAP); - add_alias ("bind", "definekey " ROOT_KEYMAP); - add_alias ("split", "vsplit"); -+ -+#ifdef MENU_PROG -+ add_alias ("menu", "exec " MENU_PROG ); -+#endif - } - - cmdret * -Index: ratpoison-1.4.4/configure.in -=================================================================== ---- ratpoison-1.4.4.orig/configure.in 2009-04-27 03:55:10.000000000 +0200 -+++ ratpoison-1.4.4/configure.in 2009-04-27 14:47:28.000000000 +0200 -@@ -72,6 +72,15 @@ - AC_SUBST(XFT_CFLAGS) - AC_SUBST(XFT_LIBS) - -+AC_ARG_WITH(menu, [ --with-menu=PROG set a external menu program to be advertised ], -+menu_prog="$withval", menu_prog="") -+ -+if test "$menu_prog" != "no" && ! test -z "$menu_prog" ; then -+AC_DEFINE_UNQUOTED(MENU_PROG, "$menu_prog", external menu program to advertise) -+AC_MSG_CHECKING(external menu program) -+AC_MSG_RESULT($menu_prog) -+fi -+ - dnl Checks for programs. - AC_CHECK_TOOL(CC, gcc) - AC_PROG_CC -Index: ratpoison-1.4.4/src/messages.h -=================================================================== ---- ratpoison-1.4.4.orig/src/messages.h 2009-04-13 03:52:16.000000000 +0200 -+++ ratpoison-1.4.4/src/messages.h 2009-04-27 14:47:28.000000000 +0200 -@@ -50,6 +50,7 @@ - #define MESSAGE_PROMPT_VAR_VALUE "Value: " - - #define MESSAGE_WELCOME "Welcome to ratpoison! Hit `%s %s' for help." -+#define MESSAGE_WELCOME_MENU "Welcome to ratpoison! Hit `%s %s' for help. `%s %s' for menu." - - #define EMPTY_FRAME_MESSAGE "Current Frame" - diff --git a/debian/patches/brl-menu.reconf b/debian/patches/brl-menu.reconf deleted file mode 100644 index a929add..0000000 --- a/debian/patches/brl-menu.reconf +++ /dev/null @@ -1,54 +0,0 @@ -Author: Bernhard R. Link <brlink@debian.org> -Subject: change the autogenerated files the brl-menu.diff would change - -Index: ratpoison-1.4.4/configure -=================================================================== ---- ratpoison-1.4.4.orig/configure 2009-04-27 14:48:49.000000000 +0200 -+++ ratpoison-1.4.4/configure 2009-04-27 15:16:28.000000000 +0200 -@@ -1308,6 +1308,7 @@ - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-xterm=PROG set the x terminal emulator used by ratpoison -+ --with-menu=PROG set a external menu program to be advertised - --without-xft Don't use the Xft library even if available - --with-x use the X Window System - -@@ -2530,7 +2531,24 @@ - echo "${ECHO_T}no" >&6; } - fi - -+# Check whether --with-menu was given. -+if test "${with_menu+set}" = set; then -+ withval=$with_menu; menu_prog="$withval" -+else -+ menu_prog="" -+fi - -+if test "$menu_prog" != "no" && ! test -z "$menu_prog" ; then -+ -+cat >>confdefs.h <<_ACEOF -+#define MENU_PROG "$menu_prog" -+_ACEOF -+ -+{ echo "$as_me:$LINENO: checking external menu program" >&5 -+echo $ECHO_N "checking external menu program... $ECHO_C" >&6; } -+{ echo "$as_me:$LINENO: result: $menu_prog" >&5 -+echo "${ECHO_T}$menu_prog" >&6; } -+fi - - 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. -Index: ratpoison-1.4.4/src/config.h.in -=================================================================== ---- ratpoison-1.4.4.orig/src/config.h.in 2009-04-27 15:13:46.000000000 +0200 -+++ ratpoison-1.4.4/src/config.h.in 2009-04-27 15:14:01.000000000 +0200 -@@ -75,6 +75,9 @@ - /* Define to 1 if you have the <X11/extensions/Xinerama.h> header file. */ - #undef HAVE_X11_EXTENSIONS_XINERAMA_H - -+/* external menu program to advertise */ -+#undef MENU_PROG -+ - /* Name of package */ - #undef PACKAGE - diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 964105e..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,4 +0,0 @@ -brl-enlarge.diff -brl-menu.diff -brl-menu.reconf -530176.diff diff --git a/debian/postinst b/debian/postinst deleted file mode 100644 index 6a1d7ee..0000000 --- a/debian/postinst +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -# postinst script for ratpoison - -set -e - -case "$1" in - configure|abort-remove|abort-deconfigure) -# 20 to start with, -## when depending again on 9menu: -## plus 20 as we have menu support configured -## plus 10 as it can restart other wm's with :newwm or menu - update-alternatives --install /usr/bin/x-window-manager \ - x-window-manager /usr/bin/ratpoison 20 \ - --slave /usr/share/man/man1/x-window-manager.1.gz \ - x-window-manager.1.gz /usr/share/man/man1/ratpoison.1.gz - ;; - - abort-upgrade) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# taken from dh_pysupport -if [ "$1" = "configure" ] && which update-python-modules >/dev/null 2>&1; then - update-python-modules -i /usr/share/python-support/ratpoison -fi - -#DEBHELPER# - -exit 0 - - diff --git a/debian/prerm b/debian/prerm deleted file mode 100644 index 89b4c83..0000000 --- a/debian/prerm +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh -# prerm script for ratpoison - -set -e - -case "$1" in - remove|deconfigure) - update-alternatives --remove x-window-manager /usr/bin/ratpoison - if [ -d /var/lib/ratpoison/menu ] ; then - rm /var/lib/ratpoison/menu/*.menu || true - fi - ;; - upgrade|failed-upgrade) - ;; - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# taken from dh_pysupport: -if which update-python-modules >/dev/null 2>&1; then - update-python-modules -c -i /usr/share/python-support/ratpoison -fi - -#DEBHELPER# - -exit 0 diff --git a/debian/ratpoison.doc-base b/debian/ratpoison.doc-base deleted file mode 100644 index 81d12d1..0000000 --- a/debian/ratpoison.doc-base +++ /dev/null @@ -1,9 +0,0 @@ -Document: ratpoison -Title: Debian ratpoison Manual -Author: Shawn Betts <sabetts@users.sourceforge.net> -Abstract: This manual describes the ratpoison window manager -Section: Window Managers - -Format: info -Index: /usr/share/info/ratpoison.info.gz -Files: /usr/share/info/ratpoison.info.gz diff --git a/debian/ratpoison.install b/debian/ratpoison.install deleted file mode 100644 index c6bab11..0000000 --- a/debian/ratpoison.install +++ /dev/null @@ -1,4 +0,0 @@ -contrib/Ratpoison.pm /usr/share/perl5/ -contrib/ratpoison.rb /usr/lib/ruby/1.8/ -contrib/ratpoison.py /usr/share/python-support/ratpoison/ -contrib/ratpoison-cmd.el /usr/share/emacs/site-lisp/ratpoison/ diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 2c166bd..0000000 --- a/debian/rules +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/make -f - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - -CFLAGS = -Wall -g -ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 - CONFIG_OPTIONS = -else - CFLAGS += -O2 -ifneq (,$(filter ratpoison:gendeps,$(DEB_BUILD_OPTIONS))) - CONFIG_OPTIONS = -else - CONFIG_OPTIONS = --disable-dependency-tracking -endif -endif -ifneq (,$(filter ratpoison:noxft,$(DEB_BUILD_OPTIONS))) - CONFIG_OPTIONS += --without-xft -else - CONFIG_OPTIONS += --with-xft -endif -ifneq (,$(filter ratpoison:readline,$(DEB_BUILD_OPTIONS))) - CONFIG_OPTIONS += --enable-history -else - CONFIG_OPTIONS += --disable-history -endif - -ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) - MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) -endif - -config.status: configure - dh_testdir - ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ - --prefix=/usr \ - --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \ - --with-xterm=x-terminal-emulator \ - --with-menu="/etc/X11/ratpoison/ratpoisonmenu debian.menu" \ - $(CONFIG_OPTIONS) \ - --x-includes="" --x-libraries="" \ - CFLAGS="$(CFLAGS)" CPPFLAGS="" LDFLAGS="-Wl,-z,syms" - # libXext is not needed for dynamic linking: - sed -i -e '/^X_LIBS =/s/-lXext //' src/Makefile -# do not delete config.status if above rule failed, -# as that might hide other left over files that need cleaning -.PRECIOUS: config.status - -build-arch: build-arch-stamp -build-arch-stamp: config.status - dh_testdir - - $(MAKE) - # bindings for the different languages - cd contrib && ./genrpbindings - # manpage for rpws - pod2man contrib/rpws rpws.1 - touch build-arch-stamp - -build-indep: build-indep-stamp -build-indep-stamp: - touch build-indep-stamp -build: build-arch build-indep - -clean: - dh_testdir - dh_testroot - rm -f build-arch-stamp build-indep-stamp - - if [ -e config.status ] ; then $(MAKE) distclean ; fi - ! test -f config.log - -rm -f contrib/Ratpoison.pm contrib/ratpoison-cmd.el contrib/ratpoison.lisp contrib/ratpoison.py contrib/ratpoison.rb - -rm -f rpws.1 - -rm -f config.sub config.guess - dh_clean - -# Build architecture-independent files -binary-indep: build-indep-stamp -# We have nothing to do - -# Build architecture-dependent files -binary-arch: build-arch-stamp - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - $(MAKE) install pkgdatadir=/usr/share/doc/ratpoison/examples DESTDIR=$(CURDIR)/debian/ratpoison - # since Debian uses gnu install-info, this seems to need manual removing... - find debian/ratpoison -name "dir" -print -delete - # Those are installed to different places already by dh_* - rm debian/ratpoison/usr/share/doc/ratpoison/COPYING - rm debian/ratpoison/usr/share/doc/ratpoison/ChangeLog - # not needed two times: - rm debian/ratpoison/usr/share/doc/ratpoison/examples/rpws - # The menu command: - install -D -m 0755 debian/callmenu.sh debian/ratpoison/etc/X11/ratpoison/ratpoisonmenu - dh_install - dh_installchangelogs ChangeLog - dh_installdocs - dh_installexamples - dh_installemacsen - dh_installmenu - dh_installinfo doc/ratpoison.info - dh_installman rpws.1 - dh_link - dh_strip - dh_compress - find debian/ratpoison -name "dir.gz" -print -delete - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -RATPOISON_VERSION=1.4.5 - -# some helpers for me -# just ignore those if you want to do a NMU or a security upload, change the files outside -# of debian/patches and do an upload. The patches are only stored there for reference and -# so I do not loose them. -maintainer-clean: - quilt refresh - quilt push -a || true - rm -f .pc patches - mv debian/patches/series debian/patches/_series - -maintainer-unclean: - mv debian/patches/_series debian/patches/series - ln -s "../pc-ratpoison-$(RATPOISON_VERSION)" .pc - ln -s debian/patches patches - quilt push -a - -binary: binary-indep binary-arch -.PHONY: build-arch build-indep build clean binary-indep binary-arch binary maintainer-clean maintainer-unclean diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/watch b/debian/watch deleted file mode 100644 index 0b40dd7..0000000 --- a/debian/watch +++ /dev/null @@ -1,3 +0,0 @@ -# See uscan(1) for format -version=2 -http://savannah.nongnu.org/download/ratpoison/ratpoison-([0-9.]*)\.tar\.gz diff --git a/doc/.gitignore b/doc/.gitignore deleted file mode 100644 index 96a20f1..0000000 --- a/doc/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -texinfo.tex -ratpoison.info -ratpoison.html/ diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index e653893..0000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> -# -# This file is part of ratpoison. -# -# ratpoison 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. -# -# ratpoison 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 -# - -info_TEXINFOS = ratpoison.texi -man_MANS = ratpoison.1 -EXTRA_DIST = $(man_MANS) sample.ratpoisonrc ipaq.ratpoisonrc fdl.texi -MAINTAINERCLEANFILES = Makefile.in texinfo.tex diff --git a/doc/fdl.texi b/doc/fdl.texi deleted file mode 100644 index 6c91624..0000000 --- a/doc/fdl.texi +++ /dev/null @@ -1,450 +0,0 @@ -@c The GNU Free Documentation License. -@center Version 1.2, November 2002 - -@c This file is intended to be included within another document, -@c hence no sectioning command or @node. - -@display -Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. -51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@enumerate 0 -@item -PREAMBLE - -The purpose of this License is to make a manual, textbook, or other -functional and useful document @dfn{free} in the sense of freedom: to -assure everyone the effective freedom to copy and redistribute it, -with or without modifying it, either commercially or noncommercially. -Secondarily, this License preserves for the author and publisher a way -to get credit for their work, while not being considered responsible -for modifications made by others. - -This License is a kind of ``copyleft'', which means that derivative -works of the document must themselves be free in the same sense. It -complements the GNU General Public License, which is a copyleft -license designed for free software. - -We have designed this License in order to use it for manuals for free -software, because free software needs free documentation: a free -program should come with manuals providing the same freedoms that the -software does. But this License is not limited to software manuals; -it can be used for any textual work, regardless of subject matter or -whether it is published as a printed book. We recommend this License -principally for works whose purpose is instruction or reference. - -@item -APPLICABILITY AND DEFINITIONS - -This License applies to any manual or other work, in any medium, that -contains a notice placed by the copyright holder saying it can be -distributed under the terms of this License. Such a notice grants a -world-wide, royalty-free license, unlimited in duration, to use that -work under the conditions stated herein. The ``Document'', below, -refers to any such manual or work. Any member of the public is a -licensee, and is addressed as ``you''. You accept the license if you -copy, modify or distribute the work in a way requiring permission -under copyright law. - -A ``Modified Version'' of the Document means any work containing the -Document or a portion of it, either copied verbatim, or with -modifications and/or translated into another language. - -A ``Secondary Section'' is a named appendix or a front-matter section -of the Document that deals exclusively with the relationship of the -publishers or authors of the Document to the Document's overall -subject (or to related matters) and contains nothing that could fall -directly within that overall subject. (Thus, if the Document is in -part a textbook of mathematics, a Secondary Section may not explain -any mathematics.) The relationship could be a matter of historical -connection with the subject or with related matters, or of legal, -commercial, philosophical, ethical or political position regarding -them. - -The ``Invariant Sections'' are certain Secondary Sections whose titles -are designated, as being those of Invariant Sections, in the notice -that says that the Document is released under this License. If a -section does not fit the above definition of Secondary then it is not -allowed to be designated as Invariant. The Document may contain zero -Invariant Sections. If the Document does not identify any Invariant -Sections then there are none. - -The ``Cover Texts'' are certain short passages of text that are listed, -as Front-Cover Texts or Back-Cover Texts, in the notice that says that -the Document is released under this License. A Front-Cover Text may -be at most 5 words, and a Back-Cover Text may be at most 25 words. - -A ``Transparent'' copy of the Document means a machine-readable copy, -represented in a format whose specification is available to the -general public, that is suitable for revising the document -straightforwardly with generic text editors or (for images composed of -pixels) generic paint programs or (for drawings) some widely available -drawing editor, and that is suitable for input to text formatters or -for automatic translation to a variety of formats suitable for input -to text formatters. A copy made in an otherwise Transparent file -format whose markup, or absence of markup, has been arranged to thwart -or discourage subsequent modification by readers is not Transparent. -An image format is not Transparent if used for any substantial amount -of text. A copy that is not ``Transparent'' is called ``Opaque''. - -Examples of suitable formats for Transparent copies include plain -@sc{ascii} without markup, Texinfo input format, La@TeX{} input -format, @acronym{SGML} or @acronym{XML} using a publicly available -@acronym{DTD}, and standard-conforming simple @acronym{HTML}, -PostScript or @acronym{PDF} designed for human modification. Examples -of transparent image formats include @acronym{PNG}, @acronym{XCF} and -@acronym{JPG}. Opaque formats include proprietary formats that can be -read and edited only by proprietary word processors, @acronym{SGML} or -@acronym{XML} for which the @acronym{DTD} and/or processing tools are -not generally available, and the machine-generated @acronym{HTML}, -PostScript or @acronym{PDF} produced by some word processors for -output purposes only. - -The ``Title Page'' means, for a printed book, the title page itself, -plus such following pages as are needed to hold, legibly, the material -this License requires to appear in the title page. For works in -formats which do not have any title page as such, ``Title Page'' means -the text near the most prominent appearance of the work's title, -preceding the beginning of the body of the text. - -A section ``Entitled XYZ'' means a named subunit of the Document whose -title either is precisely XYZ or contains XYZ in parentheses following -text that translates XYZ in another language. (Here XYZ stands for a -specific section name mentioned below, such as ``Acknowledgements'', -``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' -of such a section when you modify the Document means that it remains a -section ``Entitled XYZ'' according to this definition. - -The Document may include Warranty Disclaimers next to the notice which -states that this License applies to the Document. These Warranty -Disclaimers are considered to be included by reference in this -License, but only as regards disclaiming warranties: any other -implication that these Warranty Disclaimers may have is void and has -no effect on the meaning of this License. - -@item -VERBATIM COPYING - -You may copy and distribute the Document in any medium, either -commercially or noncommercially, provided that this License, the -copyright notices, and the license notice saying this License applies -to the Document are reproduced in all copies, and that you add no other -conditions whatsoever to those of this License. You may not use -technical measures to obstruct or control the reading or further -copying of the copies you make or distribute. However, you may accept -compensation in exchange for copies. If you distribute a large enough -number of copies you must also follow the conditions in section 3. - -You may also lend copies, under the same conditions stated above, and -you may publicly display copies. - -@item -COPYING IN QUANTITY - -If you publish printed copies (or copies in media that commonly have -printed covers) of the Document, numbering more than 100, and the -Document's license notice requires Cover Texts, you must enclose the -copies in covers that carry, clearly and legibly, all these Cover -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -the back cover. Both covers must also clearly and legibly identify -you as the publisher of these copies. The front cover must present -the full title with all words of the title equally prominent and -visible. You may add other material on the covers in addition. -Copying with changes limited to the covers, as long as they preserve -the title of the Document and satisfy these conditions, can be treated -as verbatim copying in other respects. - -If the required texts for either cover are too voluminous to fit -legibly, you should put the first ones listed (as many as fit -reasonably) on the actual cover, and continue the rest onto adjacent -pages. - -If you publish or distribute Opaque copies of the Document numbering -more than 100, you must either include a machine-readable Transparent -copy along with each Opaque copy, or state in or with each Opaque copy -a computer-network location from which the general network-using -public has access to download using public-standard network protocols -a complete Transparent copy of the Document, free of added material. -If you use the latter option, you must take reasonably prudent steps, -when you begin distribution of Opaque copies in quantity, to ensure -that this Transparent copy will remain thus accessible at the stated -location until at least one year after the last time you distribute an -Opaque copy (directly or through your agents or retailers) of that -edition to the public. - -It is requested, but not required, that you contact the authors of the -Document well before redistributing any large number of copies, to give -them a chance to provide you with an updated version of the Document. - -@item -MODIFICATIONS - -You may copy and distribute a Modified Version of the Document under -the conditions of sections 2 and 3 above, provided that you release -the Modified Version under precisely this License, with the Modified -Version filling the role of the Document, thus licensing distribution -and modification of the Modified Version to whoever possesses a copy -of it. In addition, you must do these things in the Modified Version: - -@enumerate A -@item -Use in the Title Page (and on the covers, if any) a title distinct -from that of the Document, and from those of previous versions -(which should, if there were any, be listed in the History section -of the Document). You may use the same title as a previous version -if the original publisher of that version gives permission. - -@item -List on the Title Page, as authors, one or more persons or entities -responsible for authorship of the modifications in the Modified -Version, together with at least five of the principal authors of the -Document (all of its principal authors, if it has fewer than five), -unless they release you from this requirement. - -@item -State on the Title page the name of the publisher of the -Modified Version, as the publisher. - -@item -Preserve all the copyright notices of the Document. - -@item -Add an appropriate copyright notice for your modifications -adjacent to the other copyright notices. - -@item -Include, immediately after the copyright notices, a license notice -giving the public permission to use the Modified Version under the -terms of this License, in the form shown in the Addendum below. - -@item -Preserve in that license notice the full lists of Invariant Sections -and required Cover Texts given in the Document's license notice. - -@item -Include an unaltered copy of this License. - -@item -Preserve the section Entitled ``History'', Preserve its Title, and add -to it an item stating at least the title, year, new authors, and -publisher of the Modified Version as given on the Title Page. If -there is no section Entitled ``History'' in the Document, create one -stating the title, year, authors, and publisher of the Document as -given on its Title Page, then add an item describing the Modified -Version as stated in the previous sentence. - -@item -Preserve the network location, if any, given in the Document for -public access to a Transparent copy of the Document, and likewise -the network locations given in the Document for previous versions -it was based on. These may be placed in the ``History'' section. -You may omit a network location for a work that was published at -least four years before the Document itself, or if the original -publisher of the version it refers to gives permission. - -@item -For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve -the Title of the section, and preserve in the section all the -substance and tone of each of the contributor acknowledgements and/or -dedications given therein. - -@item -Preserve all the Invariant Sections of the Document, -unaltered in their text and in their titles. Section numbers -or the equivalent are not considered part of the section titles. - -@item -Delete any section Entitled ``Endorsements''. Such a section -may not be included in the Modified Version. - -@item -Do not retitle any existing section to be Entitled ``Endorsements'' or -to conflict in title with any Invariant Section. - -@item -Preserve any Warranty Disclaimers. -@end enumerate - -If the Modified Version includes new front-matter sections or -appendices that qualify as Secondary Sections and contain no material -copied from the Document, you may at your option designate some or all -of these sections as invariant. To do this, add their titles to the -list of Invariant Sections in the Modified Version's license notice. -These titles must be distinct from any other section titles. - -You may add a section Entitled ``Endorsements'', provided it contains -nothing but endorsements of your Modified Version by various -parties---for example, statements of peer review or that the text has -been approved by an organization as the authoritative definition of a -standard. - -You may add a passage of up to five words as a Front-Cover Text, and a -passage of up to 25 words as a Back-Cover Text, to the end of the list -of Cover Texts in the Modified Version. Only one passage of -Front-Cover Text and one of Back-Cover Text may be added by (or -through arrangements made by) any one entity. If the Document already -includes a cover text for the same cover, previously added by you or -by arrangement made by the same entity you are acting on behalf of, -you may not add another; but you may replace the old one, on explicit -permission from the previous publisher that added the old one. - -The author(s) and publisher(s) of the Document do not by this License -give permission to use their names for publicity for or to assert or -imply endorsement of any Modified Version. - -@item -COMBINING DOCUMENTS - -You may combine the Document with other documents released under this -License, under the terms defined in section 4 above for modified -versions, provided that you include in the combination all of the -Invariant Sections of all of the original documents, unmodified, and -list them all as Invariant Sections of your combined work in its -license notice, and that you preserve all their Warranty Disclaimers. - -The combined work need only contain one copy of this License, and -multiple identical Invariant Sections may be replaced with a single -copy. If there are multiple Invariant Sections with the same name but -different contents, make the title of each such section unique by -adding at the end of it, in parentheses, the name of the original -author or publisher of that section if known, or else a unique number. -Make the same adjustment to the section titles in the list of -Invariant Sections in the license notice of the combined work. - -In the combination, you must combine any sections Entitled ``History'' -in the various original documents, forming one section Entitled -``History''; likewise combine any sections Entitled ``Acknowledgements'', -and any sections Entitled ``Dedications''. You must delete all -sections Entitled ``Endorsements.'' - -@item -COLLECTIONS OF DOCUMENTS - -You may make a collection consisting of the Document and other documents -released under this License, and replace the individual copies of this -License in the various documents with a single copy that is included in -the collection, provided that you follow the rules of this License for -verbatim copying of each of the documents in all other respects. - -You may extract a single document from such a collection, and distribute -it individually under this License, provided you insert a copy of this -License into the extracted document, and follow this License in all -other respects regarding verbatim copying of that document. - -@item -AGGREGATION WITH INDEPENDENT WORKS - -A compilation of the Document or its derivatives with other separate -and independent documents or works, in or on a volume of a storage or -distribution medium, is called an ``aggregate'' if the copyright -resulting from the compilation is not used to limit the legal rights -of the compilation's users beyond what the individual works permit. -When the Document is included in an aggregate, this License does not -apply to the other works in the aggregate which are not themselves -derivative works of the Document. - -If the Cover Text requirement of section 3 is applicable to these -copies of the Document, then if the Document is less than one half of -the entire aggregate, the Document's Cover Texts may be placed on -covers that bracket the Document within the aggregate, or the -electronic equivalent of covers if the Document is in electronic form. -Otherwise they must appear on printed covers that bracket the whole -aggregate. - -@item -TRANSLATION - -Translation is considered a kind of modification, so you may -distribute translations of the Document under the terms of section 4. -Replacing Invariant Sections with translations requires special -permission from their copyright holders, but you may include -translations of some or all Invariant Sections in addition to the -original versions of these Invariant Sections. You may include a -translation of this License, and all the license notices in the -Document, and any Warranty Disclaimers, provided that you also include -the original English version of this License and the original versions -of those notices and disclaimers. In case of a disagreement between -the translation and the original version of this License or a notice -or disclaimer, the original version will prevail. - -If a section in the Document is Entitled ``Acknowledgements'', -``Dedications'', or ``History'', the requirement (section 4) to Preserve -its Title (section 1) will typically require changing the actual -title. - -@item -TERMINATION - -You may not copy, modify, sublicense, or distribute the Document except -as expressly provided for under this License. Any other attempt to -copy, modify, sublicense or distribute the Document 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. - -@item -FUTURE REVISIONS OF THIS LICENSE - -The Free Software Foundation may publish new, revised versions -of the GNU Free Documentation 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. See -@uref{http://www.gnu.org/copyleft/}. - -Each version of the License is given a distinguishing version number. -If the Document specifies that a particular numbered version of this -License ``or any later version'' applies to it, you have the option of -following the terms and conditions either of that specified version or -of any later version that has been published (not as a draft) by the -Free Software Foundation. If the Document does not specify a version -number of this License, you may choose any version ever published (not -as a draft) by the Free Software Foundation. -@end enumerate - -@page -@heading ADDENDUM: How to use this License for your documents - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and -license notices just after the title page: - -@smallexample -@group - Copyright (C) @var{year} @var{your name}. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. -@end group -@end smallexample - -If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with@dots{}Texts.'' line with this: - -@smallexample -@group - with the Invariant Sections being @var{list their titles}, with - the Front-Cover Texts being @var{list}, and with the Back-Cover Texts - being @var{list}. -@end group -@end smallexample - -If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - -If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, -to permit their use in free software. - -@c Local Variables: -@c ispell-local-pdict: "ispell-dict" -@c End: diff --git a/doc/ipaq.ratpoisonrc b/doc/ipaq.ratpoisonrc deleted file mode 100644 index 5f6fd77..0000000 --- a/doc/ipaq.ratpoisonrc +++ /dev/null @@ -1,25 +0,0 @@ -# .ratpoisonrc for an iPaq36xx handheld pc running Linux -# Copyright (C) 2003, 2004 Ryan Yeske -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright - - -# make the "audio record" button the escape key: -escape XF86AudioRecord - -# the "speaker" buttons -bind Up exec rxvt -bind Down windows -bind Left prev -bind Right next -bind KP_Enter echo - -# the power button should be reserved? -bind XF86PowerDown exec (sleep 1; echo > /proc/sys/pm/suspend ) - -## the four buttons under the screen: -bind XF86Calendar exec xcalc -bind telephone exec contacts -bind Menu echo -bind XF86Start clock diff --git a/doc/ratpoison.1 b/doc/ratpoison.1 deleted file mode 100644 index 3ab0a92..0000000 --- a/doc/ratpoison.1 +++ /dev/null @@ -1,839 +0,0 @@ -.TH RATPOISON 1 2008-06-15 -\# This man page 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, or (at your option) -\# any later version. -\# -\# This man page 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 software; see the file COPYING. If not, write to -\# the Free Software Foundation, Inc., 59 Temple Place, Suite 330, -\# Boston, MA 02111-1307 USA -.de command -. ds command@tmp \fB\\$1\fP -. nr command@space 1 -. shift -. while \\n[.$] \{\ -. ie '\\$1'[' \{\ -. if ( \\n[command@space] == 1 ) .as command@tmp \& \& -. as command@tmp [ -. nr command@space 0 -. \} -. el .ie '\\$1']' \{\ -. as command@tmp ] -. nr command@space 1 -. \} -. el .ie '\\$1'|' \{\ -. as command@tmp | -. nr command@space 0 -. \} -. el .ie '\\$1'(' \{\ -. as command@tmp \& (\fB -. nr command@space 0 -. shift -. while !'\\$1')' \{\ -. ie '\\$1'|' .as command@tmp \fP|\fB\h'-1' -. el \{\ -. if ( \\n[command@space] == 1 ) .as command@tmp \& \& -. as command@tmp \\$1 -. nr command@space 1 -. \} -. shift -. \} -. shift -. as command@tmp \fP) -. nr command@space 0 -. \} -. el \{\ -. if ( \\n[command@space] == 1 ) .as command@tmp \& \& -. as command@tmp \fI\\$1\fR -. nr command@space 1 -. \} -. shift -. \} -\&\\*[command@tmp] -.. -.de cmd -.TP -.command \\$@ -.br -.. -.de var -.TP -.command \\$@ -.br -.. -.SH NAME -ratpoison \- window manager without mouse dependency -.P -.SH SYNOPSIS -.B ratpoison \-\-help -| -.B \-\-version -.br -.B ratpoison -.RB [ \-d -.IR dpy ] -.RB [ \-s -.IR num ] -.RB [ \-f -.IR file ] -.br -.B ratpoison -.RB [ \-d -.IR dpy ] -.RB [ \-s -.IR num ] -.RB [ \-i ] -.B \-c -.IR command -.RB [ \-c -.I command -\&... ] -.SH DESCRIPTION -Ratpoison is a Window Manager without fat library -dependencies, fancy graphics or rat dependence. - -The screen can be split into non-overlapping frames. All -windows are kept maximized inside their frames. - -All interaction with the window manager is done through -keystrokes. ratpoison has a prefix map to minimize -key clobbering. -.SH OPTIONS -.TP -.B \-h, \-\-help -Show summary of options. -.TP -.B \-v, \-\-version -Show version of program. -.TP -.B \-d, \-\-display \fIdisplay\fP -Set the X display to use or send commands to. -.TP -.B \-s, \-\-screen \fInumber\fP -Only use the specified screen. -.TP -.B \-f, \-\-file \fIfilename\fP -Specify an alternate configuration file. -If this is not given, ratpoison will try -.B $HOME/.ratpoisonrc -and if that does not exist -.B /etc/ratpoisonrc -and execute each command when starting up. -.TP -.B \-i, \-\-interactive -Execute commands given with -.B \-c -or -.B \-\-command -in interactive mode. -That means it will behave exactly as if called with -.B C\-t : -like prompting for missing arguments and things like that. -.TP -.B \-c, \-\-command -Send ratpoison a command. -There must be a ratpoison instance -running as window manager for the given display/screen for -this to work. -Do not forget to quote the command if it contains -spaces. -For example: -.br -\fBratpoison \-c "echo hello world"\fP -.SH KEY BINDINGS -To avoid conflicts with other programs, all default ratpoison -key bindings start with an escape key, per default -.B C\-t -(read Control\-t). -Some important default key bindings: -.PP -.B C\-t ?\& -Show key bindings -.br -.B C\-t c -Start an X terminal -.br -.B C\-t n -Switch to next window -.br -.B C\-t p -Switch to previous window -.br -.B C\-t 1\fP|\fB2\fP|\fB3\fP|\fB4\fP|\fB5\fP|\fB6\fP|\fB7\fP|\fB8\fP|\fB9 -Switch to window number 1|2|... -.br -.B C\-t k -Close the current window -.br -.B C\-t K -XKill the current application -.br -.B C\-t s\fP|\fBS -Split the current frame into two vertical|horizontal ones -.br -.B C\-t Tab\fP|\fBLeft\fP|\fBUp\fP|\fBRight\fP|\fBDown -Switch to the next|left|top|right|bottom frame. -.br -.B C\-t Q -Make the current frame the only one -.br -.B C\-t : -Execute a ratpoison command -.PP -Further default key bindings can be found in parentheses -after the commands in the next section: -.SH COMMANDS AND DEFAULT ALIASES -.cmd abort ( C\-t C\-g ) -Do nothing and that successfully. -(Useful if you pressed -\fBC\-t\fP in error). -.cmd addhook event command -Add a hook: Run command \fIcommand\fP whenever \fIevent\fP -is called. -Possible events are: -.ta 10 -.br -\fBdeletewindow\fP Run after a window is withdrawn. -.br -\fBnewwindow\fP Run after a new window is mapped. -.br -\fBkey\fP Run whenever a top level key is pressed. -(by default \fBC\-t\fP) -.br -\fBquit\fP Run before exiting ratpoison. -.br -\fBrestart\fP Run before restarting ratpoison. -.br -\fBswitchframe\fP Run after a frame actually switched, -but before the window in it is focused. -.br -\fBswitchgroup\fP Run after selecting a new group. -.br -\fBswitchwin\fP Run after a new window is selected. -(With dedication, -it may already be inactive again, if it was put into another frame) -.cmd alias alias command -Add \fIalias\fP as new way to call \fIcommand\fP. -.cmd bind key command -alias for "\fBdefinekey root\fP \fIkey\fP \fIcommand\fP" -.cmd banish ( C\-t b ) -Banish the rat cursor to the lower right corner of the screen. -.cmd banishrel -Banish the rat cursor to the lower right corner of the current window. -If there isn't a window in the current frame, it banishes the rat cursor -to the lower right corner of the frame. -.cmd chdir [ directory ] -If the optional argument is given, change the current directory -of ratpoison to \fIdirectory\fP. -If nothing is given, change -it to the value of the environment variable "HOME". -.cmd clrunmanaged -Clears the unmanaged window list. -.cmd cnext -Like \fBnext\fP but switch to the next window with another -resource class than the current one. -(That means the next window belonging to another type of application - than the current one.) -.cmd cprev -Like \fBprev\fP but switch to the previous window with another -resource class than the current one. -(That means the previous window belonging to another type of application - than the current one.) -.cmd colon ratpoison\-command ( C\-t : ) -Execute \fIratpoison\-command\fP interactively. (i.e. ask for possible -missing arguments.) -.cmd compat -Add aliases for the new \fBset\fP commands starting with \fBdef\fP to support older -scripts. -.cmd cother -Like \fBother\fP but switch to the window of the current group that was last -accessed and has another resource class but is not currently visible. -.cmd curframe ( C\-t F ) -Show a bar marking the current frame. -.cmd definekey keymap key command -Add a new key binding in \fIkeymap\fP for \fIkey\fP to execute \fIcommand\fP. -Default keymaps are \fBtop\fP normally only containing \fBC\-t\fP, which -reads a key from \fBroot\fP, containing all the normal commands. - -Note that you have to describe ":" by "colon", "!" by "exclam" and so on. -If you cannot guess a name of a key, try either \fBC\-t\fP \fIkey\fP -and look at the error message, or try \fB:describekey root\fP and pressing -the key. -.cmd def... -When \fBcompat\fP was called there are some aliases starting with \fIdef\fP, which -alias the new form with \fBset\fP. I.e. instead of \fB defresizeunit\fP -better use the new \fBset resizeunit\fP and so on... -.cmd dedicate [ \fB0 | \fB1\fP ] -Consider the current frame dedicated/chaste (\fB1\fP) or promiscuous (\fB0\fP). -.br -A dedicated frame will not accept new windows. -When new windows are to be focused, they will be opened in a non-dedicated -frame instead. -.br -If no argument is given, toggle the current dedicateness. By default no -windows are dedicated. -.cmd delete ( C\-t k ) -Close the current window. -.cmd delkmap keymap -Deletes the keymap named \fIkeymap\fP, that was generated -with \fBnewkmap\fP. The keymaps \fBtop\fP -(or whatever was specified by \fBset topkmap\fP) and \fBroot\fP -cannot be deleted. -.cmd describekey keymap -Grab the next key. Similar to \fBreadkey\fP, describekey -shows only the command in \fIkeymap\fP, -that would be executed by \fBreadkey\fP. -.cmd echo text -Show \fItext\fP as ratpoison message. -.cmd escape key -Update the default escape key to \fIkey\fP. -.br -Strictly speaking it updates the the \fBreadkey root\fP command -in the keymap \fBtop\fP to \fIkey\fP, the \fBother\fP binding -in \fBroot\fP to \fIkey\fP, and \fBmeta\fP binding in \fBroot\fP -to \fIkey\fP without modifiers or \fBC\-\fP\fIkey\fP if \fIkey\fP -has no modifiers. -(If \fBset topkmap\fP was called with an argument other than \fBtop\fP -that will be used instead of \fBtop\fP.) -.cmd exchangedown ( C\-t C\-Down ) -Exchange the window in the current frame with the window in the frame below the current frame. -.cmd exchangeleft ( C\-t C\-Left ) -Exchange the window in the current frame with the window in the frame left of the current frame. -.cmd exchangeright ( C\-t C\-Right ) -Exchange the window in the current frame with the window in the frame right of the current frame. -.cmd exchangeup ( C\-t C\-Up ) -Exchange the window in the current frame with the window in the frame above the current frame. -.cmd exec shell\-command ( C\-t ! ) -Spawn a shell executing \fIshell\-command\fP. -.cmd execa shell\-command -Spawn a shell executing \fIshell\-command\fP, without remembering -the current frame, so that _NET_WM_PID declaring programs will be -placed into the frame active when they open a window instead of -the frame active when ratpoison gets this command. -.cmd execf frame shell\-command -Spawn a shell executing \fIshell\-command\fP, showing _NET_WM_PID -supporting programs in the given frame instead of the frame selected -when this program is run. -.cmd fdump [ screenno ] -Output the defining data for all frames of the current screen, or -for screen number \fIscreenno\fP if this is specified. -.cmd focus ( C\-t Tab ) -Focus the next frame. -.cmd focuslast -Switch to the last selected focus. -.cmd focusleft ( C\-t Left ) -Switch to the frame to the left of the current one. -.cmd focusdown ( C\-t Down ) -Switch to the frame beneath the current one. -.cmd focusright ( C\-t Right ) -Switch to the frame to the right of the current one. -.cmd focusprev -Focus the previous frame. -.cmd focusup ( C\-t Up ) -Switch to the frame above the current one. -.cmd frestore frames -Replace the current frames with the ones specified in \fIframes\fP in the -format as generated by \fBfdump\fP. -.cmd fselect [ frameno ] ( C\-t f ) -If an argument is supplied, switch to a frame given by number \fIframeno\fP. - -If no argument is given, show a frame selector in each frame and wait for -a key to be pressed. -If the key matches an existing frame selector, this frame gets focused. - -Frame selectors are by default the numbers starting with zero, but they -can be changed by \fBset\fPing \fBframesels\fP. -.cmd gdelete [ group ] -If the optional argument \fIgroup\fP is supplied, delete group -\fIgroup\fP. Otherwise delete the current group. -If the last -group is deleted, a new group with name \fBdefault\fP is created. -The group has to be empty, otherwise it cannot be deleted. -.cmd getenv variable -Output the value of the environment variable \fIvariable\fP. -.cmd getsel -Paste the current X Selection into the current window. -.cmd gmerge group -Move all windows from group \fIgroup\fP into the current group. -.cmd gmove group -Move the current window into group \fIgroup\fP. -.cmd gnew group -Create a new group with name \fIgroup\fP and select it. -Most window commands only see (and thus select, consider next, -previous or last) windows within the group active when they are -issued. -.cmd gnewbg group -Create a new group named \fIgroupf\fP, but do not select it. -.cmd gnext -Select the next group. Most window commands only see windows in the -effective group. -.cmd gnumber -Give the number \fInew\fP to the group with the number \fIold\fP or -the current group. -.cmd gother -Select the last accessed group. Most window commands only see windows in the -effective group. -.cmd gprev -Select the prior group. Most window commands only see windows in the -effective group. -.cmd gravity [ \fBnw | \fBw | \fBsw | \fBn | \fBc | \fBs | \fBne | \fBe | \fBse ] -Change how in its frame the current window is aligned. -.cmd grename -Rename current group. -.cmd groups -Output a list of all groups with their number. -.cmd gselect group -Select the group names \fIgroup\fP. -.cmd help [ keymap ] -If the optional parameter \fIkeymap\fP is given, -list all keybindings in this keymap, -otherwise list all key bindings in keymap \fIroot\fP. -.cmd hsplit [ l\fB/\fR\fIp | "pixels from left" | "\fB\-\fR\fIpixels from right" ] ( C\-t S ) -Split the current frame into left frame and a right frame. -If no parameter is given, split in halves. -If two numbers separated -by a slash\ ("\fB/\fP") are given, the left one is \fIl\fP times the \fIp\fPth part -and the right one (\fIp\fP\-\fIl\fP) times the \fIp\fPth part of the prior width. -Otherwise the right one is \fIpixels from right\fP wide or the left one -\fIpixels from left\fP wide, depending whether there is \fB\-\fP in front of -the number or not. -.cmd inext -Like \fBnext\fP but switch to the next window with the same -resource class as the current one. -(That means the next window belonging to the same application - as the current one.) -.cmd info ( C\-t i ) -Output the current the width, height, window number and window name of the current -window. -(What name means is chosen by "\fBset\ winname\fP".) -.cmd iprev -Like \fBprev\fP but switch to the previous window with the same -resource class as the current one. -(That means the previous window belonging to the same application - as the current one.) -.cmd iother -Like \fBother\fP but switch to the window of the current group that was last -accessed and has the same resource class but is not currently visible. -.cmd kill ( C\-t K ) -Close the X\-connection of the X\-client responsible for the current window. -.cmd lastmsg ( C\-t m ) -Reshow the last message. -.cmd license ( C\-t V ) -Show ratpoison's license. -.cmd link key [ keymap ] -Do what \fIkey\fP is bound to in the keymap \fIkeymap\fP if supplied. -Otherwise what \fIkey\fP is bound to in keymap \fBroot\fP. -.cmd listhook event -List all commands specified with \fBaddhook\fP to be executed when -even \fIevent\fP occurs. -.cmd meta [ key ] ( C\-t t ) -Send the escape key (that which normally is \fBC\-t\fP) to the current window. -If a \fIkey\fP is specified, this is sent instead. Note that some applications by -default ignore the synthetic key that is sent using this command as it -is considered a security hole. xterm is one such application. -.cmd msgwait [ seconds ] -Set the duration the message window is shown. -If \fIseconds\fP is zero, wait infinitely. -.cmd newkmap keymap -Generate a new keymap names \fIkeymap\fP. This keymap can -be used to add new key\-command mapping to it with \fBdefinekey\fP -and can be called with \fBreadkey\fP. -.cmd newwm new window manager -Quit ratpoison and execute \fInew window manager\fP instead. -.cmd next ( C\-t Return | C\-t n | C\-t space ) -Switch to the next window in the current group. -.cmd nextscreen ( C\-t N ) -Switch to the next screen. (If you have multiple physical ones.) -.cmd number new [ old ] -Give the number \fInew\fP to the window with the number \fIold\fP or -the current window. -.cmd only ( C\-t Q ) -Remove all frames on the current screen except the current frame and -maximize this one to the size of the whole screen. -.cmd other ( C\-t C\-t ) -Switch to the window of the current group that was last -accessed but is not currently visible. -.cmd prev ( C\-t p ) -Switch to the previous window in the current group. -.cmd prevscreen ( C\-t P ) -Switch to the previous screen. (If you have multiple physical ones.) -.cmd prompt [ prompt ] -Ratpoison will ask the user for input, showing \fIprompt\fP (or -a single colon, if no argument is given) and output the input the -user has made. -.br -Note that this command probably does not make much sense in interactive -mode. -.cmd putsel x\-selection -Replace the X selection with the text \fIx\-selection\fP. It can be -inserted into the current window with \fBgetsel\fP. -.cmd quit -Quit ratpoison. -.cmd ratinfo -Display the x y coordinates of the rat cursor relative to the screen. -.cmd ratrelinfo -Display the x y coordinates of the rat cursor relative to the current window or current frame if no window is focused -.cmd ratwarp x y -Move the rat cursor to the position (\fIx\fP,\fIy\fP). -.cmd ratrelwarp deltax deltay -Move the rat cursor to (\fIdeltax\fP,\fIdeltay\fP), relative -to the current position. -.cmd ratclick [ button ] -Simulate a rat click with \fIbutton\fP (button 1=left button if none given). -.cmd rathold \fBup\fR\fI | \fBdown\fR\fI [ button ] -Simulate pressing|releasing rat button \fIbutton\fP (1=left button if none given). -.cmd readkey keymap -Grab the next key pressed, and execute the command associated to this key -in \fIkeymap\fP. -To show it is waiting for a key, ratpoison will change the -rat cursor to a square if \fBwaitcursor\fP is set. - -This command is perhaps best described with its usage in the default -configuration: By pressing \fBC\-t\fP, which is the only key in the keymap -\fBtop\fP, the command "\fBreadkey root\fP" is executed. The next key -then executes the command in keymap \fBroot\fP belonging to this command. -.cmd redisplay ( C\-t l ) -Extend the current window to the whole size of its current frame and -redisplay it. -(Useful to redisplay normal windows or bring transient windows to the -full size of the frame as only normal windows are maximized by ratpoison) -.cmd redo ( C\-t U ) -Revert the last \fIundo\fP of frame changes. -.cmd remhook event command -Remove command \fIcommand\fP from the list of commands to be called when -event \fIevent\fP is hit. (The command has to specified, as an event can -have multiple commands attached to it.) -Use "\fBlisthook\fP \fIhook\fP" to get a list of all attached commands. -.cmd remove ( C\-t R ) -Remove the current frame and extend some frames around to fill the remaining -gap. -.cmd resize [ deltax deltay ] ( C\-t r ) -If \fIdeltax\fP and \fIdeltay\fP are supplied, resize the current frame -by that (i.e. move the bottom right corner by the given offsets and then -move this frame and resize adjacent frames to make the frames fill the -whole screen again.) - -If in interactive mode no arguments are supplied, resize the current -frame interactively: -.br -.ta 20 -\fBReturn\fP: finish resizing -.br -\fBC\-g\fP or \fBEscape\fP: abort resizing -.br -\fBC\-n\fP or \fBDown\fP or \fBj\fP: grow vertically -.br -\fBC\-p\fP or \fBUp\fP or \fBk\fP: shrink vertically -.br -\fBC\-f\fP or \fBRight\fP or \fBl\fP: grow horizontally -.br -\fBC\-b\fP or \fBUp\fP or \fBh\fP: shrink horizontally -.br -\fBs\fP: shrink to size of current window - -While resizing interactively, changes are in multiples of the amount -of pixels given by \fBset resizeunit\fP (by default 10). -.cmd restart -Restart ratpoison. -.cmd rudeness [ rudeness ] -Show or set what kind of windows are allowed to jostle into the foreground. - -\fIrudeness\fP is a bitwise or of the following values: -.ta 5 -.br -1 Transient windows may raise. -.br -2 Normal windows may raise. -.br -4 New transient windows end up in the foreground. -.br -8 New normal windows end up in the foreground. - -Default is all allowed i.e.\& 15. - -.cmd sdump -Output the list of all screens. -The screens are separated by commas. Each screen is shown as 6 values: -its number, its x\-coordinate, its y\-coordinate, its width, its height -and if it is currently selected (1=true,0=false). -.cmd select \fB\-\fP | name | nr ( C\-t ' ) -If a number is given, switch to the window with number \fInr\fP. -If a name is given, switch to the window in the current group with -name \fIname\fP. -Blank the current frame, if \fB\-\fP is given. -.cmd set [ variable [ value ] ] -If no argument is given, output all ratpoison variables and their values. -.br -If one argument is given, output the value of ratpoison variable \fIvariable\fP. -.br -Otherwise set ratpoison variable \fIvariable\fP to \fIvalue\fP. What values -are valid depends on the variable. -See the section \fBVARIABLES\fP later in this document for details. -.cmd setenv variable value -Set the environment variable \fIvariable\fP to \fIvalue\fP. -(Environment variables will be passed to all programs started from ratpoison.) -.cmd sfdump -Output all frames similar to \fBfdump\fP, but not limited to one screen, but -all screens at once and with the screen number after each frame. -.cmd sfrestore -Replace the current frames with the ones specified in \fIframes\fP in the -format as generated by \fBsfdump\fP. -.cmd shrink -Shrink the current frame to the size of the current window with in. -.cmd split [ split ] ( C\-t s ) -alias for \fBvsplit\fP -.cmd source file -Read \fIfile\fP and execute each line as ratpoison command. -.cmd sselect screennumber -Switch to the screen \fIscreennumber\fP. (If you have multiple physical ones.) -.cmd startup_message \fBon | \fBoff -Select whether ratpoison will show a startup message or not. -.cmd swap [ dest-frame [ src-frame ] ] ( C\-t x ) -Exchange the window in \fIsrc-frame\fP (or the current frame if there is no second -argument) with the window \fIdest-frame\fP (or ask interactively which frame to -swap with if there is no argument). -.cmd time ( C\-t a ) -Output current data and time. -.cmd title newname ( C\-t A ) -Overwrite the title of the current window with \fInewname\fP. -All following ratpoison commands will only know the -window under the new name. -.cmd tmpwm tmpwm -Temporarily give control over to the other window manager \fItmpwm\fP, -reclaiming control when that WM terminates. -.cmd unalias alias -Remove the alias \fIalias\fP. -.cmd unbind key -alias for "\fBundefinekey root\fP \fIkey\fP" -.cmd undefinekey keymap key -Remove the binding for \fIkey\fP from \fIkeymap\fP. -.cmd undo ( C\-t _ or C\-t u ) -Un\-do the last change to the frameset. -(Like splitting, resizing, deleting, ...) -.br -The amount of steps that can be undone is specified by the variable -\fBmaxundos\fP. -.cmd unmanage [ name ] -Add \fIname\fP to the list of unmanaged windows. -Thus, windows of this -name will not be managed but allowed to choose their position themselves. - -In non\-interactive mode calling it without arguments will print the list. - -The list can be cleared again by calling \fBclrunmanaged\fP. -.cmd unsetenv variable -Remove variable \fIvariable\fP from the list of environment variables. -.cmd verbexec cmdline -Spawn a shell executing \fIcmdline\fP after showing a message with the command. -.cmd version ( C\-t v ) -Output version and compile time information. -.cmd vsplit [ l\fB/\fR\fIp | "pixels from top" | "\fB\-\fR\fIpixels from bottom" ] ( C\-t s ) -Split the current frame into upper frame and a lower frame. -If no parameter is given, split in halves. -If two numbers separated -by a slash\ ("\fB/\fP") are given, the upper one is \fIl\fP times the \fIp\fPth part -and the lower one (\fIp\fP\-\fIl\fP) times the \fIp\fPth part of the prior height. -Otherwise the lower one is \fIpixels from bottom\fP wide or the upper one -\fIpixels from top\fP high, depending whether there is a \fB\-\fP in front of -the number or not. -.cmd warp [ \fBon | \fBoff ] -Select if focusing a window moves the rat cursor to the place it had been last -time this window was focused, or not. -.cmd windows [ format ] ( C\-t w ) -In interactive mode, -show the list of all windows in the current group for -the duration specified by \fBmsgwait\fP -If \fBmsgwait\fP is zero, toggle between indefinitely showing -and not showing. - -The messages are shown in columns or rows depending on the \fBset\fPting -of \fBwinliststyle\fP in the format set by \fBset winfmt\fP. -The following substitutions happen in format: -.br -%a by the application name (resource name), -.br -%c by the resource class, -.br -%f by the frame number, -.br -%g by the gravity of the window, -.br -%h by the height of the window, -.br -%H by the unit to resize the window vertically (height_inc) -.br -%i by the X Window ID, -.br -%p by the process ID, -.br -%l by the last access number, -.br -%M by the string \fBMaxsize\fP, if it specifies a maximum size, -.br -%n by the window number, -.br -%s by window status (\fB*\fP is active window, -\fB+\fP would be chosen by \fBother\fP, \fB\-\fP otherwise) -.br -%S by the screen number -.br -%t by the window name (see \fBset winname\fP), -.br -%T by the string \fBTransient\fP, if it is a transient window -.br -%w by the width of the window -.br -%W by the unit to resize the window horizontally (width_inc) -.br -%x by the xine screen number -and -.br -%% by a single % - -Additionally there can be a positive decimal integer number between the -percent sign and the format string to specify the length this value -should be truncated to if longer. -(For example: \fB%20t\fP) - -In non\-interactive mode, output the list of windows in the current group -line by line. The format string can be overwritten by the optional parameter -\fIformat\fP. -.SH VARIABLES -Ratpoison variables can be shown and set with \fBset\fP. -There are: -.var resizeunit pixels -Set the amount of pixels interactive \fBresize\fPing will add/subtract -in each step. -.br -Default is 5. -.var maxundos number -The maximal amount of step ratpoison can undo with the \fBundo\fP command. -.br -Default is 20. -.var wingravity \fBnw | \fBw | \fBsw | \fBn | \fBc | \fBs | \fBne | \fBe | \fBse -Set the default gravity new normal windows will get. -Possible values are the same as in the \fBgravity\fP command, which changes -the gravity of an existing window: cardinal points or numbers 1 to 9. -.br -Default is \fBnorthwest\fP. -.var maxsizegravity \fBnw | \fBw | \fBsw | \fBn | \fBc | \fBs | \fBne | \fBe | \fBse -Set the default gravity new self\-maximized windows will get. -Possible values are the same as in the \fBgravity\fP command, which changes -the gravity of an existing window: cardinal points or numbers 1 to 9. -.br -Default is \fBcenter\fP. -.var transgravity \fBnw | \fBw | \fBsw | \fBn | \fBc | \fBs | \fBne | \fBe | \fBse -Set the default gravity new transient windows will get. -Possible values are the same as in the \fBgravity\fP command, which changes -the gravity of an existing window: cardinal points or numbers 1 to 9. -.br -Default is \fBcenter\fP. -.var bargravity \fBnw | \fBw | \fBsw | \fBn | \fBc | \fBs | \fBne | \fBe | \fBse -Select the location where message and prompt bars appear. -.br -Default is \fBnortheast\fP. -.var font font -Make ratpoison use font \fIfont\fP. -.var padding left top right bottom -Set how much space at the borders of the screen will not be used. -.br -Default is 0 0 0 0. -.var border pixels -Selects how thick the frame around windows is. -.br -Default is 1. -.var barborder pixels -Selects how thick the frame around ratpoison's prompt or message windows is. -.br -Default is 1. -.var inputwidth pixels -Determine the width of the input window. -.br -Default is 200. -.var barinpadding \fB0 | \fB1 -If there is padding, determines whether the bar appears at the edge of the -screen (\fB1\fP) or at the edge of the window area (\fB0\fP). -.br -Default is 0. -.var topkmap kmap -Make \fIkmap\fP the top keymap ratpoison grabs directly. -The default value is \fBtop\fP. -.var waitcursor \fB0 | \fB1 -Determine whether to change the rat cursor when waiting for a key -(\fB1\fP) or not (\fB0\fP). -(see \fBreadkey\fP and \fBdescribekey\fP). -.br -Default is 1. -.var winfmt format -Choose the default format for the the \fBwindows\fP command. -.br -Default is %n%s%t. -.var winname \fBtitle | \fBname | \fBclass -Choose what is considered the "name" of the window by ratpoison: -.ta 7 -\fBtitle\fP The title of the window. -.br -\fBname\fP The resource name of the window. -.br -\fBclass\fP The resource class i.e. the name of the application. -.br -Default is \fBtitle\fP. -.var fgcolor color -The foreground color of the windows ratpoison creates. -.br -Default is black. -.var bgcolor color -The background color of the windows ratpoison creates. -.br -Default is white. -.var fwcolor color -The border color of the focused window. -.br -Default is black. -.var bwcolor color -The border color of unfocused windows. -.br -Default is black. -.var barpadding x y -Set horizontal padding of ratpoison windows to \fIx\fP and vertical -padding to \fIy\fP. -.br -Default is 4 0 -.var winliststyle \fBrow | \fBcolumn -Determines whether windows are shown in \fBrow\fPs or in \fBcolumn\fPs. -.br -Default is column. -.var framesels selectors -Override the frame selectors \fBfselect\fP uses. -The first character is the selector for the first frame, -the second character is the selector for the second frame and so on. - -Using this variable, one can directly access more than 10 frames. - -Default is an empty string, which is equivalent to "0123456789". -.var historysize number -Specify maximum number of values kept in input history. - -Default is 20. -.var historycompaction \fB0 | \fB1 -Decide if new input lines added to history delete -older equal lines from history. - -Default is 1 (on). -.var historyexpansion \fB0 | \fB1 -Decide if history expansion using ! is available. -(Can only be activated when compiled with readline's libhistory.) - -Default is 0 (off). -.SH AUTHOR -Upstream Author is Shawn Betts <sabetts@gmail.com>. -.br -See /usr/share/doc/ratpoison/AUTHORS for other contributors. -.P -This manual page was written by Bernhard R. Link <brlink@debian.org>. diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi deleted file mode 100644 index 7b9ce78..0000000 --- a/doc/ratpoison.texi +++ /dev/null @@ -1,1895 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename ratpoison.info -@include version.texi -@settitle Ratpoison @value{VERSION} manual -@c %**end of header - -@dircategory X11 -@direntry -* ratpoison: (ratpoison). Say good-bye to the rodent -@end direntry - -@copying -Copyright @copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006 Shawn Betts - -@quotation -The ratpoison user manual is free documentation; permission is granted to -copy, distribute and/or modify this document under the terms of either: - -a) 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, or - -b) the GNU Free Documentation License, version 1.2 or any later -version published by the Free Software Foundation; with no -Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. - -The ratpoison manual 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 or GNU Free Documentation License for more -details. - -A copy of the FDL is included in the section entitled -@ref{GNU Free Documentation License}. -You should have received a copy of the GNU General Public License -along with this software; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, -MA 02110-1301, USA. - -If you choose to allow use of your version of this content only under the -terms of one of the licenses, indicate your decision by deleting the notice -of the other license. If you do not delete any of those, a recipient may use -your version of this file unter the terms of either the GNU FDL or the GNU GPL. -@end quotation -@end copying - -@titlepage -@title The ratpoison user manual -@author Shawn Betts - -@page -@vskip 0pt plus 1filll -@insertcopying -@end titlepage - -@ifnottex -@node Top -@top Ratpoison - -This document explains how to use ratpoison @value{VERSION}. - -@insertcopying -@end ifnottex - -@contents - -@menu -* About:: What Is Ratpoison? -* Contacting:: How Do I Contact The Ratpoison Developers? -* Concepts:: Window Manipulation Concepts -* General Use:: How Does This Thing Work?? -* Windows:: Navigating The Windows -* Groups:: Grouping Windows Together -* Frames:: Dividing The Screen -* Multiple Monitors:: What To Do With All Your Computer Junk -* Keystrokes:: Key Commands And Functionality -* Hooks:: Attaching Scripts To Ratpoison Events -* The Status Bar:: Ratpoison's Input/Output Area -* Using Other Window Managers:: Return To Evil -* Other Commands:: Miscellaneous Commands -* Input:: Typing Text Into Ratpoison -* Command Line Arguments:: ratpoison Command-Line Actions -* Startup file:: They Threatened Me...With Violence! -* GNU Free Documentation License:: -* Command Index:: Index - -@detailmenu - --- The Detailed Node Listing --- - -Windows - -* Manipulating Windows:: -* Window Classes:: -* Unmanaged Windows:: -* Rudeness:: - -Frames - -* Splitting Frames:: -* Resizing Frames:: -* Frame Navigation Commands:: -* Saving and Restoring Frame Sets:: -* Frame Numbering:: -* Dedicated Frames:: - -Keystrokes - -* Key Maps:: -* Default Key Bindings:: - -@end detailmenu -@end menu - -@node About, Contacting, Top, Top -@chapter About - -ratpoison is a simple Window Manager with no fat library dependencies, -no fancy graphics, no window decorations, and no rodent dependence. It -is largely modeled after GNU Screen which has done wonders in the -virtual terminal market. - -All interaction with the window manager is done through -keystrokes. ratpoison has a prefix map to minimize the key clobbering -that cripples Emacs and other quality pieces of software. - -ratpoison was written by Shawn Betts (@email{sabetts@@gmail.com}). - -@node Contacting -@chapter Contacting -ratpoison is hosted on @url{http://savannah.nongnu.org}. To see the latest -developments in ratpoison go to -@url{http://savannah.nongnu.org/projects/ratpoison} or visit the -ratpoison webpage at @url{http://www.nongnu.org/ratpoison}. - -There is also a ratpoison mailing list: -@email{ratpoison-devel@@nongnu.org}. For details on subscribing -and for the list archives go to the ratpoison Savannah project. - -There is a @url{irc://irc.freenode.net/#ratpoison, #ratpoison} IRC -channel on the @url{http://freenode/, Freenode} network. - -@node Concepts -@chapter Concepts - -ratpoison uses the concept of @dfn{panes} to place and size -windows. Instead of allowing windows to have arbitary shapes at -arbitary locations on the screen, the display is divided into panes, -the same way a physical window might contain several pieces of glass -seperated by wood. In ratpoison, the panes are called @dfn{frames}, -and windows are placed in them, maximised. ratpoison starts with one -frame, which can be split into an arbitary number of smaller -ones. Each frame can be split in half either horizontally or -vertically. You can move among them, making different ones the -current. For more information, see @ref{Splitting Frames}. - -Each frame has at most one window associated with it, which is visible -in that frame. If you select a window that is associated with a frame, -the focus will move to its associated frame, rather than moving the -window to the current frame. If you select a window that is not -associated with a frame, that window will be opened in the current -frame and resized to fit that frame. - -If the window associated with a frame does not fill the frame -completely, the various gravity commands control how it is placed. - -If no window was open in that frame before the current window was -opened, the X root will be visible behind it. - -Transient windows (dialog boxes, splash screens, and the like) are -handled specially. In order to understand the contents of a transient -window, the previously focused window is often required. Take a search -window, it is useful to be able to see the document you are searching -as well as the search window. For this reason transient windows appear -overtop (according to their gravity) of the previously focused window. - -Every window belongs in a group. A group is simply that: a group of -windows. By default there is only one group (the @dfn{default group}) -that all windows exist in. You can create new groups. When a program -creates a window it will be added to the current group. Groups are -generally used to organize windows into different classes such as work -and wasting-time-at-work. - -@node General Use -@chapter General Use - -When ratpoison starts you should see an empty X server. To open an x -terminal hit @kbd{C-t c}. You can now run shell commands as you would on -any terminal. Notice the terminal maximized full screen. @kbd{C-t !} -will run a single shell command and saves you the effort of opening a -terminal. - -Once you have a couple X programs running, you'll want to navigate -between windows. To see what windows are being managed hit @kbd{C-t -w}. Each window has a number. You can jump to a window by hitting -@kbd{C-t} followed by the window's number. This assumes the the window's -number is one digit. You can also switch to a window by typing in part -of its name. To do this hit @kbd{C-t '}. - -ratpoison allows you to cycle through the windows with @kbd{C-t n} -and @kbd{C-t p}. - -And That concludes a brief introduction on how to use ratpoison. Notice -how we didn't have to drag a single window, or click a single maximize -button? Beautiful wasn't it? Felt fast? Cool? It's modern computing at -its best. - -@node Windows -@chapter Windows - -Windows are what ratpoison manages. - -@menu -* Manipulating Windows:: -* Window Classes:: -* Unmanaged Windows:: -* Rudeness:: -@end menu - -@node Manipulating Windows -@section Manipulating Windows - -The following are commands used to manipulate windows. - -@deffn Command select @var{n} -This jumps you to window @var{n} where @var{n} is the window number as -shown in the Program Bar. You can do the same trick with -@kbd{C-@var{n}} too. To select no window, blanking the current -frame, type @samp{select -}. -@end deffn - -@deffn Command select @var{window-name} -Go to a window by name. A shortcut is @kbd{C-t '}. -@end deffn - -@deffn Command windows @var{fmt} -This displays the Program Bar which displays the windows you currently -have running. The number before each window name is used to jump to -that window. You can do this by typing @kbd{C-t @var{n}} where @var{n} -is the number of the window. Note that only windows with numbers from -0 to 9 can be referenced using this keystroke. To reach windows with -numbers greater than 9, use @kbd{C-t '} and type the number at the -prompt. - -After 5 seconds the Program Bar disappears. - -This command is bound to @kbd{C-t w} by default. - -When invoked from the command-line like this, - -@example -$ ratpoison -c windows -@end example - -Instead of a message bar, you will get a list of the windows printed -to stdout. This allows you to write more advanced scripts than simple -keyboard macros. This is where @var{fmt} comes into play. If -@command{windows} is given an argument it treats it as the format string as -described in @command{set winfmt}. -@end deffn - -@deffn Command title @var{title} -Rename the currently active window. This name will remain for the -duration of the window's life, unless you change it again. By default, -the @kbd{C-t A} keystroke is bound to this command. -@end deffn - -@deffn Command other -This toggles between the current window and the last window. By -default, this is bound to @kbd{C-t C-t}. -@end deffn - -@deffn Command prev -This jumps you to the previous window in the window list. By default, -this is bound to @kbd{C-t p}. -@end deffn - -@deffn Command next -This jumps you to the next window in the window list. This one is -bound to three keystrokes, namely @kbd{C-t n}, @kbd{C-t space}, -and @kbd{C-t enter}. -@end deffn - -@deffn Command kill -This destroys the current window. Normally you should only need to -use @command{delete}, but just in case you need to rip the heart out of a -misbehaving window this command should do the trick. Also available as -@kbd{C-t K}. -@end deffn - - -@deffn Command info @var{fmt} -Display information about the current window. At optional @var{fmt} -argument can be passed to override the default format. @command{info} -accepts the same format options as @command{windows}. - -@end deffn - -@deffn Command gravity @var{g} -Change the gravity of the current window. A normal window will default -to the top-left corner of the screen, but it can also be placed at the -bottom-right corner of the screen. Valid values for @var{g} are the 8 -directions @samp{northwest}, @samp{north}, @samp{northeast}, -@samp{east}, @samp{southeast}, @samp{south}, @samp{southwest} and -@samp{west}, clockwise from the top left corner. @samp{center} will -center the window in the frame. @var{g} and can be abbreviated to the -standard compass 1 and 2 letter abbreviations (i.e. @samp{nw}, -@samp{s}, etc). - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command delete -This deletes the current window. You can access it with the @kbd{C-t k} -keystroke. -@end deffn - -@deffn Command {set infofmt} @var{fmt} -Set the default window format for the @command{info} command. See -@command{set winfmt} for accepted format characters. -@end deffn - -@deffn Command {set winname} @var{name} -@c @deffnx Command defwinname @var{name} -There are three resources ratpoison can get a window's name from: the -WMNAME hint, the res_name from the WMCLASS hint, or the res_class from -the WMCLASS hint. @var{name} can be @samp{title} which is what most -window managers put in the title bar, @samp{name} which is the -res_name, or @samp{class} which is the res_class. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set wingravity} @var{g} -@c @deffnx Command defwingravity @var{g} -Set the default gravity for normal windows. See the -@command{gravity} command. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set winliststyle} @var{setting} -@c @deffnx Command defwinliststyle @var{setting} -The window list can be displayed in a row or a column. @var{setting} -can be @samp{row} or @samp{column}. -@end deffn - -@deffn Command {set winfmt} @var{fmt} -@c @deffnx Command defwinfmt @var{fmt} -Set the default window format for the @command{windows} command. By -default it is @samp{%n%s%t}. The following is a list of valid format -characters: - -@table @samp -@item %a -Application Name -@item %c -Resource Class -@item %f -The frame number the window is displayed in or a space if it is not in -a frame. -@item %g -The window's gravity setting -@item %h -The window's height -@item %H -The window's height increment hint. -@item %i -X11 Window ID -@item %l -A unique number based on when the window was last accessed. The higher -the number, the more recently it was accessed. -@item %n -The window number -@item %p -Process ID ('?' if _NET_WM_PID isn't set) -@item %s -Window status (current window, last window, etc) -@item %S -The window's screen -@item %t -Window Name -@item %T -Whether the window is a transient or not. -@item %M -Whether the window is a maxsize window or not. -@item %w -The window's width -@item %W -The window's width increment hint -@item %x -the window's xinerama screen -@end table - -Additionally there can be a number between the percent sign and the format -character, denoting a maximum length this value is to truncate to, e.g. @samp{%n%s%20t}. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command number @var{n} @var{target} -Set a window's number to @var{n}. If another window occupies the -requested number already, then the windows' numbers are swapped. - -The second argument, @var{target}, is optional. It should be the -number of the window whose number will be changed. If @var{target} is -omitted ratpoison defaults to the current window. -@end deffn - -@deffn Command {set transgravity} @var{g} -@c @deffnx Command deftransgravity @var{g} -Set the default alignment for transient windows. See the -@command{gravity} command. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command {set maxsizegravity} @var{g} -@c @deffnx Command defmaxsizegravity @var{g} -Set the default alignment for windows with maxsize hints. See the -@command{gravity} command. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command {set border} @var{n} -@c @deffnx Command defborder @var{n} -Set the border width for all windows. - -When called with no arguments, the current setting is -returned. -@end deffn - -@node Window Classes -@section Window Classes - -Window classes are a way of grouping windows together. Windows that -are part of the same program generally have the same class. Ratpoison -takes advantage of this to help you navigate between windows of the -same class. This is useful if you only want to cycle through Emacs -frames or XTerms. - -@deffn Command inext -Go to the next window in the window list that is in the same class as -the current window. -@end deffn - -@deffn Command iprev -Go to the previous window in the window list that is in the same class -as the current window. -@end deffn - -@deffn Command iother -Go to the last accessed window that is in the same class as the -current window. -@end deffn - -@deffn Command cnext -Go to the next window in the window list that is in a different class -from the current window. -@end deffn - -@deffn Command cprev -Go to the previous window in the window list that is in a different -class from the current window. -@end deffn - -@deffn Command cother -Go to the last accessed window that is in a different class from the -current window. -@end deffn - -@node Unmanaged Windows -@section Unmanaged Windows - -ratpoison can intentionally not manage windows. ratpoison keeps a list -of strings and if any new window's name matches a string in the list, -then it will not be picked up and managed by ratpoison. - -The following are commands to manipulate this list - - -@deffn Command clrunmanaged -Clear the unmanaged window list. -@end deffn - -@deffn Command unmanage @var{text} -Add @var{text} to the unmanaged window list. Any window whose name -matches any of the strings in the unmanaged window list will not be -handled in any way by ratpoison. This only applies to new windows (not -windows already managed by ratpoison). - -When called with no arguments, the list is returned. -@end deffn - -@node Rudeness -@section Rudeness - -Some programs will attempt to steal the focus without the users -permission. Not only is this a sign of a lame programmers attempt to fix -a window manager problem in the wrong place, it's just plain rude. By -default ratpoison will honour these rudeness requests, but it doesn't -have to. Use the @command{rudeness} command to deal with such programs. - -@deffn Command rudeness @var{n} -The rudeness command lets you decide what windows pop-up automatically -and when. This is often useful for those deep hack sessions when you -absolutely can't be disturbed. - -There are two kinds of windows: normal windows (like an xterm) and -transient windows (generally pop-up dialog boxes). When a client -program wants to display a new window it makes a requests to -ratpoison. ratpoison then decides whether to grant the request and -display the window or ignore it. A client program can also request -that one of its windows be raised. You can customize ratpoison to -either honour these requests (the default operation) or ignore them. - -@var{n} is a number from 0 to 15. Each of the four bits determine -which requests ratpoison grants. - -@table @asis -@item Bit 0 -Tells ratpoison to grant raise requests on transient windows - -@item Bit 1 -Tells ratpoison to grant raise requests on normal windows - -@item Bit 2 -Tells ratpoison to grant display requests on new transient windows - -@item Bit 3 -Tells ratpoison to grant display requests on new normal windows -@end table - -For example, if you wanted only wanted to grant transient windows -raise requests and display requests you would type @samp{rudeness -5}. If a request is not granted ratpoison will tell you about the -request with a message like @samp{Raise request from window 1 -(emacs)}. - -When called with no arguments, the current setting is -returned. -@end deffn - -@node Groups -@chapter Groups -ratpoison provides functionality to group windows together. This -coupled with saving and restoring frames configurations is what most -people would call @dfn{virtual desktops} or @dfn{workspaces}. - -While ratpoison doesn't explicitly provide support for such things, it -does allow you to write scripts to this end. Such a script exists in -@file{contrib/} called @file{rpws}. Consult that file for details on -setting up workspaces inside ratpoison. - -Groups are more general purpose than workspaces. windows from one -group can be visible along with windows from another group. If you -switch to a different group nothing changes except the list of windows -you can cycle through. ratpoison allows the user to move a window from -one group to another, merge two groups, create new groups, and delete -existing ones. - -The following is a list of of commands used for manipulating groups. - -@deffn Command gnew @var{name} -Create a new group with the name @var{name}. @var{name} is -optional. The new group becomes the current group. -@end deffn - -@deffn Command gnewbg @var{name} -This is the same as @command{gnew} except that the current group does -not change. -@end deffn - -@deffn Command groups -Display a list of groups with a similar format to @command{windows}. -@end deffn - -@deffn Command gmove @var{group} -Move the current window to @var{group}. -@end deffn - -@deffn Command gnext -Go to the next group in the list. -@end deffn - -@deffn Command gother -Go to the last accessed group. -@end deffn - -@deffn Command gprev -Go to the previous group in the list. -@end deffn - -@deffn Command grename -Rename current group. -@end deffn - -@deffn Command gnumber @var{GROUP} @var{target} -Set a group's number to @var{GROUP}. If another group occupies the -requested number already, then the groups' numbers are swapped. - -The second argument, @var{target}, is optional. It should be the -number of the group whose number will be changed. If @var{target} is -omitted ratpoison defaults to the current group. -@end deffn - -@deffn Command gselect @var{group} -Select a particular group by name or number. If @var{group} is not -provided, ratpoison will interactively prompt for the group. -@end deffn - -@deffn Command gmerge @var{group} -Merge @var{group} with the current group. All windows in @var{group} -will be moved to the current group. @var{group} is not deleted. -@end deffn - -@deffn Command gdelete @var{group} -Delete a group. @var{group} is optional. If it is not specified -ratpoison will attempt to delete the current group. Only empty groups -can be deleted. To empty a group see @command{gmerge}. -@end deffn - -@node Frames -@chapter Frames -Sometimes you may want to see two or more windows at the same -time. ratpoison allows you to split the display into frames (see -@ref{Concepts}). Each frame can then contain 1 window. - -@menu -* Splitting Frames:: -* Resizing Frames:: -* Frame Navigation Commands:: -* Saving and Restoring Frame Sets:: -* Frame Numbering:: -* Dedicated Frames:: -@end menu - -@node Splitting Frames -@section Splitting Frames - -To split the -current frame horizontally use @kbd{C-t s}. To split the current frame -vertically use @kbd{C-t S}. If you have enough windows, you'll notice -that the new frame will find a window for itself. You can now use the -normal navigation commands to switch windows in the frame. Note, -however, that if you switch by name or number to a window that is -already in another frame, you'll switch to that frame. - -Before too long, you'll probably want to switch to another frame. Use -@kbd{C-t tab} to cycle through the frames. If you want to remove a -frame use @kbd{C-t R}. ratpoison automatically adjusts the size of the -other frames to take up the free space. Unfortunately ratpoison may -not always fill it in the way you might like it to. - -Finally, when you've had enough of the splitting and you just want -good ol' full screen ratpoison press @kbd{C-t Q} to remove all splits -and leave you with the current window full screen. - -@deffn Command remove -Kill the current frame. This is a no-op if there is only one frame. -@end deffn - -@deffn Command only -Kill all frames but the current one. -@end deffn - -@deffn Command split @var{n} -@deffnx Command vsplit @var{n} -Split the current frame vertically in two. The last accessed window -not occupying a frame will be the second window. - -@var{n} is either a fraction of the form @code{x/y} or a number. If it -is a fraction then the current frame is resized to that fraction of -its original size and the new frame takes up the remaining space. For -instance, @code{split 1/4} will split the current frame to a quarter -of its original size and the new frame will then be 3/4 of the size of -the original frame. - -If it is a pixel, the original frame is resized to that many -pixels. If @var{n} has a minus sign before it, then the new frame will -shrink by that many pixels. -@end deffn - -@deffn Command hsplit @var{n} -Split the current frame horizontally in two. The last accessed window -not occupying a frame will be the second window. - -@var{n} is either a fraction of the form @code{x/y} or a number. If it -is a fraction then the current frame is resized to that fraction of -its original size and the new frame takes up the remaining space. For -instance, @code{split 1/4} will split the current frame to a quarter -of its original size and the new frame will then be 3/4 of the size of -the original frame. - -If it is a pixel, the original frame is resized to that many -pixels. If @var{n} has a minus sign before it, then the new frame will -shrink by that many pixels. -@end deffn - -@node Resizing Frames -@section Resizing Frames -ratpoison provides a command, @command{resize}, that resizes the -current frame. It is bound to the key @kbd{C-t r} by -default. @command{resize} can be used non-interactively by providing -two arguments: the number of pixels to grow horizontally and the -number to grow vertically. For example, if you wanted to grow the -current window by 10 pixels horizontally and shrink it vertically by -50 you could enter the command: - -@example -resize 10 -50 -@end example - -When resizing interactively, the following keys are used: - -@table @kbd -@item C-p -Grow the frame vertically. -@item C-n -Shrink the frame vertically. -@item C-f -Grow the frame horizontally. -@item C-b -Shrink the frame horizontally. -@item return -Accept the new frame size. -@item C-g -Abort and restore the frame to its original size. -@end table - -The increment size used to resize the frame interactively is -customized with the command @command{set resizeunit}. - -@deffn Command {set resizeunit} @var{pixels} -@c @deffnx Command defresizeunit @var{pixels} -Set the number of pixels a frame will grow or shrink by when being -dynamically resized. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command resize @var{horizontal} @var{vertical} -Resize the current frame by @var{horizontal} pixels horizontally, and -@var{vertical} pixels vertically. If no arguments are given and the -command is called interactively, ratpoison will let the user -dynamically resize the frame using @kbd{C-p} to shrink vertically, -@kbd{C-n} to grow vertically, @kbd{C-b} to shrink horizontally, -@kbd{C-f} to grow horizontally, and @kbd{s} to shrink the frame to the -size of the window (See the @command{shrink} command). When you have -resized the frame to your liking, press @kbd{Return} to finish. -@end deffn - -@deffn Command shrink -If a window has resize increment hints, such as xterms, the window may -not be able to take up the whole frame. In this case, use this command -to suck the frame up to the to window, reclaiming any wasted space. -@end deffn - -@node Frame Navigation Commands -@section Frame Navigation Commands - -Here are the commands for Navigating frames. - -@deffn Command fselect @var{n} -Select a frame by number. If an argument is passed to it then attempt -to select the frame whose number is @var{n}. If not, ratpoison will -print a number at the top left corner of each frame and wait for the -user to type the number they wish to select. Currently there is no way -to select a frame whose number is greater than 9 unless the number is -passed as an argument. -@end deffn - -@deffn Command curframe -Indicate which frame is the current frame. -@end deffn - -@deffn Command focus -cycle through ratpoison's frames. -@end deffn - -@deffn Command focusprev -cycle through ratpoison's frames backwards. -@end deffn - -@deffn Command focusdown -Move to the frame below the current frame. -@end deffn - -@deffn Command focuslast -Switch to the last focused frame. -@end deffn - -@deffn Command focusleft -Move to the frame left of the current frame. -@end deffn - -@deffn Command focusright -Move to the frame right of the current frame. -@end deffn - -@deffn Command focusup -Move to the frame above the current frame. -@end deffn - -@node Saving and Restoring Frame Sets -@section Saving and Restoring Frame Sets -ratpoison provides two commands, @command{fdump} and -@command{frestore}, that allow the user to save and restore frame -configurations. Let's say, for example, you have split your desktop -into several frames with some windows in these frames and now you want -to quickly bring Emacs forward and browse some code (full-screen of -course) then return to your funky frame configuration. You could use -@command{fdump} to dump the frames, hit @kbd{C-t Q} to remove all -frames, and then select your emacs window. When you've finished with -emacs you could use @command{frestore} to restore the windows and -frames. - -If a frame contained a window when you dumped the frame layout but -that window is not present when you restore the layout, the frame -holding that window will be blank. - -Calling @command{fdump} and @command{frestore} and copying and pasting -the layout by hand each time is a bit cumbersome. There are some -simple bindings in @file{doc/sample.ratpoisonrc} that allow you to -save and restore frame layouts with the press of a key. - -@deffn Command fdump @var{screen-num} -Dump the current frame layout as text. - -Without an argument the current screen's frames are dumped. With an -argument the @var{screen-num}th screen is dumped. @xref{Multiple Monitors}. -@end deffn - -@deffn Command frestore @var{frames} -Restore the frame layout based on the list of frames -@var{frames}. @var{frames} should be the text that was printed after -calling @code{fdump}. -@end deffn - -@deffn Command undo -Undo the last change of frame layout. This is especially helpful -after a @command{only} command. One can step at most @dfn{maxundos} -steps back in frame layout history. -@end deffn - -@deffn Command redo -redo the last change that was undone. -@end deffn - -@node Frame Numbering -@section Frame Numbering - -Frames are normally numbered starting from 0. But this can be changed -with @command{set framesels} to, for instance, include letters as well. - -@example -set framesels abcdefghijklmnopqrstuvwxyz -@end example - -The above code will bind letters to frames instead of numbers. - -@deffn Command set framesels @var{order} -Tell ratpoison what alphanumeric character to give each frame and in -what order. - -When called with no arguments, the current setting is returned. -@end deffn - -@node Dedicated Frames -@section Dedicated Frames - -A dedicated frame is a frame that will not allow new windows to appear -in it. Only the user may switch windows in this frame. - -@deffn Command dedicate -Toggle whether the current frame is dedicated or not. -@end deffn - -@node Multiple Monitors -@chapter Multiple Monitors -When you've finally accumulated enough computer junk, you'll find -yourself attaching a second monitor to your computer. ratpoison has -functionality to help you get around your new and improved desktop -space. - -The X Windowing System assigns each monitor a screen number. To switch -to another screen use the commands @command{nextscreen} and -@command{prevscreen}. Or, @command{sselect} to jump to a specified -screen. ratpoison will tell you which frame has focus by drawing the -current frame indicator in it. - -Many commands operate only on the current screen. This becomes -apparent when you have 2 screens each with 1 frame. In each frame you -have an xterm. If you try to switch to the other xterm with the -command @command{other}, for instance, you'll get a message ``No other -window.'' ratpoison means there's no other window to switch to in the -current screen. If you want to switch to the other xterm you can -switch to it by name (use @command{select} or @kbd{C-t '}), by number, -or you can use @command{nextscreen}, @command{prevscreen}, and -@command{sselect}. - -@deffn Command nextscreen -This jumps you to the next X11 screen. @command{nextscreen} is -used for dual-head displays and multiple monitor setups. -@end deffn - -@deffn Command prevscreen -This jumps you to the previous X11 screen. @command{prevscreen} is -used for dual-head displays and multiple monitor setups. -@end deffn - -@deffn Command sselect @var{n} -This jumps you to the @var{n}th X11 screen. Screen numbers start at 0. -@end deffn - -@deffn Command sdump -Like fdump, but dump information about each screen instead of each frame. -@end deffn - -@deffn Command sfdump -Dump all the screen number and the frames on all screens. -@end deffn - -@deffn Command sfrestore -restore a frame configuration created using @command{sfdump}. -@end deffn - -@node Keystrokes -@chapter Keystrokes - -Interactive control of ratpoison is done entirely through -keystrokes. This chapter explains how keystrokes are stored and -manipulated. - -ratpoison uses the Emacs style key notation. A combination of -modifiers and one non-modifier key combine to invoke an action. The -syntax is one or more modifiers seperated with dashes followed by a -dash and the non-modifier key name. For instance, holding down -control, shift, and super then pressing the spacebar would be -described as: - -@example -S-C-s-space -@end example - -The following is a list of modifiers ratpoison accepts: - -@table @asis -@item S -Shift modifier -@item C -Control modifier -@item M -Meta modifier -@item A -Alt modifier -@item H -Hyper modifier -@item s -Super modifier -@end table - -ratpoison uses the X11 keysym names for keys. Alphanumeric key names -are exactly what you see on your keyboard. Punctuation and other keys -have longer names which vary from X server to X server. To find the -name of a key, see the @command{describekey} command. Or to find the -name of a key not yet bound to an action, type @kbd{C-t} and then the -key. ratpoison will tell you it isn't bound and give you the name of -the key. - -@menu -* Key Maps:: -* Default Key Bindings:: -@end menu - -@node Key Maps -@section Key Maps - -All keystrokes exist inside a keymap. When you press the prefix key you -are accessing the @samp{root} keymap. By default all commands reside in -the @samp{root} key map and are accessed by pressing @kbd{C-t}. - -There is also a top level key map, @samp{top}. Any keystroke in this key -map can be accessed simply by pressing the key. This is where the prefix -key resides. - -The following example adds a @kbd{C-x b} key binding to switch windows, -much like @kbd{C-x b} in Emacs. See the functions below for full -descriptions. - -@example -# Create the key map -newkmap ctrl-x -# Bind b to 'select' on our new key map -definekey ctrl-x b select -# Attach our keymap to the top level key map via C-x. -definekey top C-x readkey ctrl-x -@end example - -The following functions control creating, editing, and deleting key maps. - -@deffn Command newkmap @var{kmap} -Create a new keymap named @var{kmap}. - -@end deffn - -@deffn Command delkmap @var{kmap} -Delete the keymap, @var{kmap}. -@end deffn - -@deffn Command bind @var{Key} @var{command} -Bind a key to a ratpoison command on the @samp{root} keymap. This -command takes two arguments: the key to bind and the command to -run. For example, to bind @kbd{C-t R} to restart ratpoison: - -@example -bind R restart -@end example -@end deffn - -@deffn Command unbind @var{key} -Unbind a keystroke on the @samp{root} keymap. -@end deffn - -@deffn Command definekey @var{kmap} @var{key} @var{command} -@command{definekey} works exactly like @command{bind} except that it -can bind keys on any key map (not just @samp{root}). -@end deffn - -@deffn Command undefinekey @var{kmap} @var{key} -Like @command{unbind} except that you pass it a key map in @var{kmap}. -@end deffn - -@deffn Command readkey @var{kmap} -Read a key from the keyboard and execute the command associated with -it in the keymap, @var{kmap}. -@end deffn - -@deffn Command link @var{key} -Call the command that @var{key} is bound to. For instance -@command{link C-t} would call the command @command{other} and switch -to the last window. -@end deffn - -@deffn Command describekey @var{keymap} -An interactive way to find the command bound to a given key on the -specified keymap. This command will wait for the user to type a -key. When the user does, the command will display the command bound to -this key. -@end deffn - -@deffn Command {set topkmap} @var{kmap} -Set the top level keymap to @var{kmap}. You might use this to swap -between several common keymappings or to implement modes. -@end deffn - -@node Default Key Bindings -@section Default Key Bindings - -The default keystrokes are listed in this chapter. Not all commands -are accessible by default by keys. - -@table @kbd - -@item C-t C-t -Switch to the last window. - -@item C-t t -Sometimes you need to send a C-t to the current window. This keystroke -does just that. - -@item C-t 0-9 -Switch to the numbered window. - -@item C-t - -Select no window, essentially hiding all windows in the current frame. - -@item C-t A -@item C-t C-A -Rename the current window. The window's new name will prevail for the -rest of its lifetime. - -@item C-t K -@item C-t C-K -Send a DestroyClient event to the current window. This will terminate -the application without question. - -@item C-t n -@item C-t C-n -@item C-t Return -@item C-t C-Return -@item C-t Space -@item C-t C-Space -Go to next window. - -@item C-t p -@item C-t C-p -Go to previous window. - -@item C-t ' -@item C-t C-' -Go to a window by name. You will usually only need to type the first -few characters of the window name. - -@item C-t a -@item C-t C-a -Display the current time of day. - -@item C-t c -@item C-t C-c -Open a new X terminal. - -@item C-t : -This allows you to execute a single ratpoison command. - -@item C-t ! -Run a shell command. - -@item C-t C-! -Run a shell command through an X terminal. - -@item C-t i -@item C-t C-i -Display information about the current window. - -@item C-t k -@item C-t C-k -Close the current window. - -@item C-t l -@item C-t C-l -Redisplay the current window. Sometimes windows don't respond correctly -to the initial maximize event and need some coaxing. This is a fancy way -of saying there are still bugs in ratpoison. @kbd{C-t l} will force the -current window to maximize. - -@item C-t m -@item C-t C-m -Display the last message. - -@item C-t v -@item C-t C-v -Display the version of ratpoison. - -@item C-t V -@item C-t C-V -Display ratpoison's license. - -@item C-t w -@item C-t C-w -Display the list of managed windows. The current window is highlighted. - -@item C-t s -@item C-t C-s -Split the current window horizontally in two. The last accessed window -not occupying a frame will be the second window. - -@item C-t S -@item C-t C-S -Split the current window vertically in two. The last accessed window not -occupying a frame will be the second window. - -@item C-t tab -Cycle through ratpoison's frames. - -@item C-t M-tab -Switch to the last focused frame. - -@item C-t Q -Kill all frames but the current one. - -@item C-t R -Kill the current frame. This is a no-op if there is only one frame. - -@item C-t r -@item C-t C-r -Resize the current frame. - -@item C-t b -@item C-t C-b -Banish the mouse to the lower right corner of the screen. - -@item C-t ? -Display a help screen. - -@item C-t f -@item C-t C-f -select a frame by number. - -@item C-t F -Indicate which frame is the current frame. - -@item C-t Down -Move to the frame below the current frame. - -@item C-t Left -Move to the frame left of the current frame. - -@item C-t Right -Move to the frame right of the current frame. - -@item C-t Up -Move to the frame above the current frame. - -@item C-t C-Down -Exchange the window in the current frame with the window in the frame below it. - -@item C-t C-Left -Exchange the window in the current frame with the window in the frame to the left of it. - -@item C-t C-Right -Exchange the window in the current frame with the window in the frame to the rigth of it. - -@item C-t C-Up -Exchange the window in the current frame with the window in the frame above it. - -@item C-t x -@item C-t C-x -Choose a frame and exchange the window in the current frame with the -window in the chosen frame. - -@end table - -@node Hooks -@chapter Hooks - -One of the goals of ratpoison is to allow users to create exciting -customization to fit their specific needs. Hooks allow a user to latch -scripts onto certain events. - -Each hook contains a list of commands to be executed when the -appropriate event occurs in ratpoison. For example, if you want to warp -the rat to corner of the screen every time you press a top level bound -key, you could add this to you .ratpoisonrc file: - -@example -addhook key banish -@end example - -That should keep the rat out of your way. - -@deffn Command addhook @var{hook} @var{command} -Add a @var{command} to @var{hook}. When the hook is run, @var{command} -will be executed. - -The following hooks are available: - -@table @asis -@item key -Run when a top level key is pressed (by default the only top level key -is the prefix key). -@item switchwin -Run when the user switches to a different window in the current frame. -@item switchframe -Run when the user switches to another frame. This is also run when the -user switches to a different screen, since a frame switch also occurs. -@item switchgroup -Run when the user switches to a different group. -@item deletewindow -Run when a window is deleted. -@item newwindow -Run after a new window is mapped. -@item titlechanged -Run when the current window's title changes. -@item quit -Run when ratpoison exits. -@item restart -Run when ratpoison restarts. -@end table - -@end deffn - -@deffn Command remhook @var{hook} @var{command} -Remove @var{command} from the hook. See @command{addhook} for a list -of available hooks. -@end deffn - -@deffn Command listhook @var{hook} -List the commands that will be run when @var{hook} is fired. -@end deffn - -@node The Status Bar -@chapter The Status Bar - -ratpoison presents status and output through the status bar. By default -it is located in the top right corner of the screen. - -This chapter presents commands for manipulating the status bar. - -Since it is the only visible evidence that ratpoison is running (as -opposed to the invisible evidence including the lack of title bars and -your favorite desktop background) there are also copious visual -customizations available for those rainy days. - -@deffn Command msgwait @var{n} -Set the bar's timeout in seconds. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command lastmsg -Display the last message. -@end deffn - -@deffn Command echo @var{text} -Display @var{text} as a message. -@end deffn - -@deffn Command {set inputwidth} @var{n} -@c @deffnx Command definputwidth @var{n} -Set the width of the input window. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command {set font} @var{font} -@c @deffnx Command deffont @var{font} -Set the font. @var{font} is a font string like @samp{9x15bold}. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set framefmt} @var{fmt} -Set the text that appears when the @command{curframe} command is -called. @var{fmt} is a format string that accepts the same format -characters as @command{set winfmt}. -@end deffn - -@deffn Command {set fgcolor} @var{color} -@c @deffnx Command deffgcolor @var{color} -Set the foreground color for all text ratpoison displays. @var{color} -is any valid X11 color. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set bgcolor} @var{color} -@c @deffnx Command defbgcolor @var{color} -Set the background color for all text ratpoison displays. @var{color} -is any valid X11 color. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set fwcolor} @var{color} -Set the border color for the focused window. -is any valid X11 color. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set bwcolor} @var{color} -Set the border color for unfocused windows. -is any valid X11 color. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set barpadding} @var{x} @var{y} -@c @deffnx Command defbarpadding @var{x} @var{y} -Set the horizontal and vertical padding inside the bar. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command {set bargravity} @var{g} -@c @deffnx Command defbargravity @var{g} -Set the default alignment for the message bar. See the @command{gravity} command. - -When called with no arguments, the current setting is -returned. -@end deffn - - -@deffn Command {set barborder} @var{n} -@c @deffnx Command defbarborder @var{n} -Set the border width for the bar window. - -When called with no arguments, the current setting is returned. -@end deffn - - -@deffn Command {set barinpadding} @var{n} -@c @deffnx Command defbarinpadding @var{n} -Set whether the bar window appears at the edge of the screen when there is -padding -- that is, within the "padding" area -- or whether it appears at the -edge of the window area. "1" represents the former, "0" the latter. See the -@command{set padding} and @command{set bargravity} commands. - -When called with no arguments, the current setting is returned. -@end deffn - - -@node Using Other Window Managers -@chapter Using Other Window Managers - -There are times when a program has been so badly written that it is -virtually impossible to use under ratpoison. Some authors have tailored -their programs to certain window management paradigms so aggressively -that very little can be done. Ratpoison has two commands to help you -through these difficult times: @command{tmpwm} and @command{newwm}. - -These commands should be used sparingly. They were created to allow -users to understand how a poorly designed program is intended to -function so they can build a replacement or patch an existing -alternative's missing functionality. - -According to independant studies, @command{tmpwm} has been used almost -exclusively to verify its correct operation -- like a vintage sports -car: always kept in prime condition and never used. - -@command{tmpwm} and @command{newwm} are provided for boasting and -completeness. - -@deffn Command tmpwm @var{WM} -Gives control over to another window manager and regains control once -it has terminated. @var{WM} is the path to the new window -manager. This command is useful when you want to temporarily take a -look at another window manager, or program under a different window -manager, but you want to come back to ratpoison when you've finished -your investigation. -@end deffn - -@deffn Command newwm @var{window-manager} -This is a bad-bad command. It kills ratpoison and revives that -ugly rodent! Yuck! Avoid! -@end deffn - -@node Other Commands -@chapter Other Commands - -The following is a list of commands that don't fit in any existing -chapters. - -@deffn Command abort -This is a pretty useless command. By default, it is bound to @kbd{C-t -g} and its purpose is to abort the current chain of keystrokes (just -like @kbd{C-g} in @samp{Emacs}). -@end deffn - -@deffn Command alias @var{name} @var{command} -Allows you to name a ratpoison command something else. For -instance, if you frequently open emacs you may want to make an alias -called @samp{emacs} that loads emacs. You would do it like this: - -@example -alias emacs exec emacs -@end example - -An alias is treated exactly like a colon command in that you can call -it from the colon prompt, bind it to a key, and call it -non-interactively with @command{ratpoison -c}. -@end deffn - -@deffn Command banish -Banish the mouse to the lower right corner of the screen. -@end deffn - -@deffn Command banishrel -Banish the rat cursor to the lower right corner of the curren window. -If there isn't a window in the current frame, it banishes the rat cursor -to the lower right corner of the frame. -@end deffn - -@deffn Command chdir -Change the current directory for ratpoison. -@end deffn - -@deffn Command colon @var{command} -Run a ratpoison command. -@end deffn - -@deffn Command compat -Install the now obsolete @samp{def*} commands as aliases to the -corresponding @samp{set *} command. -@end deffn - -@deffn Command {set padding} @var{left} @var{top} @var{right} @var{bottom} -@c @deffnx Command defpadding @var{left} @var{top} @var{right} @var{bottom} -Set the padding around the edge of the screen. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set waitcursor} @var{n} -@c @deffnx Command defwaitcursor @var{n} -Set whether the rat cursor should change into a square when waiting -for a key. A non-zero number means change the cursor. Zero means don't -change the cursor. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set historysize} @var{n} -Set how many lines of history should be recorded. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set historcompaction} @var{bool} -Set whether to remove multiple equal lines from history, -even if not adjacent. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command {set historexpansion} @var{bool} -Set whether to expand ! using readline's libhistory in input. - -When called with no arguments, the current setting is returned. -@end deffn - -@deffn Command escape @var{key} -Set the prefix to @var{key}. For example @samp{escape C-b} sets the -prefix key to @key{C-b}. -@end deffn - -@deffn Command exchangedown -Exchange the current frame with the one below it. -@end deffn - -@deffn Command exchangeleft -Exchange the current frame with the one to the left of it. -@end deffn - -@deffn Command exchangeright -Exchange the current frame with the one to the right of it. -@end deffn - -@deffn Command exchangeup -Exchange the current frame with the one above it. -@end deffn - -@deffn Command exec @var{command} -Execute a shell command. By default, @kbd{C-t !} does this. -@end deffn - -@deffn Command execa @var{command} -Execute a shell command but don't record which frame it was executed -from. The client's windows will pop up in whatever frame is current. -@end deffn - -@deffn Command execf @var{frame} @var{command} -Execute a shell command and choose which frame the client's first -window will open in. The client must be netwm compliant for this to -work. -@end deffn - -@deffn Command getenv @var{env} -Display the value of the environment variable, @var{env}. -@end deffn - -@deffn Command getsel -Return the contents of the X11 selection. -@end deffn - -@deffn Command help -Display a help screen that lists all bound keystrokes. -@end deffn - -@deffn Command license -Display ratpoison's license. By default, this is bound to @kbd{C-t V}. -@end deffn - -@deffn Command meta @var{key} -@var{key} is an optional argument. When @var{key} is omitted, send a -@kbd{C-t} to the current window. Otherwise, send the key described by -@var{key} to the current window. Note that some applications by -default ignore the synthetic key that is sent using this command as it -is considered a security hole. xterm is one such application. - -For example, if your @samp{Emacs} window is focused, - -@example -meta M-x -@end example - -Would cause emacs to prompt for an extended command. -@end deffn - -@deffn Command prompt @var{prompt} -This command is only useful when called -non-interactively. @command{prompt} prompts the user for input using -@var{prompt} and returns the input. -@end deffn - -@deffn Command putsel @var{text} -Make text the X11 selection. -@end deffn - -@deffn Command quit -Quit ratpoison. -@end deffn - -@deffn Command ratinfo -Display the x y coordinates of the rat cursor relative to the screen. -@end deffn - -@deffn Command ratrelinfo -Display the x y coordinates of the rat cursor relative to the current window or current frame if no window is focused. -@end deffn - -@deffn Command ratrelwarp @var{x} @var{y} -Warp the rat to the specified location relative to the current rat -position. -@end deffn - -@deffn Command ratwarp @var{x} @var{y} -Warp the rat to the specified absolute location. -@end deffn - -@deffn Command ratclick @var{button} -click the rat. @var{button} is either 1, 2, or 3. @var{button} -defaults to button 1. -@end deffn - -@deffn Command rathold @var{state} @var{button} -click the rat button down if @var{state} is @samp{down} or release the button if @var{state} is @samp{up}. -@end deffn - -@deffn Command redisplay -Extend the current window to the whole size of its current frame and -redisplay it. This can be used to: - -@itemize @bullet -@item redisplay normal windows or bring transient windows to the full size of the frame as only normal windows are maximized by ratpoison. -@item fix xterms that didn't catch ratpoison's initial maximize event. -@end itemize - -@end deffn - -@deffn Command restart -Restart ratpoison. -@end deffn - -@deffn Command set @var{var} @var{value} -Set the value of a ratpoison variable. This command replaces the older -@samp{def*} variable get/set style. - -Here is a list of variables that can be set: - -@itemize @bullet -@item framesels -@item winliststyle -@item barpadding -@item bgcolor -@item fgcolor -@item winname -@item winfmt -@item waitcursor -@item inputwidth -@item barborder -@item border -@item padding -@item font -@item bargravity -@item maxsizegravity -@item transgravity -@item wingravity -@item maxundos -@item resizeunit -@item historysize -@item historycompaction -@item historyexpansion -@end itemize - -@end deffn - -@deffn Command setenv @var{env} @var{value} -Set the environment variable @var{env} to @var{value} -@end deffn - -@deffn Command source @var{file} -Read a text file containing ratpoison commands. -@end deffn - -@deffn Command startup_message @var{state} -Turn on or off the startup_message. This is most useful in your -.ratpoisonrc file. @var{state} can be @code{on} or @code{off}. - -When called with no arguments, the current setting is -returned. -@end deffn - -@deffn Command swap @var{destination-frame} @var{source-frame} -When called interactively prompt for a frame and swap its window with -the window in the current frame. An optional second argument allows -swapping of windows between arbitrary frames. -@end deffn - -@deffn Command time -Show current time in the status bar. -@end deffn - -@deffn Command unalias @var{name} -Remove @var{name} from the list of defined aliases. -@end deffn - -@deffn Command unsetenv @var{env} -Clear the value of the environment variable, @var{env}. -@end deffn - -@deffn Command verbexec @var{command} -Verbosely exec the shell command @var{command}. Raptoison displays a -message saying command was executed. -@end deffn - -@deffn Command version -Print ratpoison version. By default, this is bound to @kbd{C-t v}. -@end deffn - -@deffn Command warp @var{state} -Toggle rat warping. By default ratpoison saves the position of the -rat when leaving a window and when the user returns to the window the -rat's position is restored. This can be counter-intuitive, so you can -toggle it with this command. @var{state} can be @code{on} or @code{off}. -@end deffn - -@node Input -@chapter Input -At various times ratpoison will prompt you for input. Ratpoison sports -a fully featured line editor. The following table lists the keystrokes -and actions: - -@table @key -@item C-g -@itemx escape -abort the command requesting input. - -@item C-f -@itemx right arrow -move forward a character. - -@item C-b -@itemx left arrow -move backward a character. - -@item M-f -move forward a word. - -@item M-b -move backward a word. - -@item C-a -@itemx home -move to the beginning of the line. - -@item C-e -@itemx end -move to the end of the line. - -@item C-d -@itemx delete -delete the character at point. - -@item M-d -delete the word at point. -@item backspace -delete the character before the point. - -@item M-backspace -delete the word before the point. - -@item C-k -delete from the point to the end of the line. - -@item C-u -delete from the point to the beginning of the line. - -@item C-y -Yank the text from the X11 cut buffer. - -@item C-p -@itemx up arrow -Cycle backwards through the history (This command does nothing if -ratpoison was configured with the @code{--disable-history} configure -option). - -@item C-n -@itemx down arrow -Cycle forwards through the history (This command does nothing if -ratpoison was configured with the @code{--disable-history} configure -option). - -@item return -submit the line of text. - -@item tab -complete the text up to the point or if there are several possible -completions, cycle through them. This only works in certain -contexts. Tab completion will complete a shell command, a window name, -a group name, and colon commands in their appropriate context -(i.e. when being asked for a window name). - -@item S-iso-lefttab -This is shift + tab by the way. This does the same as tab, but cycles -backwards through the completions. - -@end table - -All input is stored in the same history list. By default ratpoison has -a history length of 100 entries. This history is saved to the file -@file{~/.ratpoison_history} and is loaded when you start -ratpoison. This means your history sticks between sessions. This -assumes history has not been disabled on compilation. - -@node Command Line Arguments -@chapter Command Line Arguments -ratpoison supports command line arguments to request various actions -when invoking ratpoison. - -@table @code -@item -h, --help -Display this help screen - -@item -v, --version -Display the version - -@item -d, --display -Specify the X display to connect to. - -@item -s, --screen -Specify the screen to use. By default ratpoison runs on all -screens. You can tell it to use just one with this option. - -@item -c, --command -Send ratpoison a colon-command. This allows you to control ratpoison -from the command-line. with the @option{-c} option you can script -ratpoison using any programming language that can spawn a -process. Some commands behave differently when invoked this -way. Currently the only commands that behaves differently are the -@code{windows} command and some def* commands. Instead of displaying -the window list in a message window, it is printed to stdout. The -output can then be captured and used in the ratpoison script. For -instance, this could be used to check whether a program is running and -if it is switch to its window otherwise launch it. - -It should also be noted that multiple @option{-c} options can be used. - -to facilitate writing scripts, the @env{RATPOISON} environment -variable is set to the full path of the ratpoison binary. - -@example -$ ratpoison -c split -c split -@end example - -Here ratpoison would split the current frame twice. - -@item -i, --interactive -Force ratpoison to execute commands in interactive mode. This is used -in conjunction with the @option{-c} option. - -@item -f, --file -Specify an alternate configuration file. @xref{Startup file}. - -@end table - -@node Startup file -@chapter Startup file - -Now you've probably read the web page, and you've no doubt dug up some -old file I forgot about. You're probably wondering, ``say, didn't he say -there was no configuration file to customize?''. Okay, ya got me. But let's -be honest here: ratpoison is so pure and fast-acting, customization is -barely worth the extra effort. In the off chance that you need to make -ratpoison your own, we now support it. - -On startup ratpoison looks for @file{~/.ratpoisonrc} and runs it through -the command parser. If @file{~/.ratpoisonrc} does not exist, ratpoison -tries @file{/etc/ratpoisonrc}. This means any command you can bind a key -to or run at the command prompt (@kbd{C-t :}) you can execute in this rc -file. - -You can also use the @option{-f} option to specify another startup -file, allowing you to switch between different configurations -(@pxref{Command Line Arguments}). - -@node GNU Free Documentation License -@chapter GNU Free Documentation License -@include fdl.texi - -@node Command Index -@unnumbered Command Index - -@printindex fn - -@bye diff --git a/doc/sample.ratpoisonrc b/doc/sample.ratpoisonrc deleted file mode 100644 index 786b576..0000000 --- a/doc/sample.ratpoisonrc +++ /dev/null @@ -1,58 +0,0 @@ -# This is a sample .ratpoisonrc file -# Copyright (C) 2003, 2004 Shawn Betts -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright - -# Set the prefix key to that of screen's default -escape C-a - -# Gets rid of that ugly crosshairs default cursor -# and set the background to black -exec xsetroot -solid black -cursor_name left_ptr - -# Emulate screen by starting with a new xterm -exec xterm - -# Bind e to our favorite editor -bind e exec emacs - -# bind s to interactively run a surfraw query on freshmeat -bind s colon exec xterm -e freshmeat - -# bind b (`b' for browse) to interactively ask for an URL to open -bind b colon exec mozilla http://www. - -# Use the name of the program rather than the title in the window list -defwinname name - -# bind M-! to store the current frame layout in slot #1 -bind M-exclam exec ratpoison -c "setenv fs1 `ratpoison -c 'fdump'`" - -#bind M-1 to restore the frame layout in slot #1 -bind M-1 exec ratpoison -c "frestore `ratpoison -c 'getenv fs1'`" - -# Do the same for slot #2 and bind it to M-@ and M-2, respectively. -bind M-at exec ratpoison -c "setenv fs2 `ratpoison -c 'fdump'`" -bind M-2 exec ratpoison -c "frestore `ratpoison -c 'getenv fs2'`" - -# Give ourselves another slot on M-# and M-3, respectively. -bind M-numbersign exec ratpoison -c "setenv fs3 `ratpoison -c 'fdump'`" -bind M-3 exec ratpoison -c "frestore `ratpoison -c 'getenv fs3'`" - -# Here's a hack from John Meacham: - -bind a exec ratpoison -d :0.0 -c "echo `date +'%r - %A %n %D - %B'` `cal | tail -n +2 | sed -e 's/^Su/\n\n Su/' -e 's/.*/ & /' -e \"s/\ $(date +%e)\ /\<$(date +%e)\>/\"`" - -# it produces output like the following in the message window, very handy: -# +-----------------------+ -# |05:05:24 PM - Tuesday | -# | 09/09/03 - September| -# | | -# |Su Mo Tu We Th Fr Sa | -# | 1 2 3 4 5 6 | -# | 7 8< 9>10 11 12 13 | -# |14 15 16 17 18 19 20 | -# |21 22 23 24 25 26 27 | -# |28 29 30 | -# +-----------------------+ diff --git a/m4/codeset.m4 b/m4/codeset.m4 deleted file mode 100644 index a53c042..0000000 --- a/m4/codeset.m4 +++ /dev/null @@ -1,21 +0,0 @@ -# codeset.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_DEFUN([AM_LANGINFO_CODESET], -[ - AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], - [AC_TRY_LINK([#include <langinfo.h>], - [char* cs = nl_langinfo(CODESET); return !cs;], - [am_cv_langinfo_codeset=yes], - [am_cv_langinfo_codeset=no]) - ]) - if test $am_cv_langinfo_codeset = yes; then - AC_DEFINE([HAVE_LANGINFO_CODESET], [1], - [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) - fi -]) diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 77cfffb..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -config.h -config.h.in -stamp-h1 -*.o -ratpoison diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index b4ce142..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -## Process this file with automake to produce Makefile.in -## Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> -## -## This file is part of ratpoison. -## -## ratpoison 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. -## -## ratpoison 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 -## -## $Id: Makefile.am,v 1.24 2006/11/21 17:03:31 brl Exp $ - -bin_PROGRAMS = ratpoison -MAINTAINERCLEANFILES = Makefile.in config.h.in - -AM_LDFLAGS=${X_LDFLAGS} -ratpoison_LDADD=${XFT_LIBS} ${X_LIBS} ${X_EXTRA_LIBS} ${HISTORY_LIBS} -AM_CPPFLAGS=${X_CFLAGS} ${XFT_CFLAGS} - -ratpoison_SOURCES = actions.c \ - actions.h \ - bar.c \ - bar.h \ - completions.c \ - completions.h \ - communications.c \ - communications.h \ - conf.h \ - data.h \ - editor.c \ - editor.h \ - events.c \ - events.h \ - format.c \ - format.h \ - frame.c \ - frame.h \ - getopt.c \ - getopt.h \ - getopt1.c \ - globals.h \ - globals.c \ - group.h \ - group.c \ - history.h \ - history.c \ - hook.c \ - hook.h \ - input.c \ - input.h \ - linkedlist.h \ - linkedlist.c \ - main.c \ - manage.c \ - manage.h \ - messages.h \ - number.c \ - number.h \ - ratpoison.h \ - sbuf.c \ - sbuf.h \ - screen.h \ - screen.c \ - split.c \ - split.h \ - window.c \ - window.h \ - xinerama.c \ - xinerama.h diff --git a/src/actions.c b/src/actions.c deleted file mode 100644 index d847fa7..0000000 --- a/src/actions.c +++ /dev/null @@ -1,6005 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <unistd.h> -#include <ctype.h> /* for isspace */ -#include <sys/wait.h> -#include <X11/keysym.h> -#include <string.h> -#include <strings.h> -#include <time.h> -#include <errno.h> -#include <signal.h> -#include <X11/Xproto.h> - -#include "ratpoison.h" - -#ifdef HAVE_LIBXTST -# include <X11/extensions/XTest.h> -#endif - - -#define ARG_STRING(elt) args[elt]->string -#define ARG(elt, type) args[elt]->arg.type - -struct set_var -{ - char *var; - cmdret *(*set_fn)(struct cmdarg **); - int nargs; - struct argspec *args; - struct list_head node; -}; - -static cmdret * set_resizeunit (struct cmdarg **args); -static cmdret * set_wingravity (struct cmdarg **args); -static cmdret * set_transgravity (struct cmdarg **args); -static cmdret * set_maxsizegravity (struct cmdarg **args); -static cmdret * set_bargravity (struct cmdarg **args); -static cmdret * set_font (struct cmdarg **args); -static cmdret * set_padding (struct cmdarg **args); -static cmdret * set_border (struct cmdarg **args); -static cmdret * set_barborder (struct cmdarg **args); -static cmdret * set_barinpadding (struct cmdarg **args); -static cmdret * set_inputwidth (struct cmdarg **args); -static cmdret * set_waitcursor (struct cmdarg **args); -static cmdret * set_winfmt (struct cmdarg **args); -static cmdret * set_winname (struct cmdarg **args); -static cmdret * set_framefmt (struct cmdarg **args); -static cmdret * set_fgcolor (struct cmdarg **args); -static cmdret * set_bgcolor (struct cmdarg **args); -static cmdret * set_fwcolor (struct cmdarg **args); -static cmdret * set_bwcolor (struct cmdarg **args); -static cmdret * set_barpadding (struct cmdarg **args); -static cmdret * set_winliststyle (struct cmdarg **args); -static cmdret * set_framesels (struct cmdarg **args); -static cmdret * set_maxundos (struct cmdarg **args); -static cmdret * set_infofmt (struct cmdarg **args); -static cmdret * set_topkmap (struct cmdarg **args); -static cmdret * set_historysize (struct cmdarg **args); -static cmdret * set_historycompaction (struct cmdarg **args); -static cmdret * set_historyexpansion (struct cmdarg **args); - -LIST_HEAD(set_vars); - -/* FIXME This variable should really be kept static for group.c */ -extern struct numset *group_numset; - -static void -add_set_var (char *name, cmdret * (*fn)(struct cmdarg **), int nargs, ...) -{ - int i = 0; - struct set_var *var; - va_list va; - - var = xmalloc (sizeof (struct set_var)); - var->var = name; - var->set_fn = fn; - var->nargs = nargs; - var->args = xmalloc(sizeof(struct argspec) * nargs); - - /* Fill var->args */ - va_start(va, nargs); - for (i=0; i<nargs; i++) - { - var->args[i].prompt = va_arg(va, char*); - var->args[i].type = va_arg(va, int); - } - va_end(va); - - list_add (&var->node, &set_vars); -} - -static void -set_var_free (struct set_var *var) -{ - if (var == NULL) - return; - free(var->args); - free(var); -} - -static void -init_set_vars(void) -{ - add_set_var ("resizeunit", set_resizeunit, 1, "", arg_NUMBER); - add_set_var ("maxundos", set_maxundos, 1, "", arg_NUMBER); - add_set_var ("wingravity", set_wingravity, 1, "", arg_GRAVITY); - add_set_var ("transgravity", set_transgravity, 1, "", arg_GRAVITY); - add_set_var ("maxsizegravity", set_maxsizegravity, 1, "", arg_GRAVITY); - add_set_var ("bargravity", set_bargravity, 1, "", arg_GRAVITY); - add_set_var ("font", set_font, 1, "", arg_STRING); - add_set_var ("padding", set_padding, 4, - "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER); - add_set_var ("border", set_border, 1, "", arg_NUMBER); - add_set_var ("barborder", set_barborder, 1, "", arg_NUMBER); - add_set_var ("barinpadding", set_barinpadding, 1, "", arg_NUMBER); - add_set_var ("inputwidth", set_inputwidth, 1, "", arg_NUMBER); - add_set_var ("waitcursor", set_waitcursor, 1, "", arg_NUMBER); - add_set_var ("winfmt", set_winfmt, 1, "", arg_REST); - add_set_var ("winname", set_winname, 1, "", arg_STRING); - add_set_var ("framefmt", set_framefmt, 1, "", arg_REST); - add_set_var ("fgcolor", set_fgcolor, 1, "", arg_STRING); - add_set_var ("bgcolor", set_bgcolor, 1, "", arg_STRING); - add_set_var ("fwcolor", set_fwcolor, 1, "", arg_STRING); - add_set_var ("bwcolor", set_bwcolor, 1, "", arg_STRING); - add_set_var ("barpadding", set_barpadding, 2, "", arg_NUMBER, "", arg_NUMBER); - add_set_var ("winliststyle", set_winliststyle, 1, "", arg_STRING); - add_set_var ("framesels", set_framesels, 1, "", arg_STRING); - add_set_var ("infofmt", set_infofmt, 1, "", arg_REST); - add_set_var ("topkmap", set_topkmap, 1, "", arg_STRING); - add_set_var ("historysize", set_historysize, 1, "", arg_NUMBER); - add_set_var ("historycompaction", set_historycompaction, 1, "", arg_NUMBER); - add_set_var ("historyexpansion", set_historyexpansion, 1, "", arg_NUMBER); -} - -/* rp_keymaps is ratpoison's list of keymaps. */ -LIST_HEAD(rp_keymaps); -LIST_HEAD(user_commands); - -/* i_nrequired is the number required when called - interactively. ni_nrequired is when called non-interactively. */ -static void -add_command (char *name, cmdret * (*fn)(int, struct cmdarg **), int nargs, int i_nrequired, int ni_nrequired, ...) -{ - int i = 0; - struct user_command *cmd; - va_list va; - - cmd = xmalloc (sizeof (struct user_command)); - cmd->name = name; - cmd->func = fn; - cmd->num_args = nargs; - cmd->ni_required_args = ni_nrequired; - cmd->i_required_args = i_nrequired; - cmd->args = xmalloc(sizeof(struct argspec) * nargs); - - /* Fill cmd->args */ - va_start(va, ni_nrequired); - for (i=0; i<nargs; i++) - { - cmd->args[i].prompt = va_arg(va, char*); - cmd->args[i].type = va_arg(va, int); - } - va_end(va); - - list_add (&cmd->node, &user_commands); -} - -static void -user_command_free(struct user_command *cmd) -{ - if (cmd == NULL ) - return; - - free(cmd->args); - free(cmd); -} - -void -init_user_commands(void) -{ - /*@begin (tag required for genrpbindings) */ - add_command ("abort", cmd_abort, 0, 0, 0); - add_command ("addhook", cmd_addhook, 2, 2, 2, - "Hook: ", arg_HOOK, - "Command: ", arg_COMMAND); - add_command ("alias", cmd_alias, 2, 2, 2, - "Alias: ", arg_STRING, - "Command: ", arg_COMMAND); - add_command ("banish", cmd_banish, 0, 0, 0); - add_command ("chdir", cmd_chdir, 1, 0, 0, - "Dir: ", arg_REST); - add_command ("clrunmanaged", cmd_clrunmanaged, 0, 0, 0); - add_command ("colon", cmd_colon, 1, 0, 0, - "", arg_REST); - add_command ("curframe", cmd_curframe, 0, 0, 0); - add_command ("definekey", cmd_definekey, 3, 3, 3, - "Keymap: ", arg_KEYMAP, - "Key: ", arg_KEY, - "Command: ", arg_COMMAND); - add_command ("undefinekey", cmd_undefinekey, 2, 2, 2, - "Keymap: ", arg_KEYMAP, - "Key: ", arg_KEY); - add_command ("delete", cmd_delete, 0, 0, 0); - add_command ("delkmap", cmd_delkmap, 1, 1, 1, - "Keymap: ", arg_KEYMAP); - add_command ("echo", cmd_echo, 1, 1, 1, - "Echo: ", arg_RAW); - add_command ("escape", cmd_escape, 1, 1, 1, - "Key: ", arg_KEY); - add_command ("exec", cmd_exec, 1, 1, 1, - "/bin/sh -c ", arg_SHELLCMD); - add_command ("execa", cmd_execa, 1, 1, 1, - "/bin/sh -c ", arg_SHELLCMD); - add_command ("execf", cmd_execf, 2, 2, 2, - "frame to execute in:", arg_FRAME, - "/bin/sh -c ", arg_SHELLCMD); - add_command ("fdump", cmd_fdump, 1, 0, 0, - "", arg_NUMBER); - add_command ("focus", cmd_next_frame, 0, 0, 0); - add_command ("focusprev", cmd_prev_frame, 0, 0, 0); - add_command ("focusdown", cmd_focusdown, 0, 0, 0); - add_command ("exchangeup", cmd_exchangeup, 0, 0, 0); - add_command ("exchangedown", cmd_exchangedown, 0, 0, 0); - add_command ("exchangeleft", cmd_exchangeleft, 0, 0, 0); - add_command ("exchangeright", cmd_exchangeright, 0, 0, 0); - add_command ("swap", cmd_swap, 2, 1, 1, - "destination frame: ", arg_FRAME, - "source frame: ", arg_FRAME); - add_command ("focuslast", cmd_focuslast, 0, 0, 0); - add_command ("focusleft", cmd_focusleft, 0, 0, 0); - add_command ("focusright", cmd_focusright, 0, 0, 0); - add_command ("focusup", cmd_focusup, 0, 0, 0); - add_command ("frestore", cmd_frestore, 1, 1, 1, - "Frames: ", arg_REST); - add_command ("fselect", cmd_fselect, 1, 1, 1, - "", arg_FRAME); - add_command ("gdelete", cmd_gdelete, 1, 0, 0, - "Group:", arg_GROUP); - add_command ("getenv", cmd_getenv, 1, 1, 1, - "Variable: ", arg_STRING); - add_command ("gmerge", cmd_gmerge, 1, 1, 1, - "Group: ", arg_GROUP); - add_command ("gmove", cmd_gmove, 1, 1, 1, - "Group: ", arg_GROUP); - add_command ("gnew", cmd_gnew, 1, 1, 1, - "Name: ", arg_STRING); - add_command ("gnewbg", cmd_gnewbg, 1, 1, 1, - "Name: ", arg_STRING); - add_command ("gnumber", cmd_gnumber, 2, 1, 1, - "Number: ", arg_NUMBER, - "Number: ", arg_NUMBER); - add_command ("grename", cmd_grename, 1, 1, 1, - "Change group name to: ", arg_REST); - add_command ("gnext", cmd_gnext, 0, 0, 0); - add_command ("gprev", cmd_gprev, 0, 0, 0); - add_command ("gother", cmd_gother, 0, 0, 0); - add_command ("gravity", cmd_gravity, 1, 0, 0, - "Gravity: ", arg_GRAVITY); - add_command ("groups", cmd_groups, 0, 0, 0); - add_command ("gselect", cmd_gselect, 1, 1, 1, - "Group: ", arg_GROUP); - add_command ("help", cmd_help, 1, 0, 0, - "Keymap: ", arg_KEYMAP); - add_command ("hsplit", cmd_h_split, 1, 0, 0, - "Split: ", arg_STRING); - add_command ("info", cmd_info, 1, 0, 0, - "Format: ", arg_REST); - add_command ("kill", cmd_kill, 0, 0, 0); - add_command ("lastmsg", cmd_lastmsg, 0, 0, 0); - add_command ("license", cmd_license, 0, 0, 0); - add_command ("link", cmd_link, 2, 1, 1, - "Key: ", arg_STRING, - "Keymap: ", arg_KEYMAP); - add_command ("listhook", cmd_listhook, 1, 1, 1, - "Hook: ", arg_HOOK); - add_command ("meta", cmd_meta, 1, 0, 0, - "key: ", arg_KEY); - add_command ("msgwait", cmd_msgwait, 1, 0, 0, - "", arg_NUMBER); - add_command ("newkmap", cmd_newkmap, 1, 1, 1, - "Keymap: ", arg_STRING); - add_command ("newwm", cmd_newwm, 1, 1, 1, - "Switch to wm: ", arg_REST); - add_command ("next", cmd_next, 0, 0, 0); - add_command ("nextscreen", cmd_nextscreen, 0, 0, 0); - add_command ("number", cmd_number, 2, 1, 1, - "Number: ", arg_NUMBER, - "Number: ", arg_NUMBER); - add_command ("only", cmd_only, 0, 0, 0); - add_command ("other", cmd_other, 0, 0, 0); - add_command ("prev", cmd_prev, 0, 0, 0); - add_command ("prevscreen", cmd_prevscreen, 0, 0, 0); - add_command ("quit", cmd_quit, 0, 0, 0); - add_command ("ratinfo", cmd_ratinfo, 0, 0, 0); - add_command ("ratrelinfo", cmd_ratrelinfo, 0, 0, 0); - add_command ("banishrel", cmd_banishrel, 0, 0, 0); - add_command ("ratwarp", cmd_ratwarp, 2, 2, 2, - "X: ", arg_NUMBER, - "Y: ", arg_NUMBER); - add_command ("ratrelwarp", cmd_ratrelwarp, 2, 2, 2, - "X: ", arg_NUMBER, - "Y: ", arg_NUMBER); - add_command ("ratclick", cmd_ratclick, 1, 0, 0, - "Button: ", arg_NUMBER); - add_command ("rathold", cmd_rathold, 2, 1, 1, - "State: ", arg_STRING, - "Button: ", arg_NUMBER); - add_command ("readkey", cmd_readkey, 1, 1, 1, - "Keymap: ", arg_KEYMAP); - add_command ("redisplay", cmd_redisplay, 0, 0, 0); - add_command ("remhook", cmd_remhook, 2, 2, 2, - "Hook: ", arg_HOOK, - "Command: ", arg_COMMAND); - add_command ("remove", cmd_remove, 0, 0, 0); - add_command ("resize", cmd_resize, 2, 0, 2, - "", arg_NUMBER, - "", arg_NUMBER); - add_command ("restart", cmd_restart, 0, 0, 0); - add_command ("rudeness", cmd_rudeness, 1, 0, 0, - "Rudeness: ", arg_NUMBER); - add_command ("select", cmd_select, 1, 0, 1, - "Select window: ", arg_REST); - add_command ("set", cmd_set, 2, 0, 0, - "", arg_VARIABLE, - "", arg_REST); - add_command ("setenv", cmd_setenv, 2, 2, 2, - "Variable: ", arg_STRING, - "Value: ", arg_REST); - add_command ("shrink", cmd_shrink, 0, 0, 0); - add_command ("sfrestore", cmd_sfrestore, 1, 1, 1, - "Frames: ", arg_REST); - add_command ("source", cmd_source, 1, 1, 1, - "File: ", arg_REST); - add_command ("sselect", cmd_sselect, 1, 1, 1, - "Screen: ", arg_NUMBER); - add_command ("startup_message", cmd_startup_message, 1, 1, 1, - "Startup message: ", arg_STRING); - add_command ("time", cmd_time, 0, 0, 0); - add_command ("title", cmd_rename, 1, 1, 1, - "Set window's title to: ", arg_REST); - add_command ("tmpwm", cmd_tmpwm, 1, 1, 1, - "Tmp wm: ", arg_REST); - add_command ("unalias", cmd_unalias, 1, 1, 1, - "Alias: ", arg_STRING); - add_command ("unmanage", cmd_unmanage, 1, 1, 0, - "Unmanage: ", arg_REST); - add_command ("unsetenv", cmd_unsetenv, 1, 1, 1, - "Variable: ", arg_STRING); - add_command ("verbexec", cmd_verbexec, 1, 1, 1, - "/bin/sh -c ", arg_SHELLCMD); - add_command ("version", cmd_version, 0, 0, 0); - add_command ("vsplit", cmd_v_split, 1, 0, 0, - "Split: ", arg_STRING); - add_command ("warp", cmd_warp, 1, 1, 1, - "Warp State: ", arg_STRING); - add_command ("windows", cmd_windows, 1, 0, 0, - "", arg_REST); - add_command ("cnext", cmd_cnext, 0, 0, 0); - add_command ("cother", cmd_cother, 0, 0, 0); - add_command ("cprev", cmd_cprev, 0, 0, 0); - add_command ("dedicate", cmd_dedicate, 1, 0, 0, - "", arg_NUMBER); - add_command ("describekey", cmd_describekey, 1, 1, 1, - "Keymap: ", arg_KEYMAP); - add_command ("inext", cmd_inext, 0, 0, 0); - add_command ("iother", cmd_iother, 0, 0, 0); - add_command ("iprev", cmd_iprev, 0, 0, 0); - add_command ("prompt", cmd_prompt, 1, 0, 0, - "", arg_REST); - add_command ("sdump", cmd_sdump, 0, 0, 0); - add_command ("sfdump", cmd_sfdump, 0, 0, 0); - add_command ("undo", cmd_undo, 0, 0, 0); - add_command ("redo", cmd_redo, 0, 0, 0); - add_command ("putsel", cmd_putsel, 1, 1, 1, - "Text: ", arg_RAW); - add_command ("getsel", cmd_getsel, 0, 0, 0); - add_command ("compat", cmd_compat, 0, 0, 0); - /*@end (tag required for genrpbindings) */ - - /* Commands to help debug ratpoison. */ -#ifdef DEBUG -#endif - - /* the following screen commands may or may not be able to be - implemented. See the screen documentation for what should be - emulated with these commands */ -#if 0 - add_command ("msgminwait", cmd_unimplemented, 0); - add_command ("nethack", cmd_unimplemented, 0); - add_command ("sleep", cmd_unimplemented, 0); - add_command ("stuff", cmd_unimplemented, 0); -#endif - - init_set_vars(); -} - -typedef struct -{ - char *name; - char *alias; -} alias_t; - -static alias_t *alias_list; -static int alias_list_size; -static int alias_list_last; - -static cmdret* frestore (char *data, rp_screen *s); -static char* fdump (rp_screen *screen); - -/* Delete all entries in the redo list. */ -static void -clear_frame_redos (void) -{ - rp_frame_undo *cur; - struct list_head *tmp, *iter; - - list_for_each_safe_entry (cur, iter, tmp, &rp_frame_redos, node) - { - if (cur->frames) free (cur->frames); - list_del (&(cur->node)); - } -} - -void -del_frame_undo (rp_frame_undo *u) -{ - if (!u) return; - if (u->frames) free (u->frames); - list_del (&(u->node)); - free (u); -} - -static void -push_frame_undo(rp_screen *screen) -{ - rp_frame_undo *cur; - if (list_size (&rp_frame_undos) > defaults.maxundos) - { - /* Delete the oldest node */ - list_last (cur, &rp_frame_undos, node); - del_frame_undo (cur); - } - cur = xmalloc (sizeof(rp_frame_undo)); - cur->frames = fdump (screen); - cur->screen = screen; - list_add (&cur->node, &rp_frame_undos); - /* Since we're creating new frames the redo list is now invalid, so - clear it. */ - clear_frame_redos(); -} - -static rp_frame_undo * -pop_frame_list (struct list_head *undo_list, struct list_head *redo_list) -{ - rp_screen *screen = current_screen(); - rp_frame_undo *first, *new; - - /* Is there something to restore? */ - list_first (first, undo_list, node); - if (!first) - return NULL; - - /* First save the current layout into undo */ - new = xmalloc (sizeof(rp_frame_undo)); - new->frames = fdump (screen); - new->screen = screen; - list_add (&new->node, redo_list); - - list_del (&(first->node)); - return first; -} - -/* Pop the head of the frame undo list off and put it in the redo list. */ -static rp_frame_undo * -pop_frame_undo (void) -{ - return pop_frame_list (&rp_frame_undos, &rp_frame_redos); -} - -/* Pop the head of the frame redo list off and put it in the undo list. */ -static rp_frame_undo * -pop_frame_redo (void) -{ - return pop_frame_list (&rp_frame_redos, &rp_frame_undos); -} - -rp_action* -find_keybinding_by_action (char *action, rp_keymap *map) -{ - int i; - - for (i=0; i<map->actions_last; i++) - { - if (!strcmp (map->actions[i].data, action)) - { - return &map->actions[i]; - } - } - - return NULL; -} - -rp_action* -find_keybinding (KeySym keysym, unsigned int state, rp_keymap *map) -{ - int i; - for (i = 0; i < map->actions_last; i++) - { - if (map->actions[i].key == keysym - && map->actions[i].state == state) - return &map->actions[i]; - } - return NULL; -} - -static char * -find_command_by_keydesc (char *desc, rp_keymap *map) -{ - int i = 0; - char *keysym_name; - - while (i < map->actions_last) - { - keysym_name = keysym_to_string (map->actions[i].key, map->actions[i].state); - if (!strcmp (keysym_name, desc)) - { - free (keysym_name); - return map->actions[i].data; - } - free (keysym_name); - i++; - } - - return NULL; -} - -static char * -resolve_command_from_keydesc (char *desc, int depth, rp_keymap *map) -{ - char *cmd, *c; - - c = find_command_by_keydesc (desc, map); - if (!c) - return NULL; - - /* is it a link? */ - if (strncmp (c, "link", 4) || depth > MAX_LINK_DEPTH) - /* it is not */ - return c; - - cmd = resolve_command_from_keydesc (&c[5], depth + 1, map); - return (cmd != NULL) ? cmd : c; -} - - -static void -add_keybinding (KeySym keysym, int state, char *cmd, rp_keymap *map) -{ - if (map->actions_last >= map->actions_size) - { - /* double the key table size */ - map->actions_size *= 2; - map->actions = (rp_action*) xrealloc (map->actions, sizeof (rp_action) * map->actions_size); - PRINT_DEBUG (("realloc()ed key_table %d\n", map->actions_size)); - } - - map->actions[map->actions_last].key = keysym; - map->actions[map->actions_last].state = state; - /* free this on shutdown, or re/unbinding */ - map->actions[map->actions_last].data = xstrdup (cmd); - - map->actions_last++; -} - -static void -replace_keybinding (rp_action *key_action, char *newcmd) -{ - if (strlen (key_action->data) < strlen (newcmd)) - key_action->data = (char*) realloc (key_action->data, strlen (newcmd) + 1); - - strcpy (key_action->data, newcmd); -} - -static int -remove_keybinding (KeySym keysym, unsigned int state, rp_keymap *map) -{ - int i; - int found = -1; - - for (i=0; i<map->actions_last; i++) - { - if (map->actions[i].key == keysym && map->actions[i].state == state) - { - found = i; - break; - } - } - - if (found >= 0) - { - free (map->actions[found].data); - - memmove (&map->actions[found], &map->actions[found+1], - sizeof (rp_action) * (map->actions_last - found - 1)); - map->actions_last--; - - return 1; - } - - return 0; -} - -static rp_keymap * -keymap_new (char *name) -{ - rp_keymap *map; - - /* All keymaps must have a name. */ - if (name == NULL) - return NULL; - - map = xmalloc (sizeof (rp_keymap)); - map->name = xstrdup (name); - map->actions_size = 1; - map->actions = (rp_action*) xmalloc (sizeof (rp_action) * map->actions_size); - map->actions_last = 0; - - return map; -} - -rp_keymap * -find_keymap (char *name) -{ - rp_keymap *cur; - - list_for_each_entry (cur, &rp_keymaps, node) - { - if (!strcmp (name, cur->name)) - { - return cur; - } - } - - return NULL; -} - -/* Search the alias table for a match. If a match is found, return its - index into the table. Otherwise return -1. */ -static int -find_alias_index (char *name) -{ - int i; - - for (i=0; i<alias_list_last; i++) - if (!strcmp (name, alias_list[i].name)) - return i; - - return -1; -} - -static void -add_alias (char *name, char *alias) -{ - int i; - - /* Are we updating an existing alias, or creating a new one? */ - i = find_alias_index (name); - if (i >= 0) - { - free (alias_list[i].alias); - alias_list[i].alias = xstrdup (alias); - } - else - { - if (alias_list_last >= alias_list_size) - { - alias_list_size *= 2; - alias_list = xrealloc (alias_list, sizeof (alias_t) * alias_list_size); - } - - alias_list[alias_list_last].name = xstrdup (name); - alias_list[alias_list_last].alias = xstrdup (alias); - alias_list_last++; - } -} - -void -initialize_default_keybindings (void) -{ - rp_keymap *map, *top; - - map = keymap_new (ROOT_KEYMAP); - list_add (&map->node, &rp_keymaps); - - top = keymap_new (defaults.top_kmap); - list_add (&top->node, &rp_keymaps); - - /* Initialive the alias list. */ - alias_list_size = 5; - alias_list_last = 0; - alias_list = xmalloc (sizeof (alias_t) * alias_list_size); - - prefix_key.sym = KEY_PREFIX; - prefix_key.state = MODIFIER_PREFIX; - - /* Add the prefix key to the top-level map. */ - add_keybinding (prefix_key.sym, prefix_key.state, "readkey " ROOT_KEYMAP, top); - - add_keybinding (prefix_key.sym, prefix_key.state, "other", map); - add_keybinding (prefix_key.sym, 0, "meta", map); - add_keybinding (XK_g, RP_CONTROL_MASK, "abort", map); - add_keybinding (XK_0, 0, "select 0", map); - add_keybinding (XK_1, 0, "select 1", map); - add_keybinding (XK_2, 0, "select 2", map); - add_keybinding (XK_3, 0, "select 3", map); - add_keybinding (XK_4, 0, "select 4", map); - add_keybinding (XK_5, 0, "select 5", map); - add_keybinding (XK_6, 0, "select 6", map); - add_keybinding (XK_7, 0, "select 7", map); - add_keybinding (XK_8, 0, "select 8", map); - add_keybinding (XK_9, 0, "select 9", map); - add_keybinding (XK_minus, 0, "select -", map); - add_keybinding (XK_A, 0, "title", map); - add_keybinding (XK_A, RP_CONTROL_MASK, "title", map); - add_keybinding (XK_K, 0, "kill", map); - add_keybinding (XK_K, RP_CONTROL_MASK, "kill", map); - add_keybinding (XK_Return, 0, "next", map); - add_keybinding (XK_Return, RP_CONTROL_MASK, "next", map); - add_keybinding (XK_a, 0, "time", map); - add_keybinding (XK_a, RP_CONTROL_MASK, "time", map); - add_keybinding (XK_b, 0, "banish", map); - add_keybinding (XK_b, RP_CONTROL_MASK, "banish", map); - add_keybinding (XK_c, 0, "exec " TERM_PROG, map); - add_keybinding (XK_c, RP_CONTROL_MASK, "exec " TERM_PROG, map); - add_keybinding (XK_colon, 0, "colon", map); - add_keybinding (XK_exclam, 0, "exec", map); - add_keybinding (XK_exclam, RP_CONTROL_MASK, "colon exec " TERM_PROG " -e ", map); - add_keybinding (XK_i, 0, "info", map); - add_keybinding (XK_i, RP_CONTROL_MASK, "info", map); - add_keybinding (XK_k, 0, "delete", map); - add_keybinding (XK_k, RP_CONTROL_MASK, "delete", map); - add_keybinding (XK_l, 0, "redisplay", map); - add_keybinding (XK_l, RP_CONTROL_MASK, "redisplay", map); - add_keybinding (XK_m, 0, "lastmsg", map); - add_keybinding (XK_m, RP_CONTROL_MASK, "lastmsg", map); - add_keybinding (XK_n, 0, "next", map); - add_keybinding (XK_n, RP_CONTROL_MASK, "next", map); - add_keybinding (XK_p, 0, "prev", map); - add_keybinding (XK_p, RP_CONTROL_MASK, "prev", map); - add_keybinding (XK_quoteright, 0, "select", map); - add_keybinding (XK_quoteright, RP_CONTROL_MASK, "select", map); - add_keybinding (XK_space, 0, "next", map); - add_keybinding (XK_space, RP_CONTROL_MASK, "next", map); - add_keybinding (XK_v, 0, "version", map); - add_keybinding (XK_v, RP_CONTROL_MASK, "version", map); - add_keybinding (XK_V, 0, "license", map); - add_keybinding (XK_V, RP_CONTROL_MASK, "license", map); - add_keybinding (XK_w, 0, "windows", map); - add_keybinding (XK_w, RP_CONTROL_MASK, "windows", map); - add_keybinding (XK_s, 0, "split", map); - add_keybinding (XK_s, RP_CONTROL_MASK, "split", map); - add_keybinding (XK_S, 0, "hsplit", map); - add_keybinding (XK_S, RP_CONTROL_MASK, "hsplit", map); - add_keybinding (XK_Tab, 0, "focus", map); - add_keybinding (XK_Tab, RP_META_MASK, "focuslast", map); - add_keybinding (XK_Left, RP_CONTROL_MASK, "exchangeleft", map); - add_keybinding (XK_Right, RP_CONTROL_MASK, "exchangeright", map); - add_keybinding (XK_Up, RP_CONTROL_MASK, "exchangeup", map); - add_keybinding (XK_Down, RP_CONTROL_MASK, "exchangedown", map); - add_keybinding (XK_Left, 0, "focusleft", map); - add_keybinding (XK_Right, 0, "focusright", map); - add_keybinding (XK_Up, 0, "focusup", map); - add_keybinding (XK_Down, 0, "focusdown", map); - add_keybinding (XK_Q, 0, "only", map); - add_keybinding (XK_R, 0, "remove", map); - add_keybinding (XK_f, 0, "fselect", map); - add_keybinding (XK_f, RP_CONTROL_MASK, "fselect", map); - add_keybinding (XK_F, 0, "curframe", map); - add_keybinding (XK_r, 0, "resize", map); - add_keybinding (XK_r, RP_CONTROL_MASK, "resize", map); - add_keybinding (XK_question, 0, "help " ROOT_KEYMAP, map); - add_keybinding (XK_underscore, RP_CONTROL_MASK, "undo", map); - add_keybinding (XK_u, 0, "undo", map); - add_keybinding (XK_u, RP_CONTROL_MASK, "undo", map); - add_keybinding (XK_U, 0, "redo", map); - add_keybinding (XK_x, 0, "swap", map); - add_keybinding (XK_x, RP_CONTROL_MASK, "swap", map); - add_keybinding (XK_N, 0, "nextscreen", map); - add_keybinding (XK_P, 0, "prevscreen", map); - - add_alias ("unbind", "undefinekey " ROOT_KEYMAP); - add_alias ("bind", "definekey " ROOT_KEYMAP); - add_alias ("split", "vsplit"); -} - -cmdret * -cmdret_new (int success, char *fmt, ...) -{ - cmdret *ret = xmalloc (sizeof (cmdret)); - va_list ap; - - ret->success = success; - - if (fmt) - { - va_start (ap, fmt); - ret->output = xvsprintf (fmt, ap); - va_end (ap); - } - else - ret->output = NULL; - - return ret; -} - -void -cmdret_free (cmdret *ret) -{ - if (ret->output) - free (ret->output); - free (ret); -} - -void -keymap_free (rp_keymap *map) -{ - int i; - - /* Free the data in the actions. */ - for (i=0; i<map->actions_last; i++) - { - free (map->actions[i].data); - } - - /* Free the map data. */ - free (map->actions); - free (map->name); - - /* ...and the map itself. */ - free (map); -} - -void -free_keymaps (void) -{ - rp_keymap *cur; - struct list_head *tmp, *iter; - - list_for_each_safe_entry (cur, iter, tmp, &rp_keymaps, node) - { - list_del (&cur->node); - keymap_free (cur); - } -} - -void -free_aliases (void) -{ - int i; - - /* Free the alias data. */ - for (i=0; i<alias_list_last; i++) - { - free (alias_list[i].name); - free (alias_list[i].alias); - } - - /* Free the alias list. */ - free (alias_list); -} - -void -free_user_commands (void) -{ - struct user_command *cur; - struct set_var *var; - struct list_head *tmp, *iter; - - list_for_each_safe_entry (cur, iter, tmp, &user_commands, node) - { - list_del (&cur->node); - user_command_free (cur); - } - list_for_each_safe_entry (var, iter, tmp, &set_vars, node) - { - list_del (&var->node); - set_var_free (var); - } -} - -/* return a KeySym from a string that contains either a hex value or - an X keysym description */ -static int string_to_keysym (char *str) -{ - int retval; - int keysym; - - retval = sscanf (str, "0x%x", &keysym); - - if (!retval || retval == EOF) - keysym = XStringToKeysym (str); - - return keysym; -} - -/* Parse a key description. 's' is, naturally, the key description. */ -static cmdret * -parse_keydesc (char *s, struct rp_key *key) -{ - char *token, *next_token, *keydesc; - - if (s == NULL) - return NULL; - - /* Avoid mangling s. */ - keydesc = xstrdup (s); - - key->state = 0; - key->sym = 0; - - if (!strchr (keydesc, '-')) - { - /* Its got no hyphens in it, so just grab the keysym */ - key->sym = string_to_keysym (keydesc); - - if (key->sym == NoSymbol) - { - cmdret *ret = cmdret_new (RET_FAILURE, "parse_keydesc: Unknown key '%s'", keydesc); - free (keydesc); - return ret; - } - } - else if (keydesc[strlen (keydesc) - 1] == '-') - { - /* A key description can't end in a -. */ - free (keydesc); - return cmdret_new (RET_FAILURE, "parse_keydesc: Can't parse key '%s'", s); - } - else - { - /* Its got hyphens, so parse out the modifiers and keysym */ - token = strtok (keydesc, "-"); - - if (token == NULL) - { - /* It was nothing but hyphens */ - free (keydesc); - return cmdret_new (RET_FAILURE, "parse_keydesc: Can't parse key '%s'", s); - } - - do - { - next_token = strtok (NULL, "-"); - - if (next_token == NULL) - { - /* There is nothing more to parse and token contains the - keysym name. */ - key->sym = string_to_keysym (token); - - if (key->sym == NoSymbol) - { - cmdret *ret = cmdret_new (RET_FAILURE, "parse_keydesc: Unknown key '%s'", token); - free (keydesc); - return ret; - } - } - else - { - /* Which modifier is it? Only accept modifiers that are - present. ie don't accept a hyper modifier if the keymap - has no hyper key. */ - if (!strcmp (token, "C")) - { - key->state |= RP_CONTROL_MASK; - } - else if (!strcmp (token, "M")) - { - key->state |= RP_META_MASK; - } - else if (!strcmp (token, "A")) - { - key->state |= RP_ALT_MASK; - } - else if (!strcmp (token, "S")) - { - key->state |= RP_SHIFT_MASK; - } - else if (!strcmp (token, "s")) - { - key->state |= RP_SUPER_MASK; - } - else if (!strcmp (token, "H")) - { - key->state |= RP_HYPER_MASK; - } - else - { - free (keydesc); - return cmdret_new (RET_FAILURE, "parse_keydesc: Unknown modifier '%s'", token); - } - } - - token = next_token; - } while (next_token != NULL); - } - - /* Successfully parsed the key. */ - free (keydesc); - return NULL; -} - -static void -grab_rat (void) -{ - XGrabPointer (dpy, current_screen()->root, True, 0, - GrabModeAsync, GrabModeAsync, - None, current_screen()->rat, CurrentTime); -} - -static void -ungrab_rat (void) -{ - XUngrabPointer (dpy, CurrentTime); -} - -/* Unmanage window */ -cmdret * -cmd_unmanage (int interactive, struct cmdarg **args) -{ - if (args[0] == NULL && !interactive) - { - cmdret *ret; - char *s = list_unmanaged_windows(); - - if (s) - ret = cmdret_new (RET_SUCCESS, "%s", s); - else - ret = cmdret_new (RET_SUCCESS, NULL); - - free (s); - return ret; - } - - if (args[0]) - add_unmanaged_window(ARG_STRING(0)); - else - return cmdret_new (RET_FAILURE, "unmanage: at least one argument required"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Clear the unmanaged window list */ -cmdret * -cmd_clrunmanaged (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - clear_unmanaged_list(); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_undefinekey (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret = NULL; - rp_keymap *map; - struct rp_key *key; - - map = ARG (0, keymap); - key = ARG (1, key); - - /* If we're updating the top level map, we'll need to update the - keys grabbed. */ - if (map == find_keymap (defaults.top_kmap)) - ungrab_keys_all_wins (); - - /* If no comand is specified, then unbind the key. */ - if (!remove_keybinding (key->sym, key->state, map)) - ret = cmdret_new (RET_FAILURE, "undefinekey: key '%s' is not bound", ARG_STRING(1)); - - /* Update the grabbed keys. */ - if (map == find_keymap (defaults.top_kmap)) - grab_keys_all_wins (); - XSync (dpy, False); - - if (ret) - return ret; - else - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_definekey (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret = NULL; - rp_keymap *map; - struct rp_key *key; - char *cmd; - rp_action *key_action; - - map = ARG(0,keymap); - key = ARG(1,key); - cmd = ARG_STRING(2); - - /* If we're updating the top level map, we'll need to update the - keys grabbed. */ - if (map == find_keymap (defaults.top_kmap)) - ungrab_keys_all_wins (); - - if ((key_action = find_keybinding (key->sym, key->state, map))) - replace_keybinding (key_action, cmd); - else - add_keybinding (key->sym, key->state, cmd, map); - - /* Update the grabbed keys. */ - if (map == find_keymap (defaults.top_kmap)) - grab_keys_all_wins (); - XSync (dpy, False); - - if (ret) - return ret; - else - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_unimplemented (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - return cmdret_new (RET_FAILURE, "FIXME: unimplemented command"); -} - -cmdret * -cmd_source (int interactive UNUSED, struct cmdarg **args) -{ - FILE *fileptr; - - if ((fileptr = fopen (ARG_STRING(0), "r")) == NULL) - return cmdret_new (RET_FAILURE, "source: %s : %s", ARG_STRING(0), strerror(errno)); - else - { - set_close_on_exec (fileptr); - read_rc_file (fileptr); - fclose (fileptr); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_meta (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret = NULL; - struct rp_key key; - XEvent ev; - - if (current_window() == NULL) - return cmdret_new (RET_FAILURE, NULL); - - ev.xkey.type = KeyPress; - ev.xkey.display = dpy; - ev.xkey.window = current_window()->w; - - if (args[0]) - { - if((ret = parse_keydesc (ARG_STRING(0), &key))) - return ret; - - ev.xkey.state = rp_mask_to_x11_mask (key.state); - if(!(ev.xkey.keycode = XKeysymToKeycode (dpy, key.sym))) - return cmdret_new (RET_FAILURE, "meta: Couldn't convert keysym to keycode"); - } - else - { - ev.xkey.state = rp_mask_to_x11_mask (prefix_key.state); - ev.xkey.keycode = XKeysymToKeycode (dpy, prefix_key.sym); - } - XSendEvent (dpy, current_window()->w, False, KeyPressMask, &ev); - - /* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, 't'), True, 0); */ - - XSync (dpy, False); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_prev (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_window *cur, *win; - cur = current_window(); - win = group_prev_window (rp_current_group, cur); - - if (win) - set_active_window (win); - else if (cur) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); - else - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_MANAGED_WINDOWS); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_prev_frame (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - frame = find_frame_prev (current_frame()); - if (!frame) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_FRAME); - else - set_active_frame (frame, 0); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_next (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_window *cur, *win; - cur = current_window(); - win = group_next_window (rp_current_group, cur); - - if (win) - set_active_window (win); - else if (cur) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); - else - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_MANAGED_WINDOWS); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_next_frame (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - frame = find_frame_next (current_frame()); - if (!frame) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_FRAME); - else - set_active_frame (frame, 0); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_other (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_window *w; - -/* w = find_window_other (); */ - w = group_last_window (rp_current_group, current_screen()); - - if (!w) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); - else - set_active_window_force (w); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static int -string_to_window_number (char *str) -{ - int i; - char *s; - - for (i = 0, s = str; *s; s++) - { - if (*s < '0' || *s > '9') - break; - i = i * 10 + (*s - '0'); - } - - return *s ? -1 : i; -} - -static struct list_head * -trivial_completions (char* str UNUSED) -{ - struct list_head *list; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - return list; -} - -static struct list_head * -keymap_completions (char* str UNUSED) -{ - rp_keymap *cur; - struct list_head *list; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - list_for_each_entry (cur, &rp_keymaps, node) - { - struct sbuf *name; - - name = sbuf_new (0); - sbuf_copy (name, cur->name); - list_add_tail (&name->node, list); - } - - return list; -} - -static struct list_head * -window_completions (char* str UNUSED) -{ - rp_window_elem *cur; - struct list_head *list; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - /* Gather the names of all the windows. */ - list_for_each_entry (cur, &rp_current_group->mapped_windows, node) - { - struct sbuf *name; - - name = sbuf_new (0); - sbuf_copy (name, window_name (cur->win)); - list_add_tail (&name->node, list); - } - - return list; -} - -/* switch to window number or name */ -cmdret * -cmd_select (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret = NULL; - char *str; - int n; - - /* FIXME: This is manually done because of the kinds of things - select accepts. */ - if (args[0] == NULL) - str = get_input (MESSAGE_PROMPT_SWITCH_TO_WINDOW, hist_SELECT, - window_completions); - else - str = xstrdup (ARG_STRING(0)); - - /* User aborted. */ - if (str == NULL) - return cmdret_new (RET_FAILURE, NULL); - - /* Only search if the string contains something to search for. */ - if (strlen (str) > 0) - { - if (strlen (str) == 1 && str[0] == '-') - { - blank_frame (current_frame()); - ret = cmdret_new (RET_SUCCESS, NULL); - } - /* try by number */ - else if ((n = string_to_window_number (str)) >= 0) - { - rp_window_elem *elem = group_find_window_by_number (rp_current_group, n); - - if (elem) - { - goto_window (elem->win); - ret = cmdret_new (RET_SUCCESS, NULL); - } - else - { - /* show the window list as feedback */ - show_bar (current_screen (), defaults.window_fmt); - ret = cmdret_new (RET_FAILURE, - "select: unknown window number '%d'", n); - } - } - else - /* try by name */ - { - rp_window *win = find_window_name (str); - - if (win) - { - goto_window (win); - ret = cmdret_new (RET_SUCCESS, NULL); - } - else - ret = cmdret_new (RET_FAILURE, "select: unknown window '%s'", str); - } - } - else - /* Silently fail, since the user didn't provide a window spec */ - ret = cmdret_new (RET_SUCCESS, NULL); - - free (str); - - return ret; -} - -cmdret * -cmd_rename (int interactive UNUSED, struct cmdarg **args) -{ - if (current_window() == NULL) - return cmdret_new (RET_FAILURE, NULL); - - free (current_window()->user_name); - current_window()->user_name = xstrdup (ARG_STRING(0)); - current_window()->named = 1; - hook_run (&rp_title_changed_hook); - - /* Update the program bar. */ - update_window_names (current_screen(), defaults.window_fmt); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_delete (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - XEvent ev; - int status; - - if (current_window() == NULL) - return cmdret_new (RET_FAILURE, NULL); - - ev.xclient.type = ClientMessage; - ev.xclient.window = current_window()->w; - ev.xclient.message_type = wm_protocols; - ev.xclient.format = 32; - ev.xclient.data.l[0] = wm_delete; - ev.xclient.data.l[1] = CurrentTime; - - status = XSendEvent(dpy, current_window()->w, False, 0, &ev); - if (status == 0) - PRINT_DEBUG (("Delete window failed\n")); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_kill (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - if (current_window() == NULL) - return cmdret_new (RET_FAILURE, NULL); - - if (XKillClient(dpy, current_window()->w) == BadValue) - { - return cmdret_new (RET_FAILURE, - "kill failed (got BadValue, this may be a bug)"); - } - else - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_version (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - return cmdret_new (RET_SUCCESS, "%s", PACKAGE " " VERSION " (built " __DATE__ " " __TIME__ ")"); -} - -static char * -frame_selector (unsigned int n) -{ - if (n < strlen (defaults.frame_selectors)) - { - return xsprintf (" %c ", defaults.frame_selectors[n]); - } - else - { - return xsprintf (" %d ", n); - } -} - -/* Return true if ch is nth frame selector. */ -static int -frame_selector_match (char ch) -{ - size_t i; - - /* Is it in the frame selector string? */ - for (i=0; i<strlen (defaults.frame_selectors); i++) - { - if (ch == defaults.frame_selectors[i]) - return i; - } - - /* Maybe it's a number less than 9 and the frame selector doesn't - define that many selectors. */ - if (ch >= '0' && ch <= '9' - && (size_t)(ch - '0') >= strlen (defaults.frame_selectors)) - { - return ch - '0'; - } - - return -1; -} - -static cmdret * -read_string (struct argspec *spec, struct sbuf *s, int history_id, completion_fn fn, struct cmdarg **arg) -{ - char *input; - - if (s) - input = xstrdup (sbuf_get(s)); - else - input = get_input (spec->prompt, history_id, fn); - - if (input) - { - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = spec->type; - (*arg)->string = input; - return NULL; - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -read_keymap (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - if (s) - input = xstrdup (sbuf_get (s)); - else - input = get_input (spec->prompt, hist_KEYMAP, keymap_completions); - - if (input) - { - rp_keymap *map; - map = find_keymap (input); - if (map == NULL) - { - cmdret *ret = cmdret_new (RET_FAILURE, "unknown keymap '%s'", input); - free (input); - return ret; - } - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = spec->type; - (*arg)->arg.keymap = map; - (*arg)->string = input; - return NULL; - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -read_keydesc (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - if (s) - input = xstrdup (sbuf_get (s)); - else - input = get_input (spec->prompt, hist_KEY, trivial_completions); - - if (input) - { - cmdret *ret; - struct rp_key *key = xmalloc (sizeof(struct rp_key)); - ret = parse_keydesc (input, key); - if (ret) { - free (key); - return ret; - } - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = spec->type; - (*arg)->arg.key = key; - (*arg)->string = input; - return NULL; - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static struct list_head * -group_completions (char *str UNUSED) -{ - struct list_head *list; - rp_group *cur; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - /* Grab all the group names. */ - list_for_each_entry (cur, &rp_groups, node) - { - struct sbuf *s; - - s = sbuf_new (0); - /* A group may not have a name, so if it doesn't, use it's - number. */ - if (cur->name) - { - sbuf_copy (s, cur->name); - } - else - { - sbuf_printf (s, "%d", cur->number); - } - - list_add_tail (&s->node, list); - } - - return list; -} - -static struct list_head * -colon_completions (char* str UNUSED) -{ - int i; - struct user_command *uc; - struct sbuf *s; - struct list_head *list; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - /* Put all the aliases in our list. */ - for(i=0; i<alias_list_last; ++i) - { - s = sbuf_new (0); - sbuf_copy (s, alias_list[i].name); - /* The space is so when the user completes a space is - conveniently inserted after the command. */ - sbuf_concat (s, " "); - list_add_tail (&s->node, list); - } - - /* Put all the commands in our list. */ - list_for_each_entry (uc, &user_commands, node) - { - s = sbuf_new (0); - sbuf_copy (s, uc->name); - /* The space is so when the user completes a space is - conveniently inserted after the command. */ - sbuf_concat (s, " "); - list_add_tail (&s->node, list); - } - - return list; -} - -static cmdret * -read_command (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - return read_string (spec, s, hist_COMMAND, colon_completions, arg); -} - -static struct list_head * -exec_completions (char *str) -{ - size_t n = 256; - char *partial; - struct sbuf *line; - FILE *file; - struct list_head *head; - char *completion_string; - - /* Initialize our list. */ - head = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (head); - - /* FIXME: A Bash dependancy?? */ - completion_string = xsprintf("bash -c \"compgen -ac %s|sort\"", str); - file = popen (completion_string, "r"); - free (completion_string); - if (!file) - { - PRINT_ERROR (("popen failed\n")); - return head; - } - - partial = (char*)xmalloc (n); - - /* Read data from the file, split it into lines and store it in a - list. */ - line = sbuf_new (0); - while (fgets (partial, n, file) != NULL) - { - /* Read a chunk from the file into our line accumulator. */ - sbuf_concat (line, partial); - - if (feof(file) || (*(sbuf_get (line) + strlen(sbuf_get (line)) - 1) == '\n')) - { - char *s; - struct sbuf *elem; - - s = sbuf_get (line); - - /* Frob the newline into */ - if (*(s + strlen(s) - 1) == '\n') - *(s + strlen(s) - 1) = '\0'; - - /* Add our line to the list. */ - elem = sbuf_new (0); - sbuf_copy (elem, s); - list_add_tail (&elem->node, head); - - sbuf_clear (line); - } - } - - sbuf_free (line); - - free (partial); - pclose (file); - - return head; -} - -static cmdret * -read_shellcmd (struct argspec *spec, struct sbuf *s, struct cmdarg **arg, const char *command_name) -{ - cmdret *ret; - - ret = read_string (spec, s, hist_SHELLCMD, exec_completions, arg); - if (command_name && !s && !ret) { - /* store for command history */ - char *str = xmalloc (strlen(command_name) + strlen((*arg)->string) + 2); - sprintf (str, "%s %s", command_name, (*arg)->string); - history_add (hist_COMMAND, str); - free(str); - } - return ret; -} - -/* Return NULL on abort/failure. */ -static cmdret * -read_frame (struct sbuf *s, struct cmdarg **arg) -{ - rp_frame *frame; - int fnum = -1; - KeySym c; - char keysym_buf[513]; - int keysym_bufsize = sizeof (keysym_buf); - unsigned int mod; - Window *wins; - int i, j; - rp_frame *cur; - int frames; - - if (s == NULL) - { - frames = 0; - for (j=0; j<num_screens; j++) - frames += num_frames(&screens[j]); - - wins = xmalloc (sizeof (Window) * frames); - - /* Loop through each frame and display its number in it's top - left corner. */ - i = 0; - for (j=0; j<num_screens; j++) - { - XSetWindowAttributes attr; - rp_screen *screen = &screens[j]; - - /* Set up the window attributes to be used in the loop. */ - attr.border_pixel = screen->fg_color; - attr.background_pixel = screen->bg_color; - attr.override_redirect = True; - - list_for_each_entry (cur, &screen->frames, node) - { - int width, height; - char *num; - - /* Create the string to be displayed in the window and - determine the height and width of the window. */ - /* num = xsprintf (" %d ", cur->number); */ - num = frame_selector (cur->number); - width = defaults.bar_x_padding * 2 + rp_text_width (screen, num, -1); - height = (FONT_HEIGHT (screen) + defaults.bar_y_padding * 2); - - /* Create and map the window. */ - wins[i] = XCreateWindow (dpy, screen->root, screen->left + cur->x, screen->top + cur->y, width, height, 1, - CopyFromParent, CopyFromParent, CopyFromParent, - CWOverrideRedirect | CWBorderPixel | CWBackPixel, - &attr); - XMapWindow (dpy, wins[i]); - XClearWindow (dpy, wins[i]); - - /* Display the frame's number inside the window. */ - rp_draw_string (screen, wins[i], STYLE_NORMAL, - defaults.bar_x_padding, - defaults.bar_y_padding + FONT_ASCENT(screen), - num, -1); - - free (num); - i++; - } - } - XSync (dpy, False); - - /* Read a key. */ - read_single_key (&c, &mod, keysym_buf, keysym_bufsize); - - /* Destroy our number windows and free the array. */ - for (i=0; i<frames; i++) - XDestroyWindow (dpy, wins[i]); - - free (wins); - - /* FIXME: We only handle one character long keysym names. */ - if (strlen (keysym_buf) == 1) - { - fnum = frame_selector_match (keysym_buf[0]); - if (fnum == -1) - goto frame_fail; - } - else - { - goto frame_fail; - } - } - else - { - fnum = strtol (sbuf_get (s), NULL, 10); - } - /* Now that we have a frame number to go to, let's try to jump to - it. */ - frame = find_frame_number (fnum); - if (frame) - { - /* We have to return a string, because commands get lists of - strings. Sucky, yes. The command is simply going to parse it - back into an rp_frame. */ - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_FRAME; - (*arg)->string = NULL; - (*arg)->arg.frame = frame; - return NULL; - } - - - frame_fail: - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -read_window (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - rp_window *win = NULL; - char *name; - int n; - - if (s) - name = xstrdup (sbuf_get (s)); - else - name = get_input (spec->prompt, hist_WINDOW, window_completions); - - if (name) - { - /* try by number */ - if ((n = string_to_window_number (name)) >= 0) - { - rp_window_elem *elem = group_find_window_by_number (rp_current_group, n); - if (elem) - win = elem->win; - } - else - /* try by name */ - { - win = find_window_name (name); - } - - if (win) - { - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_WINDOW; - (*arg)->arg.win = win; - (*arg)->string = name; - return NULL; - } - else - { - free (name); - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); - } - } - - /* user abort. */ - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static int -parse_wingravity (char *data) -{ - int ret = -1; - - if (!strcasecmp (data, "northwest") || !strcasecmp (data, "nw") || !strcmp (data, "7")) - ret = NorthWestGravity; - if (!strcasecmp (data, "north") || !strcasecmp (data, "n") || !strcmp (data, "8")) - ret = NorthGravity; - if (!strcasecmp (data, "northeast") || !strcasecmp (data, "ne") || !strcmp (data, "9")) - ret = NorthEastGravity; - if (!strcasecmp (data, "west") || !strcasecmp (data, "w") || !strcmp (data, "4")) - ret = WestGravity; - if (!strcasecmp (data, "center") || !strcasecmp (data, "c") || !strcmp (data, "5")) - ret = CenterGravity; - if (!strcasecmp (data, "east") || !strcasecmp (data, "e") || !strcmp (data, "6")) - ret = EastGravity; - if (!strcasecmp (data, "southwest") || !strcasecmp (data, "sw") || !strcmp (data, "1")) - ret = SouthWestGravity; - if (!strcasecmp (data, "south") || !strcasecmp (data, "s") || !strcmp (data, "2")) - ret = SouthGravity; - if (!strcasecmp (data, "southeast") || !strcasecmp (data, "se") || !strcmp (data, "3")) - ret = SouthEastGravity; - - return ret; -} - -static cmdret * -read_gravity (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - - if (s) - input = xstrdup (sbuf_get(s)); - else - input = get_input (spec->prompt, hist_GRAVITY, trivial_completions); - - if (input) - { - int g = parse_wingravity (input); - if (g == -1) - { - cmdret *ret = cmdret_new (RET_FAILURE, "bad gravity '%s'", input); - free (input); - return ret; - } - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_GRAVITY; - (*arg)->arg.gravity = g; - (*arg)->string = input; - return NULL; - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Given a string, find a matching group. First check if the string is - a number, then check if it's the name of a group. */ -static rp_group * -find_group (char *str) -{ - rp_group *group; - int n; - - /* Check if the user typed a group number. */ - n = string_to_window_number (str); - if (n >= 0) - { - group = groups_find_group_by_number (n); - if (group) - return group; - } - - group = groups_find_group_by_name (str, 0); - return group; -} - -static cmdret * -read_group (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - - if (s) - input = xstrdup (sbuf_get(s)); - else - input = get_input (spec->prompt, hist_GROUP, group_completions); - - if (input) - { - rp_group *g = find_group (input); - - if (g) - { - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_GROUP; - (*arg)->arg.group = g; - (*arg)->string = input; - return NULL; - } - else - { - cmdret *ret = cmdret_new (RET_FAILURE, "unknown group '%s'", input); - free (input); - return ret; - } - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static struct list_head * -hook_completions (char* str UNUSED) -{ - struct list_head *list; - struct rp_hook_db_entry *entry; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - for (entry = rp_hook_db; entry->name; entry++) - { - struct sbuf *hookname; - - hookname = sbuf_new(0); - sbuf_copy (hookname, entry->name); - list_add_tail (&hookname->node, list); - } - - return list; -} - -static cmdret * -read_hook (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - - if (s) - input = xstrdup (sbuf_get(s)); - else - input = get_input (spec->prompt, hist_HOOK, hook_completions); - - if (input) - { - struct list_head *hook = hook_lookup (input); - - if (hook) - { - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_HOOK; - (*arg)->arg.hook = hook; - (*arg)->string = input; - return NULL; - } - else - { - cmdret *ret = cmdret_new (RET_FAILURE, "unknown hook '%s'", input); - free (input); - return ret; - } - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static struct set_var * -find_variable (char *str) -{ - struct set_var *cur; - list_for_each_entry (cur, &set_vars, node) - { - if (!strcmp (str, cur->var)) - return cur; - } - return NULL; -} - -static struct list_head * -var_completions (char *str UNUSED) -{ - struct list_head *list; - struct set_var *cur; - - /* Initialize our list. */ - list = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (list); - - /* Grab all the group names. */ - list_for_each_entry (cur, &set_vars, node) - { - struct sbuf *s; - s = sbuf_new (0); - sbuf_copy (s, cur->var); - list_add_tail (&s->node, list); - } - - return list; -} - -static cmdret * -read_variable (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - - if (s) - input = xstrdup (sbuf_get(s)); - else - input = get_input (spec->prompt, hist_VARIABLE, var_completions); - - if (input) - { - struct set_var *var = find_variable (input); - if (var == NULL) - { - cmdret *ret = cmdret_new (RET_FAILURE, "unknown variable '%s'", input); - free (input); - return ret; - } - - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_VARIABLE; - (*arg)->arg.variable = var; - (*arg)->string = input; - return NULL; - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -read_number (struct argspec *spec, struct sbuf *s, struct cmdarg **arg) -{ - char *input; - - if (s) - input = xstrdup (sbuf_get(s)); - else - /* numbers should perhaps be more fine grained, or hist_NONE */ - input = get_input (spec->prompt, hist_OTHER, trivial_completions); - - if (input) - { - *arg = xmalloc (sizeof(struct cmdarg)); - (*arg)->type = arg_NUMBER; - (*arg)->arg.number = strtol (input, NULL, 10); - (*arg)->string = input; - return NULL; - } - - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -read_arg (struct argspec *spec, struct sbuf *s, struct cmdarg **arg, const char *command_name) -{ - cmdret *ret = NULL; - - switch (spec->type) - { - case arg_STRING: - case arg_REST: - case arg_RAW: - ret = read_string (spec, s, hist_OTHER, trivial_completions, arg); - break; - case arg_KEYMAP: - ret = read_keymap (spec, s, arg); - break; - case arg_KEY: - ret = read_keydesc (spec, s, arg); - break; - case arg_NUMBER: - ret = read_number (spec, s, arg); - break; - case arg_GRAVITY: - ret = read_gravity (spec, s, arg); - break; - case arg_COMMAND: - ret = read_command (spec, s, arg); - break; - case arg_SHELLCMD: - ret = read_shellcmd (spec, s, arg, command_name); - break; - case arg_WINDOW: - ret = read_window (spec, s, arg); - break; - case arg_FRAME: - ret = read_frame (s, arg); - break; - case arg_GROUP: - ret = read_group (spec, s, arg); - break; - case arg_HOOK: - ret = read_hook (spec, s, arg); - break; - case arg_VARIABLE: - ret = read_variable (spec, s, arg); - break; - } - - return ret; -} - -/* Return -1 on failure. Return the number of args on success. */ -static cmdret * -parsed_input_to_args (int num_args, struct argspec *argspec, struct list_head *list, - struct list_head *args, int *parsed_args, const char *command_name) -{ - struct sbuf *s; - struct cmdarg *arg; - cmdret *ret; - - PRINT_DEBUG (("list len: %d\n", list_size (list))); - - *parsed_args = 0; - - /* Convert the existing entries to cmdarg's. */ - list_for_each_entry (s, list, node) - { - if (*parsed_args >= num_args) break; - ret = read_arg (&argspec[*parsed_args], s, &arg, command_name); - /* If there was an error, then abort. */ - if (ret) - return ret; - - list_add_tail (&arg->node, args); - (*parsed_args)++; - } - - return NULL; -} - -/* Prompt the user for missing arguments. Returns non-zero on - failure. 0 on success. */ -static cmdret * -fill_in_missing_args (struct user_command *cmd, struct list_head *list, struct list_head *args, const char *command_name) -{ - cmdret *ret; - struct cmdarg *arg; - int i = 0; - - ret = parsed_input_to_args (cmd->num_args, cmd->args, list, args, &i, command_name); - if (ret) - return ret; - - /* Fill in the rest of the required arguments. */ - for(; i < cmd->i_required_args; i++) - { - ret = read_arg (&cmd->args[i], NULL, &arg, command_name); - if (ret) - return ret; - list_add_tail (&arg->node, args); - } - - return NULL; -} - -/* Stick a list of sbuf's in list. if nargs >= 0 then only parse nargs - arguments and and the rest of the string to the list. Return 0 on - success. non-zero on failure. When raw is true, then when we hit - nargs, we should keep any whitespace at the beginning. When false, - gobble the whitespace. */ -static cmdret * -parse_args (char *str, struct list_head *list, int nargs, int raw) -{ - cmdret *ret = NULL; - char *i; - char *tmp; - int len = 0; - int str_escape = 0; - int in_str = 0; - int gobble = 1; - int parsed_args = 0; - - if (str == NULL) - return NULL; - - tmp = malloc (strlen(str) + 1); - - for (i=str; *i; i++) - { - /* Have we hit the arg limit? */ - if (raw && parsed_args >= nargs) - { - struct sbuf *s = sbuf_new(0); - if (!raw) - while (*i && isspace (*i)) i++; - if (*i) - { - sbuf_concat(s, i); - list_add_tail (&s->node, list); - } - len = 0; - break; - } - - /* Should we eat the whitespace? */ - if (gobble) - { - while (*i && isspace (*i)) i++; - gobble = 0; - } - - /* Escaped characters always get added. */ - if (str_escape) - { - tmp[len] = *i; - len++; - str_escape = 0; - } - else if (*i == '\\') - { - str_escape = 1; - } - else if (*i == '"') - { - if (in_str) - { - /* End the arg. */ - struct sbuf *s = sbuf_new(0); - sbuf_nconcat(s, tmp, len); - list_add_tail (&s->node, list); - len = 0; - gobble = 1; - in_str = 0; - parsed_args++; - } - else if (len == 0) - { - /* A string open can only start at the beginning of an - argument. */ - in_str = 1; - } - else - { - ret = cmdret_new (RET_FAILURE, "parse error in '%s'", str); - break; - } - } - else if (isspace (*i) && !in_str) - { - /* End the current arg, and start a new one. */ - struct sbuf *s = sbuf_new(0); - sbuf_nconcat(s, tmp, len); - list_add_tail (&s->node, list); - len = 0; - gobble = 1; - parsed_args++; - } - else - { - /* Add the character to the argument. */ - tmp[len] = *i; - len++; - } - } - /* Add the remaining text in tmp. */ - if (ret == NULL && len) - { - struct sbuf *s = sbuf_new(0); - sbuf_nconcat(s, tmp, len); - list_add_tail (&s->node, list); - } - - /* Free our memory and return. */ - free (tmp); - return ret; -} - -/* Convert the list to an array, for easier access in commands. */ -static struct cmdarg ** -arg_array (struct list_head *head) -{ - int i = 0; - struct cmdarg **args, *cur; - - args = (struct cmdarg **)xmalloc (sizeof (struct cmdarg *) * (list_size (head) + 1)); - list_for_each_entry (cur, head, node) - { - args[i] = cur; - i++; - } - - /* NULL terminate the array. */ - args[list_size (head)] = NULL; - return args; -} - -static void -arg_free (struct cmdarg *arg) -{ - if (arg) - { - /* read_frame doesn't fill in string. */ - if (arg->string) - free (arg->string); - switch (arg->type) - { - case arg_KEY: - free (arg->arg.key); - break; - case arg_REST: - case arg_STRING: - case arg_NUMBER: - case arg_WINDOW: - case arg_FRAME: - case arg_COMMAND: - case arg_SHELLCMD: - case arg_KEYMAP: - case arg_GRAVITY: - case arg_GROUP: - case arg_HOOK: - case arg_VARIABLE: - case arg_RAW: - /* Do nothing */ - break; - default: - PRINT_ERROR (("Missed an arg type.\n")); - break; - } - free (arg); - } -} - -cmdret * -command (int interactive, char *data) -{ - /* This static counter is used to exit from recursive alias calls. */ - static int alias_recursive_depth = 0; - cmdret *result = NULL; - char *cmd, *rest; - char *input; - user_command *uc; - int i; - - if (data == NULL) - return cmdret_new (RET_FAILURE, NULL); - - /* get a writable copy for strtok() */ - input = xstrdup (data); - - cmd = input; - /* skip beginning whitespace. */ - while (*cmd && isspace (*cmd)) cmd++; - rest = cmd; - /* skip til we get to whitespace */ - while (*rest && !isspace (*rest)) rest++; - /* mark that spot as the end of the command and make rest point to - the rest of the string. */ - if (*rest) - { - *rest = 0; - rest++; - } - - PRINT_DEBUG (("cmd==%s rest==%s\n", cmd, rest?rest:"NULL")); - - /* Look for it in the aliases, first. */ - for (i=0; i<alias_list_last; i++) - { - if (!strcmp (cmd, alias_list[i].name)) - { - struct sbuf *s; - - /* Append any arguments onto the end of the alias' command. */ - s = sbuf_new (0); - sbuf_concat (s, alias_list[i].alias); - if (rest != NULL && *rest) - sbuf_printf_concat (s, " %s", rest); - - alias_recursive_depth++; - if (alias_recursive_depth >= MAX_ALIAS_RECURSIVE_DEPTH) - result = cmdret_new (RET_FAILURE, "command: alias recursion has exceeded maximum depth"); - else - result = command (interactive, sbuf_get (s)); - alias_recursive_depth--; - - sbuf_free (s); - goto done; - } - } - - /* If it wasn't an alias, maybe its a command. */ - list_for_each_entry (uc, &user_commands, node) - { - if (!strcmp (cmd, uc->name)) - { - struct sbuf *scur; - struct cmdarg *acur; - struct list_head *iter, *tmp; - struct list_head head, args; - int nargs = 0, raw = 0; - - INIT_LIST_HEAD (&args); - INIT_LIST_HEAD (&head); - - /* We need to tell parse_args about arg_REST and arg_SHELLCMD. */ - for (i=0; i<uc->num_args; i++) - if (uc->args[i].type == arg_REST - || uc->args[i].type == arg_COMMAND - || uc->args[i].type == arg_SHELLCMD - || uc->args[i].type == arg_RAW) - { - raw = 1; - nargs = i; - break; - } - - /* Parse the arguments and call the function. */ - result = parse_args (rest, &head, nargs, raw); - if (result) - goto free_lists; - - /* Interactive commands prompt the user for missing args. */ - if (interactive) - result = fill_in_missing_args (uc, &head, &args, uc->name); - else - { - int parsed_args; - result = parsed_input_to_args (uc->num_args, uc->args, &head, &args, &parsed_args, uc->name); - } - - if (result == NULL) - { - if ((interactive && list_size (&args) < uc->i_required_args) - || (!interactive && list_size (&args) < uc->ni_required_args)) - { - result = cmdret_new (RET_FAILURE, "not enough arguments."); - goto free_lists; - } - else if (list_size (&head) > uc->num_args) - { - result = cmdret_new (RET_FAILURE, "too many arguments."); - goto free_lists; - } - else - { - struct cmdarg **cmdargs = arg_array (&args); - result = uc->func (interactive, cmdargs); - free (cmdargs); - } - } - - free_lists: - /* Free the parsed strings */ - list_for_each_safe_entry (scur, iter, tmp, &head, node) - sbuf_free(scur); - /* Free the args */ - list_for_each_safe_entry (acur, iter, tmp, &args, node) - arg_free (acur); - - goto done; - } - } - - result = cmdret_new (RET_FAILURE, MESSAGE_UNKNOWN_COMMAND, cmd); - - done: - free (input); - return result; -} - -cmdret * -cmd_colon (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *result; - char *input; - - if (args[0] == NULL) - input = get_input (MESSAGE_PROMPT_COMMAND, hist_COMMAND, colon_completions); - else - input = get_more_input (MESSAGE_PROMPT_COMMAND, ARG_STRING(0), hist_COMMAND, - colon_completions); - - /* User aborted. */ - if (input == NULL) - return cmdret_new (RET_FAILURE, NULL); - - result = command (1, input); - free (input); - return result; -} - -cmdret * -cmd_exec (int interactive UNUSED, struct cmdarg **args) -{ - spawn (ARG_STRING(0), 0, current_frame()); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_execa (int interactive UNUSED, struct cmdarg **args) -{ - spawn (ARG_STRING(0), 0, NULL); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_execf (int interactive UNUSED, struct cmdarg **args) -{ - spawn (ARG_STRING(1), 0, ARG(0,frame)); - return cmdret_new (RET_SUCCESS, NULL); -} - -int -spawn(char *cmd, int raw, rp_frame *frame) -{ - rp_child_info *child; - int pid; - - pid = fork(); - if (pid == 0) - { - /* Some process setup to make sure the spawned process runs - in its own session. */ - putenv(current_screen()->display_string); -#ifdef HAVE_SETSID - setsid(); -#endif -#if defined (HAVE_SETPGID) - setpgid (0, 0); -#elif defined (HAVE_SETPGRP) - setpgrp (0, 0); -#endif - /* raw means don't run it through sh. */ - if (raw) - execl (cmd, cmd, NULL); - execl("/bin/sh", "sh", "-c", cmd, NULL); - _exit(EXIT_FAILURE); - } - -/* wait((int *) 0); */ - PRINT_DEBUG (("spawned %s\n", cmd)); - - /* Add this child process to our list. */ - child = malloc (sizeof (rp_child_info)); - child->cmd = strdup (cmd); - child->pid = pid; - child->terminated = 0; - child->frame = frame; - child->group = rp_current_group; - child->screen = current_screen(); - child->window_mapped = 0; - - list_add (&child->node, &rp_children); - - return pid; -} - -/* Switch to a different Window Manager. Thanks to -"Chr. v. Stuckrad" <stucki@math.fu-berlin.de> for the patch. */ -cmdret * -cmd_newwm(int interactive UNUSED, struct cmdarg **args) -{ - /* in the event loop, this will switch WMs. */ - rp_exec_newwm = xstrdup (ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_quit(int interactive UNUSED, struct cmdarg **args UNUSED) -{ - kill_signalled = 1; - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Show the current time on the bar. Thanks to Martin Samuelsson - <cosis@lysator.liu.se> for the patch. Thanks to Jonathan Walther - <krooger@debian.org> for making it pretty. */ -cmdret * -cmd_time (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - char *msg, *tmp; - time_t timep; - cmdret *ret; - - timep = time (NULL); - tmp = ctime (&timep); - msg = xstrdup (tmp); - msg[strcspn (msg, "\n")] = '\0' ; /* Remove the newline */ - - ret = cmdret_new (RET_SUCCESS, "%s", msg); - free (msg); - - return ret; -} - -/* Assign a new number to a window ala screen's number command. */ -cmdret * -cmd_number (int interactive UNUSED, struct cmdarg **args) -{ - int old_number, new_number; - rp_window_elem *other_win, *win; - - if (args[0] == NULL) - { - /* XXX: Fix this. */ - print_window_information (rp_current_group, current_window()); - return cmdret_new (RET_SUCCESS, NULL); - } - - /* Gather the args. */ - new_number = ARG(0,number); - if (args[1]) - win = group_find_window_by_number (rp_current_group, ARG(1,number)); - else - win = group_find_window (&rp_current_group->mapped_windows, current_window()); - - /* Make the switch. */ - if ( new_number >= 0 && win) - { - /* Find other window with same number and give it old number. */ - other_win = group_find_window_by_number (rp_current_group, new_number); - if (other_win != NULL) - { - old_number = win->number; - other_win->number = old_number; - - /* Resort the window in the list */ - group_resort_window (rp_current_group, other_win); - } - else - { - numset_release (rp_current_group->numset, win->number); - } - - win->number = new_number; - numset_add_num (rp_current_group->numset, new_number); - - /* resort the the window in the list */ - group_resort_window (rp_current_group, win); - - /* Update the window list. */ - update_window_names (win->win->scr, defaults.window_fmt); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Toggle the display of the program bar */ -cmdret * -cmd_windows (int interactive, struct cmdarg **args) -{ - struct sbuf *window_list = NULL; - int dummy; - rp_screen *s; - char *fmt; - - if (args[0] == NULL) - fmt = defaults.window_fmt; - else - fmt = ARG_STRING(0); - - if (interactive) - { - s = current_screen (); - /* This is a yukky hack. If the bar already hidden then show the - bar. This handles the case when msgwait is 0 (the bar sticks) - and the user uses this command to toggle the bar on and - off. OR the timeout is >0 then show the bar. Which means, - always show the bar if msgwait is >0 which fixes the case - when a command in the prefix hook displays the bar. */ - if (!hide_bar (s) || defaults.bar_timeout > 0) show_bar (s, fmt); - - return cmdret_new (RET_SUCCESS, NULL); - } - else - { - cmdret *ret; - - window_list = sbuf_new (0); - get_window_list (fmt, "\n", window_list, &dummy, &dummy); - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (window_list)); - sbuf_free (window_list); - return ret; - } -} - -cmdret * -cmd_abort (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Redisplay the current window by sending 2 resize events. */ -cmdret * -cmd_redisplay (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - force_maximize (current_window()); - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Reassign the prefix key. */ -cmdret * -cmd_escape (int interactive UNUSED, struct cmdarg **args) -{ - struct rp_key *key; - rp_action *action; - rp_keymap *map, *top; - - top = find_keymap (defaults.top_kmap); - map = find_keymap (ROOT_KEYMAP); - key = ARG(0,key); - - /* Update the "other" keybinding */ - action = find_keybinding(prefix_key.sym, prefix_key.state, map); - if (action != NULL && !strcmp (action->data, "other")) - { - action->key = key->sym; - action->state = key->state; - } - - /* Update the "meta" keybinding */ - action = find_keybinding(prefix_key.sym, 0, map); - if (action != NULL && !strcmp (action->data, "meta")) - { - action->key = key->sym; - if (key->state != 0) - action->state = 0; - else - action->state = RP_CONTROL_MASK; - } - - /* Remove the grab on the current prefix key */ - ungrab_keys_all_wins(); - - action = find_keybinding(prefix_key.sym, prefix_key.state, top); - if (action != NULL && !strcmp (action->data, "readkey " ROOT_KEYMAP)) - { - action->key = key->sym; - action->state = key->state; - } - - /* Add the grab for the new prefix key */ - grab_keys_all_wins(); - - /* Finally, keep track of the current prefix. */ - prefix_key.sym = key->sym; - prefix_key.state = key->state; - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* User accessible call to display the passed in string. */ -cmdret * -cmd_echo (int interactive UNUSED, struct cmdarg **args) -{ - marked_message_printf (0, 0, "%s", ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -} - - -static cmdret * -read_split (char *str, int max, int *p) -{ - int a, b; - - if (sscanf(str, "%d/%d", &a, &b) == 2) - { - *p = (int)(max * (float)(a) / (float)(b)); - } - else if (sscanf(str, "%d", p) == 1) - { - if (*p < 0) - *p = max + *p; - } - else - { - /* Failed to read input. */ - return cmdret_new (RET_FAILURE, "bad split '%s'", str); - } - - return NULL; -} - -cmdret * -cmd_v_split (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret; - rp_frame *frame; - int pixels; - - push_frame_undo (current_screen()); /* fdump to stack */ - frame = current_frame(); - - /* Default to dividing the frame in half. */ - if (args[0] == NULL) - pixels = frame->height / 2; - else - { - ret = read_split (ARG_STRING(0), frame->height, &pixels); - if (ret) - return ret; - } - - if (pixels > 0) - h_split_frame (frame, pixels); - else - return cmdret_new (RET_FAILURE, "vsplit: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_h_split (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret; - rp_frame *frame; - int pixels; - - push_frame_undo (current_screen()); /* fdump to stack */ - frame = current_frame(); - - /* Default to dividing the frame in half. */ - if (args[0] == NULL) - pixels = frame->width / 2; - else - { - ret = read_split (ARG_STRING(0), frame->width, &pixels); - if (ret) - return ret; - } - - if (pixels > 0) - v_split_frame (frame, pixels); - else - return cmdret_new (RET_FAILURE, "hsplit: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_only (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - push_frame_undo (current_screen()); /* fdump to stack */ - remove_all_splits(); - maximize (current_window()); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_remove (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_screen *s = current_screen(); - rp_frame *frame; - - push_frame_undo (current_screen()); /* fdump to stack */ - - if (num_frames(s) <= 1) - { - return cmdret_new (RET_FAILURE, "remove: cannot remove only frame"); - } - - frame = find_frame_next (current_frame()); - - if (frame) - { - remove_frame (current_frame()); - set_active_frame (frame, 0); - show_frame_indicator(0); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_shrink (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - push_frame_undo (current_screen()); /* fdump to stack */ - resize_shrink_to_window (current_frame()); - return cmdret_new (RET_SUCCESS, NULL); -} - -typedef struct resize_binding resize_binding; - -struct resize_binding -{ - struct rp_key key; - enum resize_action {RESIZE_UNKNOWN=0, RESIZE_VGROW, RESIZE_VSHRINK, - RESIZE_HGROW, RESIZE_HSHRINK, RESIZE_TO_WINDOW, - RESIZE_ABORT, RESIZE_END } action; -}; - -static resize_binding resize_bindings[] = - { {{INPUT_ABORT_KEY, INPUT_ABORT_MODIFIER}, RESIZE_ABORT}, - {{RESIZE_VGROW_KEY, RESIZE_VGROW_MODIFIER}, RESIZE_VGROW}, - {{RESIZE_VSHRINK_KEY, RESIZE_VSHRINK_MODIFIER}, RESIZE_VSHRINK}, - {{RESIZE_HGROW_KEY, RESIZE_HGROW_MODIFIER}, RESIZE_HGROW}, - {{RESIZE_HSHRINK_KEY, RESIZE_HSHRINK_MODIFIER}, RESIZE_HSHRINK}, - {{RESIZE_SHRINK_TO_WINDOW_KEY,RESIZE_SHRINK_TO_WINDOW_MODIFIER},RESIZE_TO_WINDOW}, - {{RESIZE_END_KEY, RESIZE_END_MODIFIER}, RESIZE_END}, -/* Some more default keys - * (after the values from conf.h, so that they have lower priority): - * first the arrow keys: */ - {{XK_Escape, 0}, RESIZE_ABORT}, - {{XK_Down, 0}, RESIZE_VGROW}, - {{XK_Up, 0}, RESIZE_VSHRINK}, - {{XK_Right, 0}, RESIZE_HGROW}, - {{XK_Left, 0}, RESIZE_HSHRINK}, -/* some vi-like bindings: */ - {{XK_j, 0}, RESIZE_VGROW}, - {{XK_k, 0}, RESIZE_VSHRINK}, - {{XK_l, 0}, RESIZE_HGROW}, - {{XK_h, 0}, RESIZE_HSHRINK}, - {{0, 0}, RESIZE_UNKNOWN} }; - - -cmdret * -cmd_resize (int interactive, struct cmdarg **args) -{ - rp_screen *s = current_screen (); - - /* If the user calls resize with arguments, treat it like the - non-interactive version. */ - if (interactive && args[0] == NULL) - { - char buffer[513]; - unsigned int mod; - KeySym c; - struct list_head *bk; - - /* If we haven't got at least 2 frames, there isn't anything to - scale. */ - if (num_frames (s) < 2) - return cmdret_new (RET_FAILURE, NULL); - - /* Save the frameset in case the user aborts. */ - bk = screen_copy_frameset (s); - - /* Get ready to read keys. */ - grab_rat(); - XGrabKeyboard (dpy, s->key_window, False, GrabModeAsync, GrabModeAsync, CurrentTime); - - while (1) - { - struct resize_binding *binding; - - show_frame_message ("Resize frame"); - read_key (&c, &mod, buffer, sizeof (buffer)); - - /* Convert the mask to be compatible with ratpoison. */ - mod = x11_mask_to_rp_mask (mod); - - for (binding = resize_bindings; binding->action; binding++) - { - if (c == binding->key.sym && mod == binding->key.state) - break; - } - - if (binding->action == RESIZE_VGROW) - resize_frame_vertically (current_frame(), defaults.frame_resize_unit); - else if (binding->action == RESIZE_VSHRINK) - resize_frame_vertically (current_frame(), -defaults.frame_resize_unit); - else if (binding->action == RESIZE_HGROW) - resize_frame_horizontally (current_frame(), defaults.frame_resize_unit); - else if (binding->action == RESIZE_HSHRINK) - resize_frame_horizontally (current_frame(), -defaults.frame_resize_unit); - else if (binding->action == RESIZE_TO_WINDOW) - resize_shrink_to_window (current_frame()); - else if (binding->action == RESIZE_ABORT) - { - rp_frame *cur; - - screen_restore_frameset (s, bk); - list_for_each_entry (cur, &s->frames, node) - { - maximize_all_windows_in_frame (cur); - } - break; - } - else if (binding->action == RESIZE_END) - { - frameset_free (bk); - break; - } - } - - /* It is our responsibility to free this. */ - free (bk); - - hide_frame_indicator (); - ungrab_rat(); - XUngrabKeyboard (dpy, CurrentTime); - } - else - { - if (args[0] && args[1]) - { - resize_frame_horizontally (current_frame(), ARG(0,number)); - resize_frame_vertically (current_frame(), ARG(1,number)); - } - else - return cmdret_new (RET_FAILURE, "resize: two numeric arguments required"); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_resizeunit (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.frame_resize_unit); - - if (ARG(0,number) >= 0) - defaults.frame_resize_unit = ARG(0,number); - else - return cmdret_new (RET_FAILURE, "defresizeunit: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* banish the rat pointer */ -cmdret * -cmd_banish (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_screen *s; - - s = current_screen (); - - XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->left + s->width - 2, s->top + s->height - 2); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_banishrel (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_screen *s = current_screen(); - rp_window *w = current_window(); - rp_frame *f = current_frame(); - - if (w) - XWarpPointer (dpy, None, w->w, 0, 0, 0, 0, w->x + w->width - 2, w->y + w->height - 2); - else - XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, f->x + f->width, f->y + f->height); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_ratinfo (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_screen *s; - Window root_win, child_win; - int mouse_x, mouse_y, root_x, root_y; - unsigned int mask; - - s = current_screen(); - XQueryPointer (dpy, s->root, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); - - return cmdret_new (RET_SUCCESS, "%d %d", mouse_x, mouse_y); -} - -cmdret * -cmd_ratrelinfo (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_screen *s; - rp_window *rpw; - rp_frame *f; - Window root_win, child_win; - int mouse_x, mouse_y, root_x, root_y; - unsigned int mask; - - s = current_screen(); - rpw = current_window(); - f = current_frame(); - - if (rpw) - XQueryPointer (dpy, rpw->w, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); - else - { - XQueryPointer (dpy, s->root, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); - root_x -= f->x; - root_y -= f->y; - } - - return cmdret_new (RET_SUCCESS, "%d %d", root_x, root_y); -} - -cmdret * -cmd_ratwarp (int interactive UNUSED, struct cmdarg **args) -{ - rp_screen *s; - - s = current_screen (); - XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, ARG(0,number), ARG(1,number)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_ratrelwarp (int interactive UNUSED, struct cmdarg **args) -{ - XWarpPointer (dpy, None, None, 0, 0, 0, 0, ARG(0,number), ARG(1,number)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_ratclick (int interactive UNUSED, struct cmdarg **args) -{ - int button = 1; - - if (args[0]) - { - button = ARG(0,number); - if (button < 1 || button > 3) - return cmdret_new (RET_SUCCESS, "ratclick: invalid argument"); - } - -#ifdef HAVE_LIBXTST - XTestFakeButtonEvent(dpy, button, True, CurrentTime); - XTestFakeButtonEvent(dpy, button, False, CurrentTime); - return cmdret_new (RET_SUCCESS, NULL); -#else - return cmdret_new (RET_FAILURE, "ratclick: Please compile with the Xtst extension"); -#endif -} - -cmdret * -cmd_rathold (int interactive UNUSED, struct cmdarg **args) -{ - int button = 1; - - if (args[1]) - { - button = ARG(1,number); - if (button < 1 || button > 3) - return cmdret_new (RET_SUCCESS, "ratclick: invalid argument"); - } - -#ifdef HAVE_LIBXTST - if (!strcmp(ARG_STRING(0), "down")) - XTestFakeButtonEvent(dpy, button, True, CurrentTime); - else if(!strcmp(ARG_STRING(0),"up")) - XTestFakeButtonEvent(dpy, button, False, CurrentTime); - else - return cmdret_new (RET_FAILURE, "rathold: '%s' invalid argument", ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -#else - return cmdret_new (RET_FAILURE, "rathold: Please compile with the Xtst extension"); -#endif -} - -cmdret * -cmd_curframe (int interactive, struct cmdarg **args UNUSED) -{ - if (interactive) - { - show_frame_indicator(1); - return cmdret_new (RET_SUCCESS, NULL); - } - else - return cmdret_new(RET_SUCCESS, "%d", current_frame()->number); -} - -/* Thanks to Martin Samuelsson <cosis@lysator.liu.se> for the - original patch. */ -cmdret * -cmd_license (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_screen *s = current_screen(); - int x = 10; - int y = 10; - int i; - int max_width = 0; - char *license_text[] = { PACKAGE " " VERSION, "(built " __DATE__ " " __TIME__ ")", - "", - "Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts", - "", - "ratpoison 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, or (at your option) ", - "any later version.", - "", - "ratpoison 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 software; see the file COPYING. If not, write to ", - "the Free Software Foundation, Inc., 59 Temple Place, Suite 330, ", - "Boston, MA 02111-1307 USA", - "", - "Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza ", - "to ratpoison-devel@nongnu.org or visit ", - "http://www.nongnu.org/ratpoison/", - "", - "[Press any key to end.] ", - NULL}; - - /* Switch to the default colormap. */ - if (current_window()) - XUninstallColormap (dpy, current_window()->colormap); - XInstallColormap (dpy, s->def_cmap); - - XMapRaised (dpy, s->help_window); - - /* Find the longest line. */ - for(i=0; license_text[i]; i++) - { - int tmp; - - tmp = rp_text_width (s, license_text[i], -1); - if (tmp > max_width) - max_width = tmp; - } - - /* Offset the text so its in the center. */ - x = s->left + (s->width - max_width) / 2; - y = s->top + (s->height - i * FONT_HEIGHT (s)) / 2; - if (x < 0) x = 0; - if (y < 0) y = 0; - - /* Print the text. */ - for(i=0; license_text[i]; i++) - { - rp_draw_string (s, s->help_window, STYLE_NORMAL, - x, y + FONT_ASCENT(s), - license_text[i], -1); - - y += FONT_HEIGHT (s); - } - - /* Wait for a key press. */ - read_any_key (); - XUnmapWindow (dpy, s->help_window); - - /* Possibly restore colormap. */ - if (current_window()) - { - XUninstallColormap (dpy, s->def_cmap); - XInstallColormap (dpy, current_window()->colormap); - } - - /* The help window overlaps the bar, so redraw it. */ - if (current_screen()->bar_is_raised) - redraw_last_message(); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_help (int interactive, struct cmdarg **args) -{ - rp_keymap *map; - - if (args[0]) - map = ARG(0,keymap); - else - map = find_keymap (ROOT_KEYMAP); - - if (interactive) - { - rp_screen *s = current_screen(); - int i, old_i; - int x = 10; - int y = 0; - int header_offset; - int width, max_width = 0; - /* 1 if we are drawing keys, 0 if we are drawing commands */ - int drawing_keys = 1; - char *keysym_name; - - /* Switch to the default colormap. */ - if (current_window()) - XUninstallColormap (dpy, current_window()->colormap); - XInstallColormap (dpy, s->def_cmap); - - XMapRaised (dpy, s->help_window); - - rp_draw_string (s, s->help_window, STYLE_NORMAL, - 10, y + FONT_ASCENT(s), - "ratpoison key bindings", -1); - - y += FONT_HEIGHT (s) * 2; - - /* Only print the "Command key" for the root keymap */ - if (map == find_keymap (ROOT_KEYMAP)) - { - rp_draw_string (s, s->help_window, STYLE_NORMAL, - 10, y + FONT_ASCENT(s), - "Command key: ", -1); - - keysym_name = keysym_to_string (prefix_key.sym, prefix_key.state); - rp_draw_string (s, s->help_window, STYLE_NORMAL, - 10 + rp_text_width (s, "Command key: ", -1), - y + FONT_ASCENT(s), - keysym_name, -1); - free (keysym_name); - - y += FONT_HEIGHT (s) * 2; - } - - header_offset = y; - - i = old_i = 0; - while (i < map->actions_last && old_i < map->actions_last) - { - if (drawing_keys) - { - keysym_name = - keysym_to_string (map->actions[i].key, map->actions[i].state); - - rp_draw_string (s, s->help_window, STYLE_NORMAL, - x, y + FONT_ASCENT(s), - keysym_name, -1); - - width = rp_text_width (s, keysym_name, -1); - if (width > max_width) - max_width = width; - - free (keysym_name); - } - else - { - rp_draw_string (s, s->help_window, STYLE_NORMAL, - x, y + FONT_ASCENT(s), - map->actions[i].data, -1); - - width = rp_text_width (s, map->actions[i].data, -1); - if (width > max_width) - max_width = width; - } - - y += FONT_HEIGHT (s); - /* Make sure the next line fits entirely within the window. */ - if (y + FONT_HEIGHT (s) >= (s->top + s->height)) - { - if (drawing_keys) - { - x += max_width + 10; - drawing_keys = 0; - i = old_i; - } - else - { - x += max_width + 20; - drawing_keys = 1; - i++; - old_i = i; - } - - max_width = 0; - y = header_offset; - } - else - { - i++; - if (i == map->actions_last && drawing_keys) - { - x += max_width + 10; - drawing_keys = 0; - y = header_offset; - i = old_i; - max_width = 0; - } - } - } - - read_any_key(); - XUnmapWindow (dpy, s->help_window); - - /* Possibly restore colormap. */ - if (current_window()) - { - XUninstallColormap (dpy, s->def_cmap); - XInstallColormap (dpy, current_window()->colormap); - } - - /* The help window overlaps the bar, so redraw it. */ - if (current_screen()->bar_is_raised) - redraw_last_message(); - - return cmdret_new (RET_SUCCESS, NULL); - } - else - { - struct sbuf *help_list; - char *keysym_name; - int i; - cmdret *ret; - - help_list = sbuf_new (0); - - for (i = 0; i < map->actions_last; i++) - { - keysym_name = keysym_to_string (map->actions[i].key, map->actions[i].state); - sbuf_concat (help_list, keysym_name); - free (keysym_name); - sbuf_concat (help_list, " "); - sbuf_concat (help_list, map->actions[i].data); - if (i < map->actions_last - 1) - sbuf_concat (help_list, "\n"); - } - - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (help_list)); - sbuf_free (help_list); - return ret; - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_rudeness (int interactive UNUSED, struct cmdarg **args) -{ - int num; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", - rp_honour_transient_raise - | (rp_honour_normal_raise << 1) - | (rp_honour_transient_map << 2) - | (rp_honour_normal_map << 3)); - - num = ARG(0,number); - if (num < 0 || num > 15) - return cmdret_new (RET_FAILURE, "rudeness: invalid level '%s'", ARG_STRING(0)); - - rp_honour_transient_raise = num & 1 ? 1 : 0; - rp_honour_normal_raise = num & 2 ? 1 : 0; - rp_honour_transient_map = num & 4 ? 1 : 0; - rp_honour_normal_map = num & 8 ? 1 : 0; - - return cmdret_new (RET_SUCCESS, NULL); -} - -char * -wingravity_to_string (int g) -{ - switch (g) - { - case NorthWestGravity: - return "nw"; - case WestGravity: - return "w"; - case SouthWestGravity: - return "sw"; - case NorthGravity: - return "n"; - case CenterGravity: - return "c"; - case SouthGravity: - return "s"; - case NorthEastGravity: - return "ne"; - case EastGravity: - return "e"; - case SouthEastGravity: - return "se"; - } - - PRINT_DEBUG (("Unknown gravity!\n")); - return "Unknown"; -} - -cmdret * -cmd_gravity (int interactive UNUSED, struct cmdarg **args) -{ - int gravity; - rp_window *win; - - win = current_window(); - if (!win) - return cmdret_new (RET_FAILURE, NULL); - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", wingravity_to_string (win->gravity)); - - if ((gravity = parse_wingravity (ARG_STRING(0))) < 0) - return cmdret_new (RET_FAILURE, "gravity: unknown gravity"); - else - { - win->gravity = gravity; - maximize (win); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_wingravity (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", wingravity_to_string (defaults.win_gravity)); - - defaults.win_gravity = ARG(0,gravity); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_transgravity (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", wingravity_to_string (defaults.trans_gravity)); - - defaults.trans_gravity = ARG(0,gravity); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_maxsizegravity (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", wingravity_to_string (defaults.maxsize_gravity)); - - defaults.maxsize_gravity = ARG(0,gravity); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_msgwait (int interactive UNUSED, struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.bar_timeout); - - if (ARG(0,number) < 0) - return cmdret_new (RET_FAILURE, "msgwait: invalid argument"); - else - defaults.bar_timeout = ARG(0,number); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_bargravity (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", wingravity_to_string (defaults.bar_location)); - - defaults.bar_location = ARG(0,gravity); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static void -update_gc (rp_screen *s) -{ - XGCValues gcv; - - gcv.foreground = s->fg_color; - gcv.background = s->bg_color; - gcv.function = GXcopy; - gcv.line_width = 1; - gcv.subwindow_mode = IncludeInferiors; - XFreeGC (dpy, s->normal_gc); - s->normal_gc = XCreateGC(dpy, s->root, - GCForeground | GCBackground - | GCFunction | GCLineWidth - | GCSubwindowMode, &gcv); - gcv.foreground = s->bg_color; - gcv.background = s->fg_color; - XFreeGC (dpy, s->inverse_gc); - s->inverse_gc = XCreateGC(dpy, s->root, - GCForeground | GCBackground - | GCFunction | GCLineWidth - | GCSubwindowMode, &gcv); -} - -#ifndef USE_XFT_FONT -static void -update_all_gcs (void) -{ - int i; - - for (i=0; i<num_screens; i++) - { - update_gc (&screens[i]); - } -} -#endif - -static cmdret * -set_historysize (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.history_size); - - defaults.history_size = ARG(0, number); - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_historycompaction (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.history_compaction); - - defaults.history_compaction = ARG(0, number); - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_historyexpansion (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.history_expansion); -#ifndef HAVE_HISTORY - if (ARG(0, number)) { - return cmdret_new (RET_FAILURE, "Not compiled with libhistory"); - } -#endif - defaults.history_expansion = ARG(0, number); - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_font (struct cmdarg **args) -{ -#ifdef USE_XFT_FONT - XftFont *font; - rp_screen *s = current_screen (); - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.font_string); - - font = XftFontOpenName (dpy, s->screen_num, ARG_STRING (0)); - - if (font == NULL) - return cmdret_new (RET_FAILURE, "deffont: unknown font"); - - XftFontClose (dpy, s->xft_font); - s->xft_font = font; -#else - XFontSet font; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.font_string); - - font = load_query_font_set (dpy, ARG_STRING(0)); - if (font == NULL) - return cmdret_new (RET_FAILURE, "deffont: unknown font"); - - /* Save the font as the default. */ - XFreeFontSet (dpy, defaults.font); - defaults.font = font; - set_extents_of_fontset(font); - update_all_gcs(); -#endif - - free (defaults.font_string); - defaults.font_string = xstrdup (ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_padding (struct cmdarg **args) -{ - rp_frame *frame; - int l, t, r, b; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d %d %d %d", - defaults.padding_left, - defaults.padding_top, - defaults.padding_right, - defaults.padding_bottom); - - l = ARG(0,number); - t = ARG(1,number); - r = ARG(2,number); - b = ARG(3,number); - - /* Resize the frames to make sure they are not too big and not too - small. */ - list_for_each_entry (frame,&(current_screen()->frames),node) - { - int bk_pos, bk_len; - - /* Resize horizontally. */ - bk_pos = frame->x; - bk_len = frame->width; - - if (frame->x == defaults.padding_left) - { - frame->x = l; - frame->width += bk_pos - l; - } - - if ((bk_pos + bk_len) == (current_screen()->left + current_screen()->width - defaults.padding_right)) - frame->width = current_screen()->left + current_screen()->width - r - frame->x; - - /* Resize vertically. */ - bk_pos = frame->y; - bk_len = frame->height; - - if (frame->y == defaults.padding_top) - { - frame->y = t; - frame->height += bk_pos - t; - } - - if ((bk_pos + bk_len) == (current_screen()->top + current_screen()->height - defaults.padding_bottom)) - frame->height = current_screen()->top + current_screen()->height - b - frame->y; - - maximize_all_windows_in_frame (frame); - } - - defaults.padding_left = l; - defaults.padding_right = r; - defaults.padding_top = t; - defaults.padding_bottom = b; - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_border (struct cmdarg **args) -{ - rp_window *win; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.window_border_width); - - if (ARG(0,number) < 0) - return cmdret_new (RET_FAILURE, "defborder: invalid argument"); - - defaults.window_border_width = ARG(0,number); - - /* Update all the visible windows. */ - list_for_each_entry (win,&rp_mapped_window,node) - { - if (win_get_frame (win)) - maximize (win); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_barborder (struct cmdarg **args) -{ - int i; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.bar_border_width); - - if (ARG(0,number) < 0) - return cmdret_new (RET_FAILURE, "defbarborder: invalid argument"); - - defaults.bar_border_width = ARG(0,number); - - /* Update the frame and bar windows. */ - for (i=0; i<num_screens; i++) - { - XSetWindowBorderWidth (dpy, screens[i].bar_window, defaults.bar_border_width); - XSetWindowBorderWidth (dpy, screens[i].frame_window, defaults.bar_border_width); - XSetWindowBorderWidth (dpy, screens[i].input_window, defaults.bar_border_width); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_barinpadding (struct cmdarg **args) -{ - int new_value; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.bar_in_padding); - - new_value = ARG(0,number); - if (new_value < 0) - return cmdret_new (RET_FAILURE, "defbarborder: invalid argument"); - - defaults.bar_in_padding = new_value; - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_inputwidth (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.input_window_size); - - if (ARG(0,number) < 0) - return cmdret_new (RET_FAILURE, "definputwidth: invalid argument"); - else - defaults.input_window_size = ARG(0,number); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_waitcursor (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.wait_for_key_cursor); - - defaults.wait_for_key_cursor = ARG(0,number); - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_infofmt (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.info_fmt); - - free (defaults.info_fmt); - defaults.info_fmt = xstrdup (ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_topkmap (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.top_kmap); - - if (!find_keymap (ARG_STRING(0))) - return cmdret_new(RET_FAILURE, "Unknown keymap %s", ARG_STRING(0)); - - ungrab_keys_all_wins(); - - free (defaults.top_kmap); - defaults.top_kmap = xstrdup (ARG_STRING(0)); - - grab_keys_all_wins(); - XSync(dpy, False); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_winfmt (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.window_fmt); - - free (defaults.window_fmt); - defaults.window_fmt = xstrdup (ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_winname (struct cmdarg **args) -{ - char *name; - - if (args[0] == NULL) - switch (defaults.win_name) - { - case WIN_NAME_TITLE: - return cmdret_new (RET_SUCCESS, "title"); - case WIN_NAME_RES_NAME: - return cmdret_new (RET_SUCCESS, "name"); - case WIN_NAME_RES_CLASS: - return cmdret_new (RET_SUCCESS, "class"); - default: - PRINT_DEBUG (("Unknown win_name\n")); - return cmdret_new (RET_FAILURE, "unknown"); - } - - name = ARG_STRING(0); - - /* FIXME: Using strncmp is sorta dirty since `title' and - `titlefoobar' would both match. But its quick and dirty. */ - if (!strncmp (name, "title", 5)) - defaults.win_name = WIN_NAME_TITLE; - else if (!strncmp (name, "name", 4)) - defaults.win_name = WIN_NAME_RES_NAME; - else if (!strncmp (name, "class", 5)) - defaults.win_name = WIN_NAME_RES_CLASS; - else - return cmdret_new (RET_FAILURE, "defwinname: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_framefmt (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.frame_fmt); - - free (defaults.frame_fmt); - defaults.frame_fmt = xstrdup (ARG_STRING(0)); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_fgcolor (struct cmdarg **args) -{ - int i; - XColor color, junk; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.fgcolor_string); - - for (i=0; i<num_screens; i++) - { - if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk)) - return cmdret_new (RET_FAILURE, "deffgcolor: unknown color"); - - screens[i].fg_color = color.pixel; - update_gc (&screens[i]); - XSetWindowBorder (dpy, screens[i].bar_window, color.pixel); - XSetWindowBorder (dpy, screens[i].input_window, color.pixel); - XSetWindowBorder (dpy, screens[i].frame_window, color.pixel); - XSetWindowBorder (dpy, screens[i].help_window, color.pixel); - -#ifdef USE_XFT_FONT - if (!XftColorAllocName (dpy, DefaultVisual (dpy, screens[i].screen_num), - DefaultColormap (dpy, screens[i].screen_num), - ARG_STRING(0), &screens[i].xft_fg_color)) - return cmdret_new (RET_FAILURE, "deffgcolor: unknown color"); -#endif - - free (defaults.fgcolor_string); - defaults.fgcolor_string = xstrdup (ARG_STRING(0)); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_bgcolor (struct cmdarg **args) -{ - int i; - XColor color, junk; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.bgcolor_string); - - for (i=0; i<num_screens; i++) - { - if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk)) - return cmdret_new (RET_FAILURE, "defbgcolor: unknown color"); - - screens[i].bg_color = color.pixel; - update_gc (&screens[i]); - XSetWindowBackground (dpy, screens[i].bar_window, color.pixel); - XSetWindowBackground (dpy, screens[i].input_window, color.pixel); - XSetWindowBackground (dpy, screens[i].frame_window, color.pixel); - XSetWindowBackground (dpy, screens[i].help_window, color.pixel); - -#ifdef USE_XFT_FONT - if (!XftColorAllocName (dpy, DefaultVisual (dpy, screens[i].screen_num), - DefaultColormap (dpy, screens[i].screen_num), - ARG_STRING(0), &screens[i].xft_bg_color)) - return cmdret_new (RET_FAILURE, "deffgcolor: unknown color"); -#endif - - free (defaults.bgcolor_string); - defaults.bgcolor_string = xstrdup (ARG_STRING(0)); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_fwcolor (struct cmdarg **args) -{ - int i; - XColor color, junk; - rp_window *win = current_window(); - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.fwcolor_string); - - for (i=0; i<num_screens; i++) - { - if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk)) - return cmdret_new (RET_FAILURE, "deffwcolor: unknown color"); - - screens[i].fw_color = color.pixel; - update_gc (&screens[i]); - - free (defaults.fwcolor_string); - defaults.fwcolor_string = xstrdup (ARG_STRING(0)); - } - - /* Update current window. */ - if (win != NULL) - XSetWindowBorder (dpy, win->w, win->scr->fw_color); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_bwcolor (struct cmdarg **args) -{ - int i; - XColor color, junk; - rp_window *win, *cur = current_window(); - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.bwcolor_string); - - for (i=0; i<num_screens; i++) - { - if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk)) - return cmdret_new (RET_FAILURE, "defbwcolor: unknown color"); - - screens[i].bw_color = color.pixel; - update_gc (&screens[i]); - - free (defaults.bwcolor_string); - defaults.bwcolor_string = xstrdup (ARG_STRING(0)); - } - - /* Update all the visible windows. */ - list_for_each_entry (win,&rp_mapped_window,node) - { - if (win != cur) - XSetWindowBorder (dpy, win->w, win->scr->bw_color); - } - - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_setenv (int interactive UNUSED, struct cmdarg **args) -{ - - const char *var = ARG_STRING(0), *val = ARG_STRING(1); - int ret; - -#ifdef HAVE_SETENV - - PRINT_DEBUG(("setenv (\"%s\", \"%s\", 1)\n", var, val)); - ret = setenv (var, val, 1); - -#else /* not HAVE_SETENV */ - - struct sbuf *env; - - /* Setup the environment string. */ - env = sbuf_new (strlen (var) + 1 + strlen (val) + 1); - - sbuf_copy (env, var); - sbuf_concat (env, "="); - sbuf_concat (env, val); - - /* Stick it in the environment. We must *not* free it. */ - PRINT_DEBUG(("putenv(\"%s\")\n", sbuf_get(env))); - ret = putenv (sbuf_free_struct (env)); - -#endif /* not HAVE_SETENV */ - - if (ret == -1) - return cmdret_new (RET_FAILURE, "cmd_setenv failed: %s", strerror(errno)); - else - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_getenv (int interactive UNUSED, struct cmdarg **args) -{ - char *value; - - value = getenv (ARG_STRING(0)); - if (value) - return cmdret_new (RET_SUCCESS, "%s", value); - else - return cmdret_new (RET_FAILURE, NULL); -} - -/* Thanks to Gergely Nagy <algernon@debian.org> for the original - patch. */ -cmdret * -cmd_chdir (int interactive UNUSED, struct cmdarg **args) -{ - char *dir; - - if (args[0] == NULL) - { - dir = getenv ("HOME"); - if (dir == NULL || *dir == '\0') - { - return cmdret_new (RET_FAILURE, "chdir: HOME not set"); - } - } - else - dir = ARG_STRING(0); - - if (chdir (dir) == -1) - return cmdret_new (RET_FAILURE, "chdir: %s: %s", dir, strerror(errno)); - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Thanks to Gergely Nagy <algernon@debian.org> for the original - patch. */ -cmdret * -cmd_unsetenv (int interactive UNUSED, struct cmdarg **args) -{ - const char *var = ARG_STRING(0); - int ret; - - /* Use unsetenv() where possible since putenv("FOO") is not legit everywhere */ -#ifdef HAVE_UNSETENV - ret = unsetenv(var); -#else - /* MinGW doesn't have unsetenv() and uses putenv("FOO=") */ - struct sbuf *s = sbuf_new (strlen (var) + 1 + 1); - sbuf_copy (s, var); - sbuf_concat (s, "="); - /* let putenv() decide whether to call free() */ - ret = putenv (sbuf_free_struct (s)); -#endif - - if (ret == -1) - return cmdret_new (RET_FAILURE, "cmd_unsetenv failed: %s", strerror (errno)); - else - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Thanks to Gergely Nagy <algernon@debian.org> for the original - patch. */ -cmdret * -cmd_info (int interactive UNUSED, struct cmdarg **args) -{ - struct sbuf *buf; - if (current_window() != NULL) - { - rp_window *win = current_window(); - rp_window_elem *win_elem; - win_elem = group_find_window (&rp_current_group->mapped_windows, win); - if (!win_elem) - win_elem = group_find_window (&rp_current_group->unmapped_windows, win); - if (!win_elem) - { - rp_group *g = groups_find_group_by_window(win); - if (g != NULL) - win_elem = group_find_window (&g->mapped_windows, win); - if (!win_elem && g != NULL) - win_elem = group_find_window (&g->unmapped_windows, win); - } - if (win_elem) - { - char *s; - cmdret *ret; - - if (args[0] == NULL) - s = defaults.info_fmt; - else - s = ARG_STRING(0); - buf = sbuf_new (0); - format_string (s, win_elem, buf); - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (buf)); - sbuf_free (buf); - return ret; - } - } - - return cmdret_new (RET_SUCCESS, "No window."); -} - -/* Thanks to Gergely Nagy <algernon@debian.org> for the original - patch. */ -cmdret * -cmd_lastmsg (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - show_last_message(); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_focusup (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_up (current_frame()))) - set_active_frame (frame, 0); - else - show_frame_indicator(0); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_focusdown (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_down (current_frame()))) - set_active_frame (frame, 0); - else - show_frame_indicator(0); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_focusleft (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_left (current_frame()))) - set_active_frame (frame, 0); - else - show_frame_indicator(0); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_focusright (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_right (current_frame()))) - set_active_frame (frame, 0); - else - show_frame_indicator(0); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_exchangeup (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_up (current_frame()))) - exchange_with_frame (current_frame(), frame); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_exchangedown (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_down (current_frame()))) - exchange_with_frame (current_frame(), frame); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_exchangeleft (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_left (current_frame()))) - exchange_with_frame (current_frame(), frame); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_exchangeright (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame; - - if ((frame = find_frame_right (current_frame()))) - exchange_with_frame (current_frame(), frame); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_swap (int interactive UNUSED, struct cmdarg **args) -{ - rp_screen *s; - rp_frame *dest_frame; - rp_frame *src_frame; - - dest_frame = ARG(0, frame); - src_frame = args[1] ? ARG (1, frame) : current_frame(); - - if (!rp_have_xinerama) - { - s = frames_screen(src_frame); - if (screen_find_frame_by_frame(s, dest_frame) == NULL) - return cmdret_new (RET_FAILURE, "swap: frames on different screens"); - } - - exchange_with_frame (src_frame, dest_frame); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_restart (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - hup_signalled = 1; - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_startup_message (int interactive, struct cmdarg **args) -{ - if (args[0] == NULL && !interactive) - return cmdret_new (RET_SUCCESS, "%s", defaults.startup_message ? "on":"off"); - - if (!strcasecmp (ARG_STRING(0), "on")) - defaults.startup_message = 1; - else if (!strcasecmp (ARG_STRING(0), "off")) - defaults.startup_message = 0; - else - return cmdret_new (RET_FAILURE, "startup_message: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_focuslast (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame *frame = find_last_frame(); - - if (frame) - set_active_frame (frame, 0); - else - return cmdret_new (RET_FAILURE, "focuslast: no other frame"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_link (int interactive, struct cmdarg **args) -{ - char *cmd = NULL; - rp_keymap *map; - - if (args[1]) - map = ARG(1,keymap); - else - map = find_keymap (ROOT_KEYMAP); - - cmd = resolve_command_from_keydesc (args[0]->string, 0, map); - if (cmd) - return command (interactive, cmd); - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Thanks to Doug Kearns <djkea2@mugc.its.monash.edu.au> for the - original patch. */ -static cmdret * -set_barpadding (struct cmdarg **args) -{ - int x, y; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d %d", defaults.bar_x_padding, defaults.bar_y_padding); - - x = ARG(0,number); - y = ARG(1,number); - - if (x >= 0 && y >= 0) - { - defaults.bar_x_padding = x; - defaults.bar_y_padding = y; - } - else - return cmdret_new (RET_FAILURE, "defbarpadding: invalid arguments"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_alias (int interactive UNUSED, struct cmdarg **args) -{ - /* Add or update the alias. */ - add_alias (ARG_STRING(0), ARG_STRING(1)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_unalias (int interactive UNUSED, struct cmdarg **args) -{ - int i; - - /* Are we updating an existing alias, or creating a new one? */ - i = find_alias_index (ARG_STRING(0)); - if (i >= 0) - { - char *tmp; - - alias_list_last--; - - /* Free the alias and put the last alias in the the space to - keep alias_list from becoming sparse. This code must jump - through some hoops to correctly handle the case when - alias_list_last == i. */ - tmp = alias_list[i].alias; - alias_list[i].alias = xstrdup (alias_list[alias_list_last].alias); - free (tmp); - free (alias_list[alias_list_last].alias); - - /* Do the same for the name element. */ - tmp = alias_list[i].name; - alias_list[i].name = xstrdup (alias_list[alias_list_last].name); - free (tmp); - free (alias_list[alias_list_last].name); - } - else - return cmdret_new (RET_SUCCESS, "unalias: alias not found"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_nextscreen (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - int new_screen; - - /* No need to go through the motions when we don't have to. */ - if (num_screens <= 1) - return cmdret_new (RET_FAILURE, "nextscreen: no other screen"); - - new_screen = rp_current_screen + 1; - if (new_screen >= num_screens) - new_screen = 0; - - set_active_frame (screen_get_frame (&screens[new_screen], screens[new_screen].current_frame), 1); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_prevscreen (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - int new_screen; - - /* No need to go through the motions when we don't have to. */ - if (num_screens <= 1) - return cmdret_new (RET_SUCCESS, "prevscreen: no other screen"); - - new_screen = rp_current_screen - 1; - if (new_screen < 0) - new_screen = num_screens - 1; - - set_active_frame (screen_get_frame (&screens[new_screen], screens[new_screen].current_frame), 1); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_sselect(int interactive UNUSED, struct cmdarg **args) -{ - int new_screen; - - new_screen = ARG(0,number); - if (new_screen < 0) - return cmdret_new (RET_FAILURE, "sselect: out of range"); - - if (new_screen < num_screens) - set_active_frame (screen_get_frame (&screens[new_screen], screens[new_screen].current_frame), 1); - else - return cmdret_new (RET_FAILURE, "sselect: out of range"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_warp (int interactive, struct cmdarg **args) -{ - if (args[0] == NULL && !interactive) - return cmdret_new (RET_SUCCESS, "%s", defaults.warp ? "on":"off"); - - if (!strcasecmp (ARG_STRING(0), "on")) - defaults.warp = 1; - else if (!strcasecmp (ARG_STRING(0), "off")) - defaults.warp = 0; - else - return cmdret_new (RET_FAILURE, "warp: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static void -sync_wins (rp_screen *s) -{ - rp_window *win, *wintmp; - XWindowAttributes attr; - unsigned int i, nwins; - Window dw1, dw2, *wins; - XQueryTree(dpy, s->root, &dw1, &dw2, &wins, &nwins); - - /* Remove any windows in our cached lists that aren't in the query - tree. These windows have been destroyed. */ - list_for_each_entry_safe (win, wintmp, &rp_mapped_window, node) - { - int found; - - found = 0; - for (i=0; i<nwins; i++) - { - if (win->w == wins[i]) - { - found = 1; - break; - } - } - if (!found) - { - ignore_badwindow++; - - /* If, somehow, the window is not withdrawn before it is destroyed, - perform the necessary steps to withdraw the window before it is - unmanaged. */ - if (win->state == IconicState) - { - PRINT_DEBUG (("Destroying Iconic Window (%s)\n", window_name (win))); - withdraw_window (win); - } - else if (win->state == NormalState) - { - rp_frame *frame; - - PRINT_DEBUG (("Destroying Normal Window (%s)\n", window_name (win))); - frame = find_windows_frame (win); - if (frame) - { - cleanup_frame (frame); - if (frame->number == win->scr->current_frame) - set_active_frame (frame, 0); - } - withdraw_window (win); - } - - /* Now that the window is guaranteed to be in the unmapped window - list, we can safely stop managing it. */ - unmanage (win); - ignore_badwindow--; - } - } - - for (i=0; i<nwins; i++) - { - XGetWindowAttributes(dpy, wins[i], &attr); - if (wins[i] == s->bar_window - || wins[i] == s->key_window - || wins[i] == s->input_window - || wins[i] == s->frame_window - || wins[i] == s->help_window - || attr.override_redirect == True) continue; - - /* Find the window in our mapped window list. */ - win = find_window_in_list (wins[i], &rp_mapped_window); - if (win) - { - rp_frame *frame; - /* If the window is viewable and it is in a frame, then - maximize it and go to the next window. */ - if (attr.map_state == IsViewable) - { - frame = find_windows_frame (win); - if (frame) - { - maximize (win); - } - else - { - hide_window (win); - } - } - else if (attr.map_state == IsUnmapped - && get_state (win) == IconicState) - { - frame = find_windows_frame (win); - if (frame) - { - unhide_window (win); - maximize (win); - } - } - else - { - PRINT_DEBUG (("I don't know what to do...\n")); - } - - /* We've handled the window. */ - continue; - } - - /* Try the unmapped window list. */ - win = find_window_in_list (wins[i], &rp_unmapped_window); - if (win) - { - /* If the window is viewable and it is in a frame, then - maximize it and go to the next window. */ - if (attr.map_state == IsViewable) - { - /* We need to map it since it's visible now. */ - map_window (win); - } - else if (attr.map_state == IsUnmapped - && get_state (win) == IconicState) - { - /* We need to map the window and then hide it. */ - map_window (win); - hide_window (win); - } - else - { - PRINT_DEBUG (("I think it's all sync'd up...\n")); - } - - /* We've handled the window. */ - continue; - } - - /* The window isn't in the mapped or unmapped window list so add - it. */ - win = add_to_window_list (s, wins[i]); - - /* If it's visible or iconized. "Map" it. */ - if (attr.map_state == IsViewable - || (attr.map_state == IsUnmapped - && get_state (win) == IconicState)) - map_window (win); - } - -} - -static int tmpwm_error_raised = 0; - -static int -tmpwm_error_handler (Display *d UNUSED, XErrorEvent *e) -{ - if (e->request_code == X_ChangeWindowAttributes && e->error_code == BadAccess) - { - PRINT_DEBUG (("failed to grab root properties\n")); - tmpwm_error_raised++; - } - return 0; -} - -/* Temporarily give control over to another window manager, reclaiming */ -/* control when that WM terminates. */ -cmdret * -cmd_tmpwm (int interactive UNUSED, struct cmdarg **args) -{ - struct list_head *tmp, *iter; - rp_window *win = NULL; - int child; - int status; - int pid; - int i; - int (*old_handler)(Display *, XErrorEvent *); - - push_frame_undo (current_screen()); /* fdump to stack */ - - /* Release event selection on the root windows, so the new WM can - have it. */ - for (i=0; i<num_screens; i++) - { - XSelectInput(dpy, RootWindow (dpy, screens[i].screen_num), 0); - deactivate_screen(&screens[i]); - } - - /* Ungrab all our keys. */ - ungrab_keys_all_wins(); - - /* Don't listen for any events from any window. */ - list_for_each_safe_entry (win, iter, tmp, &rp_mapped_window, node) - { - unhide_window (win); - maximize (win); - XSelectInput (dpy, win->w, 0); - } - - list_for_each_safe_entry (win, iter, tmp, &rp_unmapped_window, node) - XSelectInput (dpy, win->w, 0); - - XSync (dpy, False); - - /* Disable our SIGCHLD handler */ - set_sig_handler (SIGCHLD, SIG_DFL); - /* Launch the new WM and wait for it to terminate. */ - pid = spawn (ARG_STRING(0), 0, NULL); - PRINT_DEBUG (("spawn pid: %d\n", pid)); - do - { - child = waitpid (pid, &status, 0); - } while (child != -1 && child != pid); - /* Enable our SIGCHLD handler */ - set_sig_handler (SIGCHLD, chld_handler); - /* Some processes may have quit while our sigchld handler was - disabled, so check for them. */ - check_child_procs(); - - /* Enable the event selection on the root window. We need to loop - until we don't get an X error. This is due to a race between the - X server cleaning up after the temporary wm and ratpoison - grabbing events. */ - old_handler = XSetErrorHandler (tmpwm_error_handler); - do { - tmpwm_error_raised = 0; - for (i=0; i<num_screens; i++) - { - XSelectInput(dpy, RootWindow (dpy, screens[i].screen_num), - PropertyChangeMask | ColormapChangeMask - | SubstructureRedirectMask | SubstructureNotifyMask - | StructureNotifyMask); - XSync (dpy, False); - } - if (tmpwm_error_raised) - sleep(1); - } while (tmpwm_error_raised); - XSetErrorHandler (old_handler); - - for (i=0; i<num_screens; i++) - activate_screen (&screens[i]); - - /* Sort through all the windows in each group and pick out the ones - that are unmapped or destroyed. */ - for (i=0; i<num_screens; i++) - sync_wins (&screens[i]); - - /* At this point, new windows have the top level keys grabbed but - existing windows don't. So grab them on all windows just to be - sure. */ - grab_keys_all_wins(); - - /* If no window has focus, give the key_window focus. */ - if (current_window()) - set_active_window (current_window()); - else - set_window_focus (current_screen()->key_window); - - /* And we're back in ratpoison. */ - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Return a new string with the frame selector or it as a string if no - selector exists for the number. */ - -/* Select a frame by number. */ -cmdret * -cmd_fselect (int interactive, struct cmdarg **args) -{ - set_active_frame (ARG(0,frame), 1); - if (interactive) - return cmdret_new (RET_SUCCESS, NULL); - else - return cmdret_new (RET_SUCCESS, "%d", ARG(0,frame)->number); -} - -static char * -fdump (rp_screen *screen) -{ - struct sbuf *s; - char *tmp; - rp_frame *cur; - - s = sbuf_new (0); - - /* FIXME: Oooh, gross! there's a trailing comma, yuk! */ - list_for_each_entry (cur, &(screen->frames), node) - { - char *t; - - t = frame_dump (cur, screen); - sbuf_concat (s, t); - sbuf_concat (s, ","); - free (t); - } - - tmp = sbuf_free_struct (s); - return tmp; -} - -cmdret * -cmd_fdump (int interactively UNUSED, struct cmdarg **args) -{ - if (args[0] == NULL) - { - char *s = fdump (current_screen()); - cmdret *ret = cmdret_new (RET_SUCCESS, "%s", s); - free (s); - return ret; - } - else - { - int snum; - snum = ARG(0,number); - - if (snum < 0 || num_screens <= snum) - return cmdret_new (RET_FAILURE, "fdump: invalid argument"); - else - { - char *s = fdump (&screens[snum]); - cmdret *ret = cmdret_new (RET_SUCCESS, "%s", s); - free (s); - return ret; - } - } -} - -static cmdret * -frestore (char *data, rp_screen *s) -{ - char *token; - char *d; - rp_frame *new, *cur; - rp_window *win; - struct list_head fset; - int max = -1; - char *nexttok = NULL; - - INIT_LIST_HEAD (&fset); - - d = xstrdup (data); - token = strtok_r (d, ",", &nexttok); - if (token == NULL) - { - free (d); - return cmdret_new (RET_FAILURE, "frestore: invalid frame format"); - } - - /* Build the new frame set. */ - while (token != NULL) - { - new = frame_read (token, s); - if (new == NULL) - { - free (d); - return cmdret_new (RET_SUCCESS, "frestore: invalid frame format");; - } - list_add_tail (&new->node, &fset); - token = strtok_r (NULL, ",", &nexttok); - } - - free (d); - - /* Clear all the frames. */ - list_for_each_entry (cur, &s->frames, node) - { - PRINT_DEBUG (("blank %d\n", cur->number)); - blank_frame (cur); - } - - /* Get rid of the frames' numbers */ - screen_free_nums (s); - - /* Splice in our new frameset. */ - screen_restore_frameset (s, &fset); -/* numset_clear (s->frames_numset); */ - - /* Process the frames a bit to make sure everything lines up. */ - list_for_each_entry (cur, &s->frames, node) - { - PRINT_DEBUG (("restore %d %d\n", cur->number, cur->win_number)); - - /* Grab the frame's number, but if it already exists request a - new one. */ - if (!numset_add_num (s->frames_numset, cur->number)) { - cur->number = numset_request (s->frames_numset); - } - - /* Find the current frame based on last_access. */ - if (cur->last_access > max) - { - s->current_frame = cur->number; - max = cur->last_access; - } - - /* Update the window the frame points to. */ - if (cur->win_number != EMPTY) - { - set_frames_window (cur, find_window_number (cur->win_number)); - } - } - - /* Show the windows in the frames. */ - list_for_each_entry (win, &rp_mapped_window, node) - { - if (win->frame_number != EMPTY) - { - maximize (win); - unhide_window (win); - } - } - - set_active_frame (current_frame(), 0); - update_bar (s); - show_frame_indicator(0); - - PRINT_DEBUG (("Done.\n")); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_frestore (int interactively UNUSED, struct cmdarg **args) -{ - push_frame_undo (current_screen()); /* fdump to stack */ - return frestore (ARG_STRING(0), current_screen()); -} - -cmdret * -cmd_verbexec (int interactive UNUSED, struct cmdarg **args) -{ - marked_message_printf(0, 0, "Running %s", ARG_STRING(0)); - spawn (ARG_STRING(0), 0, current_frame()); - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_winliststyle (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.window_list_style ? "column":"row"); - - if (!strcmp ("column", ARG_STRING(0))) - defaults.window_list_style = STYLE_COLUMN; - else if (!strcmp ("row", ARG_STRING(0))) - defaults.window_list_style = STYLE_ROW; - else - return cmdret_new (RET_FAILURE, "defwinliststyle: invalid argument"); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gnext (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - set_current_group (group_next_group ()); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gprev (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - set_current_group (group_prev_group ()); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gother (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - set_current_group (group_last_group ()); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gnew (int interactive UNUSED, struct cmdarg **args) -{ - if (groups_find_group_by_name (ARG_STRING (0), 1)) - return cmdret_new (RET_FAILURE, "gnew: group already exists"); - set_current_group (group_add_new_group (ARG_STRING(0))); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gnewbg (int interactive UNUSED, struct cmdarg **args) -{ - if (groups_find_group_by_name (ARG_STRING (0), 1)) - return cmdret_new (RET_FAILURE, "gnewbg: group already exists"); - group_add_new_group (ARG_STRING(0)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gnumber (int interactive UNUSED, struct cmdarg **args) -{ - int old_number, new_number; - rp_group *other_g, *g; - -/* FIXME Implement this. */ -// if (args[0] == NULL) -// { -// /* XXX: Fix this. */ -// print_window_information (rp_current_group, current_window()); -// return cmdret_new (RET_SUCCESS, NULL); -// } - - /* Gather the args. */ - new_number = ARG(0,number); - if (args[1]) - g = groups_find_group_by_number (ARG(1,number)); - else - g = rp_current_group; - - /* Make the switch. */ - if ( new_number >= 0 && g) - { - /* Find other window with same number and give it old number. */ - other_g = groups_find_group_by_number (new_number); - if (other_g != NULL) - { - old_number = g->number; - other_g->number = old_number; - - /* Resort the window in the list */ - group_resort_group (other_g); - } - else - { - numset_release (group_numset, g->number); - } - - g->number = new_number; - numset_add_num (group_numset, new_number); - - /* resort the the window in the list */ - group_resort_group (g); - -/* FIXME Implement updating of groups bar. */ -// /* Update the window list. */ -// update_window_names (win->win->scr, defaults.window_fmt); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_grename (int interactive UNUSED, struct cmdarg **args) -{ - if (groups_find_group_by_name (ARG_STRING (0), 1)) - return cmdret_new (RET_FAILURE, "grename: duplicate group name"); - group_rename (rp_current_group, ARG_STRING(0)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gselect (int interactive, struct cmdarg **args) -{ - rp_group *g; - - g = find_group (ARG_STRING(0)); - - if (g) - set_current_group (g); - else - return cmd_groups (interactive, NULL); - - return cmdret_new (RET_SUCCESS, NULL); -} - -/* Show all the groups, with the current one highlighted. */ -cmdret * -cmd_groups (int interactive, struct cmdarg **args UNUSED) -{ - rp_group *cur; - int mark_start = 0, mark_end = 0; - struct sbuf *buffer; - rp_group *last; - - last = group_last_group (); - buffer = sbuf_new (0); - - /* Generate the string. */ - list_for_each_entry (cur, &rp_groups, node) - { - char *fmt; - char separator; - - if (cur == rp_current_group) - mark_start = strlen (sbuf_get (buffer)); - - /* Pad start of group name with a space for row - style. non-Interactive always gets a column.*/ - if (defaults.window_list_style == STYLE_ROW && interactive) - sbuf_concat (buffer, " "); - - if(cur == rp_current_group) - separator = '*'; - else if(cur == last) - separator = '+'; - else - separator = '-'; - - fmt = xsprintf ("%d%c%s", cur->number, separator, cur->name); - sbuf_concat (buffer, fmt); - free (fmt); - - /* Pad end of group name with a space for row style. */ - if (defaults.window_list_style == STYLE_ROW && interactive) - { - sbuf_concat (buffer, " "); - } - else - { - if (cur->node.next != &rp_groups) - sbuf_concat (buffer, "\n"); - } - - if (cur == rp_current_group) - mark_end = strlen (sbuf_get (buffer)); - } - - /* Display it or return it. */ - if (interactive) - { - marked_message (sbuf_get (buffer), mark_start, mark_end); - sbuf_free (buffer); - return cmdret_new (RET_SUCCESS, NULL); - } - else - { - cmdret *ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get(buffer)); - sbuf_free(buffer); - return ret; - } -} - -/* Move a window to a different group. */ -cmdret * -cmd_gmove (int interactive UNUSED, struct cmdarg **args) -{ - if (current_window() == NULL) - return cmdret_new (RET_FAILURE, "gmove: no focused window"); - - group_move_window (ARG(0,group), current_window()); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_gmerge (int interactive UNUSED, struct cmdarg **args) -{ - groups_merge (ARG(0,group), rp_current_group); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_addhook (int interactive UNUSED, struct cmdarg **args) -{ - struct list_head *hook; - struct sbuf *cmd; - - hook = hook_lookup (ARG_STRING(0)); - if (hook == NULL) - return cmdret_new (RET_FAILURE, "addhook: unknown hook '%s'", ARG_STRING(0)); - - /* Add the command to the hook */ - cmd = sbuf_new (0); - sbuf_copy (cmd, ARG_STRING(1)); - hook_add (hook, cmd); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_remhook (int interactive UNUSED, struct cmdarg **args) -{ - struct sbuf *cmd; - - /* Remove the command from the hook */ - cmd = sbuf_new (0); - sbuf_copy (cmd, ARG_STRING(1)); - hook_remove (ARG(0,hook), cmd); - sbuf_free (cmd); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_listhook (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret; - struct sbuf *buffer; - struct list_head *hook; - struct sbuf *cur; - - hook = hook_lookup (ARG_STRING(0)); - if (hook == NULL) - return cmdret_new (RET_FAILURE, "listhook: unknown hook '%s'", ARG_STRING(0)); - - if (list_empty(hook)) - return cmdret_new (RET_FAILURE, " Nothing defined for %s ", ARG_STRING(0)); - - buffer = sbuf_new(0); - - list_for_each_entry (cur, hook, node) - { - sbuf_printf_concat(buffer, "%s", sbuf_get (cur)); - if (cur->node.next != hook) - sbuf_printf_concat(buffer, "\n"); - } - - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (buffer)); - sbuf_free (buffer); - return ret; -} - -cmdret * -cmd_gdelete (int interactive UNUSED, struct cmdarg **args) -{ - rp_group *g; - - if (args[0] == NULL) - g = rp_current_group; - else - g = ARG(0,group); - - switch (group_delete_group (g)) - { - case GROUP_DELETE_GROUP_OK: - break; - case GROUP_DELETE_GROUP_NONEMPTY: - return cmdret_new (RET_FAILURE, "gdelete: non-empty group"); - break; - case GROUP_DELETE_LAST_GROUP: - return cmdret_new (RET_FAILURE, "gdelete: cannot delete the sole group"); - break; - default: - return cmdret_new (RET_FAILURE, "gdelete: unknown return code (this shouldn't happen)"); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_readkey (int interactive UNUSED, struct cmdarg **args) -{ - char *keysym_name; - rp_action *key_action; - KeySym keysym; /* Key pressed */ - unsigned int mod; /* Modifiers */ - int rat_grabbed = 0; - rp_keymap *map; - - map = ARG(0,keymap); - - /* Change the mouse icon to indicate to the user we are waiting for - more keystrokes */ - if (defaults.wait_for_key_cursor) - { - grab_rat(); - rat_grabbed = 1; - } - - read_single_key (&keysym, &mod, NULL, 0); - - if (rat_grabbed) - ungrab_rat(); - - if ((key_action = find_keybinding (keysym, x11_mask_to_rp_mask (mod), map))) - { - return command (1, key_action->data); - } - else - { - cmdret *ret; - /* No key match, notify user. */ - keysym_name = keysym_to_string (keysym, x11_mask_to_rp_mask (mod)); - ret = cmdret_new (RET_FAILURE, "readkey: unbound key '%s'", keysym_name); - free (keysym_name); - return ret; - } -} - -cmdret * -cmd_newkmap (int interactive UNUSED, struct cmdarg **args) -{ - rp_keymap *map; - - map = find_keymap (ARG_STRING(0)); - if (map) - return cmdret_new (RET_FAILURE, "newkmap: keymap '%s' already exists", ARG_STRING(0)); - - map = keymap_new (ARG_STRING(0)); - list_add_tail (&map->node, &rp_keymaps); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_delkmap (int interactive UNUSED, struct cmdarg **args) -{ - rp_keymap *map, *top, *root; - - top = find_keymap (defaults.top_kmap); - root = find_keymap (ROOT_KEYMAP); - - map = ARG(0,keymap); - if (map == root || map == top) - return cmdret_new (RET_FAILURE, "delkmap: cannot delete keymap '%s'", ARG_STRING(0)); - - list_del (&map->node); - - return cmdret_new (RET_SUCCESS, NULL); -} - -static cmdret * -set_framesels (struct cmdarg **args) -{ - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%s", defaults.frame_selectors); - - free (defaults.frame_selectors); - defaults.frame_selectors = xstrdup (ARG_STRING(0)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_set (int interactive UNUSED, struct cmdarg **args) -{ - if (args[0] == NULL) - { - /* List all the settings. */ - cmdret *ret; - struct sbuf *s = sbuf_new(0); - struct set_var *cur, *last; - - list_last (last, &set_vars, node); - list_for_each_entry (cur, &set_vars, node) - { - cmdret *r; - r = cur->set_fn (args); - sbuf_printf_concat (s, "%s: %s", cur->var, r->output); - /* Skip a newline on the last line. */ - if (cur != last) - sbuf_concat (s, "\n"); - cmdret_free (r); - } - - /* Return the accumulated string. */ - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (s)); - sbuf_free (s); - return ret; - } - else - { - struct sbuf *scur; - struct cmdarg *acur; - struct list_head *iter, *tmp; - struct list_head head, arglist; - int i, nargs = 0, raw = 0; - int parsed_args; - cmdret *result = NULL; - struct cmdarg **cmdargs; - char *input; - - INIT_LIST_HEAD (&arglist); - INIT_LIST_HEAD (&head); - - /* We need to tell parse_args about arg_REST and arg_SHELLCMD. */ - for (i=0; i<ARG(0,variable)->nargs; i++) - if (ARG(0,variable)->args[i].type == arg_REST - || ARG(0,variable)->args[i].type == arg_COMMAND - || ARG(0,variable)->args[i].type == arg_SHELLCMD - || ARG(0,variable)->args[i].type == arg_RAW) - { - raw = 1; - nargs = i; - break; - } - - /* Parse the arguments and call the function. */ - if (args[1]) - input = xstrdup (args[1]->string); - else - input = xstrdup (""); - result = parse_args (input, &head, nargs, raw); - free (input); - - if (result) - goto failed; - result = parsed_input_to_args (ARG(0,variable)->nargs, ARG(0,variable)->args, - &head, &arglist, &parsed_args, NULL); - if (result) - goto failed; - /* 0 or nargs is acceptable */ - if (list_size (&arglist) > 0 && list_size (&arglist) < ARG(0,variable)->nargs) - { - result = cmdret_new (RET_FAILURE, "not enough arguments."); - goto failed; - } - else if (list_size (&head) > ARG(0,variable)->nargs) - { - result = cmdret_new (RET_FAILURE, "too many arguments."); - goto failed; - } - - cmdargs = arg_array (&arglist); - result = ARG(0,variable)->set_fn (cmdargs); - free (cmdargs); - - /* Free the lists. */ - failed: - /* Free the parsed strings */ - list_for_each_safe_entry (scur, iter, tmp, &head, node) - sbuf_free(scur); - /* Free the args */ - list_for_each_safe_entry (acur, iter, tmp, &arglist, node) - arg_free (acur); - - return result; - } -} - -cmdret * -cmd_sfdump (int interactively UNUSED, struct cmdarg **args UNUSED) -{ - cmdret *ret; - struct sbuf *s; - char *tmp2; - rp_frame *cur; - int i; - - s = sbuf_new (0); - - for (i=0; i<num_screens; i++) - { - tmp2 = xsprintf (" %d,", (rp_have_xinerama)?(screens[i].xine_screen_num):(screens[i].screen_num)); - - /* FIXME: Oooh, gross! there's a trailing comma, yuk! */ - list_for_each_entry (cur, &(screens[i].frames), node) - { - char *tmp; - - tmp = frame_dump (cur, &screens[i]); - sbuf_concat (s, tmp); - sbuf_concat (s, tmp2); - free (tmp); - } - - free (tmp2); - } - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (s)); - sbuf_free (s); - return ret; -} - -cmdret * -cmd_sfrestore (int interactively UNUSED, struct cmdarg **args) -{ - int out_of_screen = 0; - int number_of_frames = 0; - int j; - long x; - char *d; - char *token; - char *ptr; - struct sbuf *buffer[num_screens]; - - /* initialize frameset-buffer for each screen */ - for (j=0; j<num_screens; j++) { - buffer[j] = sbuf_new(0); - } - - /* now split the whole input to the corresponding screens */ - d = xstrdup (ARG_STRING(0)); - - token = strtok (d, ","); - if (token == NULL) { - free (d); - return cmdret_new (RET_FAILURE, "sfrestore: invalid frame format"); - } - - while (token != NULL) { - /* search for end of frameset */ - ptr = token; - while (*ptr != ')') { - ptr++; - } - /* skip space */ - ptr++; - - /* convert to integer */ - x = strtol (ptr, NULL, 10); - - /* check that specified screen number is not bigger than current number of connected screens */ - if (x < num_screens) { - /* append frameset to buffer[x] */ - sbuf_concat(buffer[x], token); - sbuf_concat(buffer[x], ","); - number_of_frames++; - } - else { - out_of_screen++; - } - - /* continue with next frameset */ - token = strtok (NULL, ","); - } - - free (d); - - /* now restore the frames for each screen */ - for (j=0; j<num_screens; j++) { - push_frame_undo (&screens[j]); /* fdump to stack */ - /* FIXME: store RET_SUCCESS || RET_FAILURE for each screen and output it later */ - frestore (sbuf_get(buffer[j]), &screens[j]); - /* clear buffer */ - sbuf_free(buffer[j]); - } - - if (!out_of_screen) { - return cmdret_new (RET_SUCCESS, "Restored %i Frame(s)", number_of_frames); - } - else { - return cmdret_new (RET_SUCCESS, "Restored %i Frame(s), %i Frame(s) out of Screen(s)", number_of_frames, out_of_screen); - } -} - -cmdret * -cmd_sdump (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - cmdret *ret; - struct sbuf *s; - char *tmp; - int i; - - s = sbuf_new (0); - for (i=0; i<num_screens; ++i) - { - tmp = screen_dump (&screens[i]); - sbuf_concat (s, tmp); - if (i + 1 != num_screens) /* No trailing comma. */ - sbuf_concat (s, ","); - free (tmp); - } - - ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (s)); - sbuf_free (s); - return ret; -} - -static cmdret * -set_maxundos (struct cmdarg **args) -{ - rp_frame_undo *cur; - - if (args[0] == NULL) - return cmdret_new (RET_SUCCESS, "%d", defaults.maxundos); - - if (ARG(0,number) < 0) - return cmdret_new (RET_FAILURE, "defmaxundos: invalid argument"); - - defaults.maxundos = ARG(0,number); - - /* Delete any superfluous undos */ - while (list_size (&rp_frame_undos) > defaults.maxundos) - { - /* Delete the oldest node */ - list_last (cur, &rp_frame_undos, node); - del_frame_undo (cur); - } - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_cnext (int interactive, struct cmdarg **args) -{ - rp_window *cur, *last, *win; - - cur = current_window(); - if (!cur || !cur->res_class) /* Can't be done. */ - return cmd_next (interactive, args); - - /* CUR !in cycle list, so LAST marks last node. */ - last = group_prev_window (rp_current_group, cur); - - if (last) - for (win = group_next_window (rp_current_group, cur); - win; - win = group_next_window (rp_current_group, win)) - { - if (win->res_class - && strcmp (cur->res_class, win->res_class)) - { - set_active_window_force (win); - return cmdret_new (RET_SUCCESS, NULL); - } - - if (win == last) break; - } - - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); -} - -cmdret * -cmd_cprev (int interactive, struct cmdarg **args) -{ - rp_window *cur, *last, *win; - - cur = current_window(); - if (!cur || !cur->res_class) /* Can't be done. */ - return cmd_next (interactive, args); - - /* CUR !in cycle list, so LAST marks last node. */ - last = group_next_window (rp_current_group, cur); - - if (last) - for (win = group_prev_window (rp_current_group, cur); - win; - win = group_prev_window (rp_current_group, win)) - { - if (win->res_class - && strcmp (cur->res_class, win->res_class)) - { - set_active_window_force (win); - return cmdret_new (RET_SUCCESS, NULL); - } - - if (win == last) break; - } - - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); -} - -cmdret * -cmd_inext (int interactive, struct cmdarg **args) -{ - rp_window *cur, *last, *win; - - cur = current_window(); - if (!cur || !cur->res_class) /* Can't be done. */ - return cmd_next (interactive, args); - - /* CUR !in cycle list, so LAST marks last node. */ - last = group_prev_window (rp_current_group, cur); - - if (last) - for (win = group_next_window (rp_current_group, cur); - win; - win = group_next_window (rp_current_group, win)) - { - if (win->res_class - && !strcmp (cur->res_class, win->res_class)) - { - set_active_window_force (win); - return cmdret_new (RET_SUCCESS, NULL); - } - - if (win == last) break; - } - - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); -} - -cmdret * -cmd_iprev (int interactive, struct cmdarg **args) -{ - rp_window *cur, *last, *win; - - cur = current_window(); - if (!cur || !cur->res_class) /* Can't be done. */ - return cmd_next (interactive, args); - - /* CUR !in cycle list, so LAST marks last node. */ - last = group_next_window (rp_current_group, cur); - - if (last) - for (win = group_prev_window (rp_current_group, cur); - win; - win = group_prev_window (rp_current_group, win)) - { - if (win->res_class - && !strcmp (cur->res_class, win->res_class)) - { - set_active_window_force (win); - return cmdret_new (RET_SUCCESS, NULL); - } - - if (win == last) break; - } - - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); -} - -cmdret * -cmd_cother (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_window *cur, *w = NULL; - - cur = current_window(); - if (cur) - w = group_last_window_by_class (rp_current_group, cur->res_class); - - if (!w) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); - else - set_active_window_force (w); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_iother (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_window *cur, *w = NULL; - - cur = current_window(); - if (cur) - w = group_last_window_by_class_complement (rp_current_group, cur->res_class); - - if (!w) - return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW); - else - set_active_window_force (w); - - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_undo (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame_undo *cur; - - cur = pop_frame_undo (); - if (!cur) - return cmdret_new (RET_FAILURE, "No more undo information available"); - else - { - cmdret *ret; - - ret = frestore (cur->frames, cur->screen); - return ret; - } -} - -cmdret * -cmd_redo (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - rp_frame_undo *cur; - - /* The current layout goes on the undo. */ - - cur = pop_frame_redo (); - if (!cur) - return cmdret_new (RET_FAILURE, "No more redo information available"); - else - { - cmdret *ret; - - ret = frestore (cur->frames, cur->screen); - return ret; - } -} - -cmdret * -cmd_prompt (int interactive UNUSED, struct cmdarg **args) -{ - cmdret *ret; - char *output; - - if (args[0] == NULL) - output = get_input (MESSAGE_PROMPT_COMMAND, hist_PROMPT, - trivial_completions); - else - { - char *arg_str, *prefix; - - arg_str = ARG_STRING(0); - prefix = strchr (arg_str, ':'); - - if (prefix) - { - struct sbuf *query; - - prefix++; /* Don't return the colon. */ - query = sbuf_new (prefix - arg_str); - sbuf_nconcat (query, arg_str, prefix - arg_str); - output = get_more_input (sbuf_get (query), prefix, hist_PROMPT, - trivial_completions); - sbuf_free (query); - } - else - { - output = get_input (arg_str, hist_PROMPT, trivial_completions); - } - } - - if (output == NULL) - return cmdret_new (RET_FAILURE, NULL); /* User aborted */ - - ret = cmdret_new (RET_SUCCESS, "%s", output); - free (output); - - return ret; -} - -cmdret * -cmd_describekey (int interactive UNUSED, struct cmdarg **args) -{ - char *keysym_name; - rp_action *key_action; - KeySym keysym; /* Key pressed */ - unsigned int mod; /* Modifiers */ - int rat_grabbed = 0; - rp_keymap *map; - - map = ARG(0,keymap); - - /* Change the mouse icon to indicate to the user we are waiting for - more keystrokes */ - if (defaults.wait_for_key_cursor) - { - grab_rat(); - rat_grabbed = 1; - } - - read_single_key (&keysym, &mod, NULL, 0); - - if (rat_grabbed) - ungrab_rat(); - - if ((key_action = find_keybinding (keysym, x11_mask_to_rp_mask (mod), map))) - { - cmdret *ret; - keysym_name = keysym_to_string (keysym, x11_mask_to_rp_mask (mod)); - ret = cmdret_new (RET_SUCCESS, "%s bound to '%s'", keysym_name, key_action->data); - free (keysym_name); - return ret; - } - else - { - cmdret *ret; - /* No key match, notify user. */ - keysym_name = keysym_to_string (keysym, x11_mask_to_rp_mask (mod)); - ret = cmdret_new (RET_SUCCESS, "describekey: unbound key '%s'", keysym_name); - free (keysym_name); - return ret; - } -} - -cmdret * -cmd_dedicate (int interactive UNUSED, struct cmdarg **args) -{ - rp_frame *f; - - f = current_frame(); - if (!f) return cmdret_new (RET_SUCCESS, NULL); - - if (args[0]) - /* Whatever you set it to. */ - f->dedicated = ARG(0,number); - else - /* Just toggle it, rather than on or off. */ - f->dedicated = !(f->dedicated); - - return cmdret_new (RET_SUCCESS, "Consider this frame %s.", - f->dedicated ? "chaste":"promiscuous"); -} - -cmdret * -cmd_putsel (int interactive UNUSED, struct cmdarg **args) -{ - set_selection(ARG_STRING(0)); - return cmdret_new (RET_SUCCESS, NULL); -} - -cmdret * -cmd_getsel (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - char *sel = get_selection(); - cmdret *ret; - ret = cmdret_new (RET_SUCCESS, "%s", sel); - free (sel); - return ret; -} - -/* This is a command that restores old commands that have been - recently depricated. */ -cmdret * -cmd_compat (int interactive UNUSED, struct cmdarg **args UNUSED) -{ - add_alias ("defresizeunit", "set resizeunit"); - add_alias ("defwingravity", "set wingravity"); - add_alias ("deftransgravity", "set transgravity"); - add_alias ("defmaxsizegravity", "set maxsizegravity"); - add_alias ("defbargravity", "set bargravity"); - add_alias ("deffont", "set font"); - add_alias ("defpadding", "set padding"); - add_alias ("defborder", "set border"); - add_alias ("defbarborder", "set barborder"); - add_alias ("definputwidth", "set inputwidth"); - add_alias ("defwaitcursor", "set waitcursor"); - add_alias ("defwinfmt", "set winfmt"); - add_alias ("defwinname", "set winname"); - add_alias ("deffgcolor", "set fgcolor"); - add_alias ("defbgcolor", "set bgcolor"); - add_alias ("defbarpadding", "set barpadding"); - add_alias ("defwinliststyle", "set winliststyle"); - add_alias ("defframesels", "set framesels"); - add_alias ("defmaxundos", "set maxundos"); - - return cmdret_new (RET_SUCCESS, NULL); -} diff --git a/src/actions.h b/src/actions.h deleted file mode 100644 index 519c1a7..0000000 --- a/src/actions.h +++ /dev/null @@ -1,239 +0,0 @@ -/* Prototypes of all actions that can be performed with keystrokes. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_ACTIONS_H -#define _RATPOISON_ACTIONS_H 1 - -#define MAX_COMMAND_LENGTH 100 -#define MAX_ARGS_LENGTH 100 - -#include <ratpoison.h> - -typedef struct user_command user_command; - -/* arg_REST and arg_SHELLCMD eat the rest of the input. */ -enum argtype { arg_REST, - arg_NUMBER, - arg_STRING, - arg_FRAME, - arg_WINDOW, - arg_COMMAND, - arg_SHELLCMD, - arg_KEYMAP, - arg_KEY, - arg_GRAVITY, - arg_GROUP, - arg_HOOK, - arg_VARIABLE, - arg_RAW}; - -union arg_union { - rp_frame *frame; - int number; - float fnumber; - rp_window *win; - rp_keymap *keymap; - rp_group *group; - struct list_head *hook; - struct set_var *variable; - struct rp_key *key; - int gravity; - }; - -struct cmdarg -{ - int type; - char *string; - union arg_union arg; - struct list_head node; -}; - -struct argspec -{ - int type; - char *prompt; -}; - -/* The structure returned by a command. */ -typedef struct cmdret cmdret; -struct cmdret -{ - char *output; - int success; -}; - -struct -user_command -{ - char *name; - cmdret * (*func)(int, struct cmdarg **); - struct argspec *args; - int num_args; - /* The number of required arguments. Any arguments after that are - optional and won't be filled in when called - interactively. ni_required_args is used when called non-interactively, - i_required_args when called interactively. */ - int ni_required_args, i_required_args; - - struct list_head node; -}; - -int spawn(char *data, int raw, rp_frame *frame); -cmdret *command (int interactive, char *data); - -/* command function prototypes. */ -#define RP_CMD(cmd) cmdret *cmd_ ## cmd (int interactive, struct cmdarg **args) -RP_CMD (abort); -RP_CMD (addhook); -RP_CMD (alias); -RP_CMD (banish); -RP_CMD (banishrel); -RP_CMD (bind); -RP_CMD (compat); -RP_CMD (chdir); -RP_CMD (clrunmanaged); -RP_CMD (colon); -RP_CMD (curframe); -RP_CMD (delete); -RP_CMD (echo); -RP_CMD (escape); -RP_CMD (exec); -RP_CMD (execa); -RP_CMD (execf); -RP_CMD (fdump); -RP_CMD (focusdown); -RP_CMD (focuslast); -RP_CMD (focusleft); -RP_CMD (focusright); -RP_CMD (focusup); -RP_CMD (exchangeup); -RP_CMD (exchangedown); -RP_CMD (exchangeleft); -RP_CMD (exchangeright); -RP_CMD (swap); -RP_CMD (frestore); -RP_CMD (fselect); -RP_CMD (gdelete); -RP_CMD (getenv); -RP_CMD (gmerge); -RP_CMD (gmove); -RP_CMD (gnew); -RP_CMD (gnewbg); -RP_CMD (gnext); -RP_CMD (gnumber); -RP_CMD (gprev); -RP_CMD (gother); -RP_CMD (gravity); -RP_CMD (grename); -RP_CMD (groups); -RP_CMD (gselect); -RP_CMD (h_split); -RP_CMD (help); -RP_CMD (info); -RP_CMD (kill); -RP_CMD (lastmsg); -RP_CMD (license); -RP_CMD (link); -RP_CMD (listhook); -RP_CMD (meta); -RP_CMD (msgwait); -RP_CMD (newwm); -RP_CMD (next); -RP_CMD (next_frame); -RP_CMD (nextscreen); -RP_CMD (number); -RP_CMD (only); -RP_CMD (other); -RP_CMD (prev); -RP_CMD (prev_frame); -RP_CMD (prevscreen); -RP_CMD (quit); -RP_CMD (redisplay); -RP_CMD (remhook); -RP_CMD (remove); -RP_CMD (rename); -RP_CMD (resize); -RP_CMD (restart); -RP_CMD (rudeness); -RP_CMD (select); -RP_CMD (setenv); -RP_CMD (shrink); -RP_CMD (source); -RP_CMD (startup_message); -RP_CMD (time); -RP_CMD (tmpwm); -RP_CMD (unalias); -RP_CMD (unbind); -RP_CMD (unimplemented); -RP_CMD (unmanage); -RP_CMD (unsetenv); -RP_CMD (v_split); -RP_CMD (verbexec); -RP_CMD (version); -RP_CMD (warp); -RP_CMD (windows); -RP_CMD (readkey); -RP_CMD (newkmap); -RP_CMD (delkmap); -RP_CMD (definekey); -RP_CMD (undefinekey); -RP_CMD (set); -RP_CMD (sselect); -RP_CMD (ratwarp); -RP_CMD (ratinfo); -RP_CMD (ratrelinfo); -RP_CMD (ratclick); -RP_CMD (ratrelwarp); -RP_CMD (rathold); -RP_CMD (cnext); -RP_CMD (cother); -RP_CMD (cprev); -RP_CMD (dedicate); -RP_CMD (describekey); -RP_CMD (inext); -RP_CMD (iother); -RP_CMD (iprev); -RP_CMD (prompt); -RP_CMD (sdump); -RP_CMD (sfdump); -RP_CMD (sfrestore); -RP_CMD (undo); -RP_CMD (redo); -RP_CMD (putsel); -RP_CMD (getsel); - -void del_frame_undo (rp_frame_undo *u); - -rp_keymap *find_keymap (char *name); -void init_user_commands(void); -void initialize_default_keybindings (void); -cmdret *cmdret_new (int success, char *fmt, ...); -void cmdret_free (cmdret *ret); -void keymap_free (rp_keymap *map); -void free_user_commands (void); -void free_aliases (void); -void free_keymaps (void); -char *wingravity_to_string (int g); -rp_action* find_keybinding (KeySym keysym, unsigned int state, rp_keymap *map); -rp_action* find_keybinding_by_action (char *action, rp_keymap *map); - - -#endif /* ! _RATPOISON_ACTIONS_H */ diff --git a/src/bar.c b/src/bar.c deleted file mode 100644 index 8af3308..0000000 --- a/src/bar.c +++ /dev/null @@ -1,607 +0,0 @@ -/* Functionality for a bar across the bottom of the screen listing the - * windows currently managed. - * - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#ifdef USE_XFT_FONT -#include <X11/Xft/Xft.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "ratpoison.h" - -#include "assert.h" - -/* Possible values for bar_is_raised status. */ -#define BAR_IS_HIDDEN 0 -#define BAR_IS_WINDOW_LIST 1 -#define BAR_IS_MESSAGE 2 - -/* A copy of the last message displayed in the message bar. */ -static char *last_msg = NULL; -static int last_mark_start = 0; -static int last_mark_end = 0; - -static void marked_message_internal (char *msg, int mark_start, int mark_end); - -/* Reset the alarm to auto-hide the bar in BAR_TIMEOUT seconds. */ -static void -reset_alarm (void) -{ - alarm (defaults.bar_timeout); - alarm_signalled = 0; -} - -/* Hide the bar from sight. */ -int -hide_bar (rp_screen *s) -{ - if (s->bar_is_raised) - { - s->bar_is_raised = 0; - XUnmapWindow (dpy, s->bar_window); - - /* Possibly restore colormap. */ - if (current_window()) - { - XUninstallColormap (dpy, s->def_cmap); - XInstallColormap (dpy, current_window()->colormap); - } - - return 1; - } - - return 0; -} - -/* Show window listing in bar. */ -int -show_bar (rp_screen *s, char *fmt) -{ - if (!s->bar_is_raised) - { - s->bar_is_raised = BAR_IS_WINDOW_LIST; - XMapRaised (dpy, s->bar_window); - update_window_names (s, fmt); - - /* Switch to the default colormap */ - if (current_window()) - XUninstallColormap (dpy, current_window()->colormap); - XInstallColormap (dpy, s->def_cmap); - - reset_alarm(); - return 1; - } - - /* If the bar is raised we still need to display the window - names. */ - update_window_names (s, fmt); - return 0; -} - -int -bar_x (rp_screen *s, int width) -{ - int x = 0; - - switch (defaults.bar_location) - { - case NorthWestGravity: - case WestGravity: - case SouthWestGravity: - x = s->left + (defaults.bar_in_padding ? 0 : defaults.padding_left); - break; - case NorthGravity: - case CenterGravity: - case SouthGravity: - x = s->left + (s->width - width - defaults.bar_border_width * 2) / 2 - - (defaults.bar_in_padding ? 0 : defaults.padding_left); - break; - case NorthEastGravity: - case EastGravity: - case SouthEastGravity: - x = s->left + s->width - width - defaults.bar_border_width * 2 - - (defaults.bar_in_padding ? 0 : defaults.padding_right); - break; - } - - return x; -} - -int -bar_y (rp_screen *s, int height) -{ - int y = 0; - - switch (defaults.bar_location) - { - case NorthEastGravity: - case NorthGravity: - case NorthWestGravity: - y = s->top + (defaults.bar_in_padding ? 0 : defaults.padding_top); - break; - case EastGravity: - case CenterGravity: - case WestGravity: - y = s->top + (s->height - height - - defaults.bar_border_width * 2) / 2 - - (defaults.bar_in_padding ? 0 : defaults.padding_top); - break; - case SouthEastGravity: - case SouthGravity: - case SouthWestGravity: - y = s->top + (s->height - height - - defaults.bar_border_width * 2) - - (defaults.bar_in_padding ? 0 : defaults.padding_top); - break; - } - - return y; -} - -void -update_bar (rp_screen *s) -{ - if (s->bar_is_raised == BAR_IS_WINDOW_LIST) { - update_window_names (s, defaults.window_fmt); - return; - } - - if (s->bar_is_raised == BAR_IS_HIDDEN) - return; - - redraw_last_message(); -} - -/* Note that we use marked_message_internal to avoid resetting the - alarm. */ -void -update_window_names (rp_screen *s, char *fmt) -{ - struct sbuf *bar_buffer; - int mark_start = 0; - int mark_end = 0; - - if (s->bar_is_raised != BAR_IS_WINDOW_LIST) return; - - bar_buffer = sbuf_new (0); - - if(defaults.window_list_style == STYLE_ROW) - { - get_window_list (fmt, NULL, bar_buffer, &mark_start, &mark_end); - marked_message_internal (sbuf_get (bar_buffer), mark_start, mark_end); - } - else - { - get_window_list (fmt, "\n", bar_buffer, &mark_start, &mark_end); - marked_message_internal (sbuf_get (bar_buffer), mark_start, mark_end); - } - - -/* marked_message (sbuf_get (bar_buffer), mark_start, mark_end); */ - sbuf_free (bar_buffer); -} - -void -message (char *s) -{ - marked_message (s, 0, 0); -} - -void -marked_message_printf (int mark_start, int mark_end, char *fmt, ...) -{ - char *buffer; - va_list ap; - - va_start (ap, fmt); - buffer = xvsprintf (fmt, ap); - va_end (ap); - - marked_message (buffer, mark_start, mark_end); - free (buffer); -} - -static int -count_lines (char* msg, int len) -{ - int ret = 1; - int i; - - if (len < 1) - return 1; - - for(i=0; i<len; i++) - { - if (msg[i] == '\n') ret++; - } - - return ret; -} - - -static int -max_line_length (char* msg) -{ - rp_screen *s = current_screen (); - size_t i; - size_t start; - int ret = 0; - - /* Count each line and keep the length of the longest one. */ - for(start=0, i=0; i <= strlen(msg); i++) - { - if(msg[i] == '\n' || msg[i] == '\0') - { - int current_width; - - /* Check if this line is the longest so far. */ - current_width = rp_text_width (s, msg + start, i - start); - if(current_width > ret) - { - ret = current_width; - } - - /* Update the start of the new line. */ - start = i + 1; - } - } - - return ret; -} - -static int -pos_in_line (char* msg, int pos) -{ - int ret; - int i; - - if(pos <= 0) - return 0; - - /* Go backwards until we hit the beginning of the string or a new - line. */ - ret = 0; - for(i=pos-1; i>=0; ret++, i--) - { - if(msg[i]=='\n') - break; - } - - return ret; -} - -static int -line_beginning (char* msg, int pos) -{ - int ret = 0; - int i; - - if(pos <= 0) - return 0; - - /* Go backwards until we hit a new line or the beginning of the - string. */ - for(i=pos-1; i>=0; --i) - { - if (msg[i]=='\n') - { - ret = i + 1; - break; - } - } - - return ret; -} - -static void -draw_partial_string (rp_screen *s, char *msg, int line_no, int start, int end, int style) -{ - int line_height = FONT_HEIGHT (s); - - rp_draw_string (s, s->bar_window, style, - defaults.bar_x_padding, - defaults.bar_y_padding + FONT_ASCENT(s) - + line_no * line_height, - msg + start, end - start + 1); -} - -static void -draw_string (rp_screen *s, char *msg, int mark_start, int mark_end) -{ - size_t i; - int line_no; - int start; - int style = STYLE_NORMAL, update = 0; - - /* Walk through the string, print each line. */ - start = 0; - line_no = 0; -/* if (mark_start == 0 && mark_end == 0) */ -/* mark_start = mark_end = -1; */ - - for(i=0; i < strlen(msg); ++i) - { - if (i == (size_t)mark_start) - { - style = STYLE_INVERSE; - update = 1; - } - if (i == (size_t)mark_end) - { - style = STYLE_NORMAL; - update = 1; - } - if (msg[i] == '\n') - update = 2; - - if (update) - { - draw_partial_string (s, msg, line_no, start, update == 2 ? i-1:i, style); - start = i; - if (update == 2) - { - line_no++; - start++; - } - update = 0; - } - } - - /* Print the last line. */ - draw_partial_string (s, msg, line_no, start, strlen (msg)-1, style); - XSync (dpy, False); -} - -/* Move the marks if they are outside the string or if the start is - after the end. */ -static void -correct_mark (int msg_len, int *mark_start, int *mark_end) -{ - /* Make sure the marks are inside the string. */ - if (*mark_start < 0) - *mark_start = 0; - - if (*mark_end < 0) - *mark_end = 0; - - if (*mark_start > msg_len) - *mark_start = msg_len; - - if (*mark_end > msg_len) - *mark_end = msg_len; - - /* Make sure the marks aren't reversed. */ - if (*mark_start > *mark_end) - { - int tmp; - tmp = *mark_start; - *mark_start = *mark_end; - *mark_end = tmp; - } - -} - -/* Raise the bar and put it in the right spot */ -static void -prepare_bar (rp_screen *s, int width, int height) -{ - width = width < s->width ? width : s->width; - height = height < s->height ? height : s->height; - XMoveResizeWindow (dpy, s->bar_window, - bar_x (s, width), bar_y (s, height), - width, height); - - /* Map the bar if needed */ - if (!s->bar_is_raised) - { - s->bar_is_raised = BAR_IS_MESSAGE; - XMapRaised (dpy, s->bar_window); - - /* Switch to the default colormap */ - if (current_window()) - XUninstallColormap (dpy, current_window()->colormap); - XInstallColormap (dpy, s->def_cmap); - } - - XRaiseWindow (dpy, s->bar_window); - XClearWindow (dpy, s->bar_window); - XSync (dpy, False); -} - -static void -get_mark_box (char *msg, size_t mark_start, size_t mark_end, - int *x, int *y, int *width, int *height) -{ - rp_screen *s = current_screen (); - int start, end; - int mark_end_is_new_line = 0; - int start_line; - int end_line; - int start_pos_in_line; - int end_pos_in_line; - int start_line_beginning; - int end_line_beginning; - - /* If the mark_end is on a new line or the end of the string, then - back it up one character. */ - if (msg[mark_end-1] == '\n' || mark_end == strlen (msg)) - { - mark_end--; - mark_end_is_new_line = 1; - } - - start_line = count_lines(msg, mark_start); - end_line = count_lines(msg, mark_end); - - start_pos_in_line = pos_in_line(msg, mark_start); - end_pos_in_line = pos_in_line(msg, mark_end); - - start_line_beginning = line_beginning(msg, mark_start); - end_line_beginning = line_beginning(msg, mark_end); - - PRINT_DEBUG (("start_line = %d, end_line = %d\n", start_line, end_line)); - PRINT_DEBUG (("start_line_beginning = %d, end_line_beginning = %d\n", - start_line_beginning, end_line_beginning)); - - if (mark_start == 0 || start_pos_in_line == 0) - start = 0; - else - start = rp_text_width (s, &msg[start_line_beginning], - start_pos_in_line) + defaults.bar_x_padding; - - end = rp_text_width (s, &msg[end_line_beginning], - end_pos_in_line) + defaults.bar_x_padding * 2; - - if (mark_end != strlen (msg)) - end -= defaults.bar_x_padding; - - /* A little hack to highlight to the end of the line, if the - mark_end is at the end of a line. */ - if (mark_end_is_new_line) - { - *width = max_line_length(msg) + defaults.bar_x_padding * 2; - } - else - { - *width = end - start; - } - - *x = start; - *y = (start_line - 1) * FONT_HEIGHT (s) + defaults.bar_y_padding; - *height = (end_line - start_line + 1) * FONT_HEIGHT (s); -} - -static void -draw_box (rp_screen *s, int x, int y, int width, int height) -{ - XGCValues lgv; - GC lgc; - unsigned long mask; - - lgv.foreground = s->fg_color; - mask = GCForeground; - lgc = XCreateGC(dpy, s->root, mask, &lgv); - - XFillRectangle (dpy, s->bar_window, lgc, - x, y, width, height); - XFreeGC (dpy, lgc); -} - -static void -draw_mark (rp_screen *s, char *msg, int mark_start, int mark_end) -{ - int x, y, width, height; - - /* when this happens, there is no mark. */ - if (mark_end == 0 || mark_start == mark_end) - return; - - get_mark_box (msg, mark_start, mark_end, - &x, &y, &width, &height); - draw_box (s, x, y, width, height); -} - -static void -update_last_message (char *msg, int mark_start, int mark_end) -{ - free (last_msg); - last_msg = xstrdup (msg); - last_mark_start = mark_start; - last_mark_end = mark_end; -} - -void -marked_message (char *msg, int mark_start, int mark_end) -{ - /* Schedule the bar to be hidden after some amount of time. */ - reset_alarm (); - marked_message_internal (msg, mark_start, mark_end); -} - -static void -marked_message_internal (char *msg, int mark_start, int mark_end) -{ - rp_screen *s = current_screen (); - int num_lines; - int width; - int height; - - PRINT_DEBUG (("msg = %s\n", msg?msg:"NULL")); - PRINT_DEBUG (("mark_start = %d, mark_end = %d\n", mark_start, mark_end)); - - /* Calculate the width and height of the window. */ - num_lines = count_lines (msg, strlen(msg)); - width = defaults.bar_x_padding * 2 + max_line_length(msg); - height = FONT_HEIGHT (s) * num_lines + defaults.bar_y_padding * 2; - - prepare_bar (s, width, height); - - /* Draw the mark over the designated part of the string. */ - correct_mark (strlen (msg), &mark_start, &mark_end); - draw_mark (s, msg, mark_start, mark_end); - - draw_string (s, msg, mark_start, mark_end); - - /* Keep a record of the message. */ - update_last_message (msg, mark_start, mark_end); -} - -/* Use this just to update the bar. show_last_message will draw it and - leave it up for a period of time. */ -void -redraw_last_message (void) -{ - char *msg; - - if (last_msg == NULL) return; - - /* A little kludge to avoid last_msg in marked_message from being - strdup'd right after freeing the pointer. Note: in this case - marked_message's msg arg would have been the same as - last_msg. */ - msg = xstrdup (last_msg); - marked_message_internal (msg, last_mark_start, last_mark_end); - free (msg); -} - -void -show_last_message (void) -{ - redraw_last_message(); - reset_alarm(); -} - -/* Free any memory associated with the bar. */ -void -free_bar (void) -{ - free (last_msg); - last_msg = NULL; -} diff --git a/src/bar.h b/src/bar.h deleted file mode 100644 index 2156802..0000000 --- a/src/bar.h +++ /dev/null @@ -1,39 +0,0 @@ -/* functions for managing the program bar - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_BAR_H -#define _RATPOISON_BAR_H 1 - -void update_window_names (rp_screen *s, char *fmt); -void update_bar (rp_screen *s); -int show_bar (rp_screen *s, char *fmt); -int hide_bar (rp_screen *s); -int bar_y (rp_screen *s, int height); -int bar_x (rp_screen *s, int width); - -void message (char *s); -void marked_message (char *s, int mark_start, int mark_end); -void marked_message_printf (int mark_start, int mark_end, char *fmt, ...); -void redraw_last_message (void); -void show_last_message (void); -void free_bar (void); - -#endif /* ! _RATPOISON_BAR_H */ diff --git a/src/communications.c b/src/communications.c deleted file mode 100644 index 76f3b98..0000000 --- a/src/communications.c +++ /dev/null @@ -1,155 +0,0 @@ -/* communications.c -- Send commands to a running copy of ratpoison. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> -#include <X11/Xproto.h> - -#include <string.h> - -#include "ratpoison.h" - - -/* Sending commands to ratpoison */ -static int -receive_command_result (Window w) -{ - int query; - int return_status = RET_FAILURE; - Atom type_ret; - int format_ret; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *result = NULL; - - /* First, find out how big the property is. */ - query = XGetWindowProperty (dpy, w, rp_command_result, - 0, 0, False, xa_string, - &type_ret, &format_ret, &nitems, &bytes_after, - &result); - - /* Failed to retrieve property. */ - if (query != Success || result == NULL) - { - PRINT_DEBUG (("failed to get command result length\n")); - return return_status; - } - - /* XGetWindowProperty always allocates one extra byte even if - the property is zero length. */ - XFree (result); - - /* Now that we have the length of the message, we can get the - whole message. */ - query = XGetWindowProperty (dpy, w, rp_command_result, - 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0), - True, xa_string, &type_ret, &format_ret, &nitems, - &bytes_after, &result); - - /* Failed to retrieve property. */ - if (query != Success || result == NULL) - { - PRINT_DEBUG (("failed to get command result\n")); - return return_status; - } - - /* - * We can receive: - * - an empty string, indicating a success but no output - * - a string starting with '1', indicating a success and an output - * - a string starting with '0', indicating a failure and an optional output - */ - switch (result[0]) - { - case '\0': /* Command succeeded but no string to print */ - return_status = RET_SUCCESS; - break; - case '0': /* Command failed, don't print an empty line if no explanation - was given */ - if (result[1] != '\0') - fprintf (stderr, "%s\n", &result[1]); - return_status = RET_FAILURE; - break; - case '1': /* Command succeeded, print the output */ - printf ("%s\n", &result[1]); - return_status = RET_SUCCESS; - break; - default: /* We probably got junk, so ignore it */ - return_status = RET_FAILURE; - } - - /* Free the result. */ - XFree (result); - - return return_status; -} - -int -send_command (unsigned char interactive, unsigned char *cmd, int screen_num) -{ - Window w, root; - int done = 0, return_status = RET_FAILURE; - struct sbuf *s; - - s = sbuf_new(0); - sbuf_printf(s, "%c%s", interactive, cmd); - - - /* If the user specified a specific screen, then send the event to - that screen. */ - if (screen_num >= 0) - root = RootWindow (dpy, screen_num); - else - root = DefaultRootWindow (dpy); - - w = XCreateSimpleWindow (dpy, root, 0, 0, 1, 1, 0, 0, 0); - - /* Select first to avoid race condition */ - XSelectInput (dpy, w, PropertyChangeMask); - - XChangeProperty (dpy, w, rp_command, xa_string, - 8, PropModeReplace, (unsigned char*)sbuf_get(s), strlen ((char *)cmd) + 2); - - XChangeProperty (dpy, root, - rp_command_request, XA_WINDOW, - 8, PropModeAppend, (unsigned char *)&w, sizeof (Window)); - - sbuf_free (s); - - while (!done) - { - XEvent ev; - - XMaskEvent (dpy, PropertyChangeMask, &ev); - if (ev.xproperty.atom == rp_command_result - && ev.xproperty.state == PropertyNewValue) - { - return_status = receive_command_result(ev.xproperty.window); - done = 1; - } - } - - XDestroyWindow (dpy, w); - - return return_status; -} diff --git a/src/communications.h b/src/communications.h deleted file mode 100644 index 6cdd33c..0000000 --- a/src/communications.h +++ /dev/null @@ -1,27 +0,0 @@ -/* communications.h -- Send commands to a running copy of ratpoison. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_COMMUNICATIONS_H -#define _RATPOISON_COMMUNICATIONS_H 1 - -int send_command (unsigned char interactive, unsigned char *cmd, int screen_num); - -#endif /* ! _RATPOISON_COMMUNICATIONS_H */ diff --git a/src/completions.c b/src/completions.c deleted file mode 100644 index fc32c38..0000000 --- a/src/completions.c +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <string.h> - -#include "ratpoison.h" -#include "completions.h" - -rp_completions * -completions_new (completion_fn list_fn) -{ - rp_completions *c; - - c = (rp_completions *) xmalloc (sizeof(rp_completions)); - - INIT_LIST_HEAD (&c->completion_list); - c->complete_fn = list_fn; - c->last_match = NULL; - c->partial = NULL; - c->virgin = 1; - - return c; -} - -void -completions_free (rp_completions *c) -{ - struct sbuf *cur; - struct list_head *tmp, *iter; - - /* Clear our list */ - list_for_each_safe_entry (cur, iter, tmp, &c->completion_list, node) - { - list_del (&cur->node); - sbuf_free (cur); - } - - /* Free the partial string. */ - if (c->partial) - free (c->partial); - - free (c); -} - -static void -completions_assign (rp_completions *c, struct list_head *new_list) -{ - struct sbuf *cur; - struct list_head *tmp, *iter; - - /* Clear our list */ - list_for_each_safe_entry (cur, iter, tmp, &c->completion_list, node) - { - list_del (&cur->node); - sbuf_free (cur); - } - - /* splice the list into completion_list. Note that we SHOULDN'T free - new_list, because they share the same memory. */ - INIT_LIST_HEAD (&c->completion_list); - list_splice (new_list, &c->completion_list); - - list_first (c->last_match, &c->completion_list, node); -} - -static void -completions_update (rp_completions *c, char *partial) -{ - struct list_head *new_list; - - new_list = c->complete_fn (partial); - - c->virgin = 0; - if (c->partial) - free (c->partial); - c->partial = xstrdup (partial); - - completions_assign (c, new_list); - - /* Free the head structure for our list. */ - free (new_list); -} - -static char * -completions_prev_match (rp_completions *c) -{ - struct sbuf *cur; - - /* search forward from our last match through the list looking for - another match. */ - for (cur = list_prev_entry (c->last_match, &c->completion_list, node); - cur != c->last_match; - cur = list_prev_entry (cur, &c->completion_list, node)) - { - if (str_comp (sbuf_get (cur), c->partial, strlen (c->partial))) - { - /* We found a match so update our last_match pointer and - return the string. */ - c->last_match = cur; - return sbuf_get (cur); - } - } - - return NULL; -} - -static char * -completions_next_match (rp_completions *c) -{ - struct sbuf *cur; - - /* search forward from our last match through the list looking for - another match. */ - for (cur = list_next_entry (c->last_match, &c->completion_list, node); - cur != c->last_match; - cur = list_next_entry (cur, &c->completion_list, node)) - { - if (str_comp (sbuf_get (cur), c->partial, strlen (c->partial))) - { - /* We found a match so update our last_match pointer and - return the string. */ - c->last_match = cur; - return sbuf_get (cur); - } - } - - return NULL; -} - -/* Return a completed string that starts with partial. */ -char * -completions_complete (rp_completions *c, char *partial, int direction) -{ - if (c->virgin) - { - completions_update (c, partial); - - /* Since it's never been completed on and c->last_match points - to the first element of the list which may be a match. So - check it. FIXME: This is a bit of a hack. */ - if (c->last_match == NULL) - return NULL; - - /* c->last_match contains the first match in the forward - direction. So if we're looking for the previous match, then - check the previous element from last_match. */ - if (direction == COMPLETION_PREVIOUS) - c->last_match = list_prev_entry (c->last_match, &c->completion_list, node); - - /* Now check if last_match is a match for partial. */ - if (str_comp (sbuf_get (c->last_match), c->partial, strlen (c->partial))) - return sbuf_get (c->last_match); - } - - if (c->last_match == NULL) - return NULL; - - /* Depending on the direction, find our "next" match. */ - if (direction == COMPLETION_NEXT) - return completions_next_match (c); - - /* Otherwise get the previous match */ - return completions_prev_match (c); -} diff --git a/src/completions.h b/src/completions.h deleted file mode 100644 index d3c44af..0000000 --- a/src/completions.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_COMPLETIONS_H -#define _RATPOISON_COMPLETIONS_H 1 - -char *completions_complete (rp_completions *c, char *partial, int direction); -rp_completions *completions_new (completion_fn list_fn); -void completions_free (rp_completions *c); - -#endif /* ! _RATPOISON_COMPLETIONS_H */ diff --git a/src/conf.h b/src/conf.h deleted file mode 100644 index 708b688..0000000 --- a/src/conf.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Config file for ratpoison. Edit these values and recompile. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_CONF_H -#define _RATPOISON_CONF_H 1 - -#include "data.h" -#include "actions.h" - -#define KEY_PREFIX XK_t -#define MODIFIER_PREFIX RP_CONTROL_MASK - -/* This is the abort key when typing input. */ -#define INPUT_ABORT_KEY XK_g -#define INPUT_ABORT_MODIFIER RP_CONTROL_MASK - -/* This is the previous history entry key when typing input. */ -#define INPUT_PREV_HISTORY_KEY XK_p -#define INPUT_PREV_HISTORY_MODIFIER RP_CONTROL_MASK - -/* This is the next history entry key when typing input. */ -#define INPUT_NEXT_HISTORY_KEY XK_n -#define INPUT_NEXT_HISTORY_MODIFIER RP_CONTROL_MASK - -/* Key used to enlarge frame vertically when in resize mode. */ -#define RESIZE_VGROW_KEY XK_n -#define RESIZE_VGROW_MODIFIER RP_CONTROL_MASK - -/* Key used to shrink frame vertically when in resize mode. */ -#define RESIZE_VSHRINK_KEY XK_p -#define RESIZE_VSHRINK_MODIFIER RP_CONTROL_MASK - -/* Key used to enlarge frame horizontally when in resize mode. */ -#define RESIZE_HGROW_KEY XK_f -#define RESIZE_HGROW_MODIFIER RP_CONTROL_MASK - -/* Key used to shrink frame horizontally when in resize mode. */ -#define RESIZE_HSHRINK_KEY XK_b -#define RESIZE_HSHRINK_MODIFIER RP_CONTROL_MASK - -/* Key used to shrink frame to fit it's current window. */ -#define RESIZE_SHRINK_TO_WINDOW_KEY XK_s -#define RESIZE_SHRINK_TO_WINDOW_MODIFIER 0 - -/* Key used to exit resize mode. */ -#define RESIZE_END_KEY XK_Return -#define RESIZE_END_MODIFIER 0 - -/* Number of history items to store. */ -#define INPUT_MAX_HISTORY 50 - -/* Treat windows with maxsize hints as if they were a transient window - (don't hide the windows underneath, and center them) */ -#define MAXSIZE_WINDOWS_ARE_TRANSIENTS - -/* Treat windows with aspect hints as if they were a transient window - (don't hide the windows underneath, and center them) */ -#define ASPECT_WINDOWS_ARE_TRANSIENTS - -/* An alias command could recursively call inself infinitely. This - stops that behavior. */ -#define MAX_ALIAS_RECURSIVE_DEPTH 16 - -/* Pressing a key sends the mouse to the bottom right corner. This - doesn't work very well yet. */ -/* #define HIDE_MOUSE */ - -/* When the last window closes, quit ratpoison. */ -/* #define AUTO_CLOSE */ - -/* If for some sick reason you don't want ratpoison to manage a - window, put its name in this list. These windows get drawn but - ratpoison won't have any knowledge of them and you won't be able to - jump to them or give them keyboard focus. This has been added - mostly for use with hand-helds. */ -#define UNMANAGED_WINDOW_LIST "xapm","xclock","xscribble" - -/* Maximum depth of a link. Used in the 'link' command. */ -#define MAX_LINK_DEPTH 16 - -/* Bad window messages can be safely ignored now that ratpoison has - become stable enough. Comment this line if you wish to be notified - about bad window messages. */ -#define IGNORE_BADWINDOW 1 - -/* This is the name of the first group that is created. */ -#define DEFAULT_GROUP_NAME "default" - -/* Maximum allowed history size */ -#define MAX_HISTORY_SIZE 100 - -/* The default filename in which to store the history */ -#define HISTORY_FILE ".ratpoison_history" - -/* Use a visual bell in the input window */ -#define VISUAL_BELL 1 - -/* The name of the root keymap */ -#define ROOT_KEYMAP "root" - -/* The name of the top level keymap */ -#define TOP_KEYMAP "top" - -/* The default font */ -#define DEFAULT_FONT "-*-fixed-bold-r-normal-*-15-*-*-*-c-*-*-*" -#define BACKUP_FONT "*" - -#define DEFAULT_XFT_FONT "Mono-11" - -/* maximum xvsprintf result string length for systems with pre-C99 snprintf: - * on errors that are either permanent or cannot be distinguished from those - * as libc's snprintf might by returning -1 for too small buffers, at most - * the double of this value is tried before giving up */ -#define MAX_LEGACY_SNPRINTF_SIZE 102400 - -#endif /* !_ _RATPOISON_CONF_H */ diff --git a/src/data.h b/src/data.h deleted file mode 100644 index 2be9a98..0000000 --- a/src/data.h +++ /dev/null @@ -1,392 +0,0 @@ -/* our datatypes and global variables - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_DATA_H -#define _RATPOISON_DATA_H - -#include "linkedlist.h" -#include "number.h" - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#ifdef USE_XFT_FONT -#include <X11/Xft/Xft.h> -#endif - -typedef struct rp_window rp_window; -typedef struct rp_screen rp_screen; -typedef struct rp_action rp_action; -typedef struct rp_keymap rp_keymap; -typedef struct rp_frame rp_frame; -typedef struct rp_child_info rp_child_info; -typedef struct rp_group rp_group; -typedef struct rp_window_elem rp_window_elem; -typedef struct rp_completions rp_completions; -typedef struct rp_input_line rp_input_line; - -struct rp_frame -{ - int number; - int x, y, width, height; - - /* The number of the window that is focused in this frame. */ - int win_number; - - /* For determining the last frame. */ - int last_access; - - /* Boolean that is set when a frame is - `dedicated' (a.k.a. glued) to one window. */ - unsigned int dedicated; - - struct list_head node; -}; - -struct rp_window -{ - rp_screen *scr; - Window w; - int state; - int last_access; - int named; - - /* A number uniquely identifying this window. This is a different - number than the one given to it by the group it is in. This - number is used for internal purposes, whereas the group number is - what the user sees. */ - int number; - - /* Window name hints. */ - char *user_name; - char *wm_name; - char *res_name; - char *res_class; - - /* Dimensions */ - int x, y, width, height, border; - - /* WM Hints */ - XSizeHints *hints; - - /* Colormap */ - Colormap colormap; - - /* Is this a transient window? */ - int transient; - Window transient_for; - - /* Saved mouse position */ - int mouse_x, mouse_y; - - /* The alignment of the window. Decides to what side or corner the - window sticks to. */ - int gravity; - - /* A window can be visible inside a frame but not the frame's - current window. This keeps track of what frame the window was - mapped into. */ - int frame_number; - - /* Sometimes a window is intended for a certain frame. When a window - is mapped and this is >0 then use the frame (if it exists). */ - int intended_frame_number; - - struct list_head node; -}; - -struct rp_window_elem -{ - rp_window *win; - int number; - struct list_head node; -}; - -/* An rp_group is a group of windows. By default all windows are added - to the same group. But a new group can be created. All new windows - will be part of this new current group. The windows of any other - group may be visible in another frame, but will not show up in the - window list and will not be accessible with select, next, or - prev. These window navigation commands only navigate the current - group. */ -struct rp_group -{ - /* The name and number of this group. This is to allow the user to - quickly jump to the desired group. */ - char *name; - int number; - - /* For determining the last group. */ - int last_access; - - /* The list of windows participating in this group. */ - struct list_head mapped_windows, unmapped_windows; - - /* This numset is responsible for giving out numbers for each window - in the group. */ - struct numset *numset; - - /* This structure can exist in a list. */ - struct list_head node; -}; - -struct rp_screen -{ - GC normal_gc, inverse_gc; - Window root, bar_window, key_window, input_window, frame_window, help_window; - int bar_is_raised; - int screen_num; /* Our screen number as dictated my X */ - int xine_screen_num; /* Our screen number for the Xinerama extension */ - Colormap def_cmap; - Cursor rat; - unsigned long fg_color, bg_color, fw_color, bw_color; /* The pixel color. */ - - /* Here to abstract over the Xinerama vs X screens difference */ - int left, top, width, height; - - char *display_string; - - /* A list of frames that may or may not contain windows. There should - always be one in the list. */ - struct list_head frames; - - /* Keep track of which numbers have been given to frames. */ - struct numset *frames_numset; - - /* The number of the currently focused frame. One for each screen so - when you switch screens the focus doesn't get frobbed. */ - int current_frame; - -#ifdef USE_XFT_FONT - XftFont *xft_font; - XftColor xft_fg_color, xft_bg_color; -#endif -}; - -struct rp_action -{ - KeySym key; - unsigned int state; - char *data; /* misc data to be passed to the function */ -/* void (*func)(void *); */ -}; - -struct rp_keymap -{ - char *name; - rp_action *actions; - int actions_last; - int actions_size; - - /* This structure can be part of a list. */ - struct list_head node; -}; - -struct rp_key -{ - KeySym sym; - unsigned int state; -}; - -struct rp_defaults -{ - /* Default positions for new normal windows, transient windows, and - normal windows with maxsize hints. */ - int win_gravity; - int trans_gravity; - int maxsize_gravity; - - int input_window_size; - int window_border_width; - - int bar_x_padding; - int bar_y_padding; - int bar_location; - int bar_timeout; - int bar_border_width; - int bar_in_padding; - - int frame_indicator_timeout; - int frame_resize_unit; - - int padding_left; - int padding_right; - int padding_top; - int padding_bottom; - - XFontSet font; - char *font_string; - int utf8_locale; - - char *fgcolor_string; - char *bgcolor_string; - char *fwcolor_string; - char *bwcolor_string; - - int wait_for_key_cursor; - - char *window_fmt; - char *info_fmt; - - /* Which name to use: wm_name, res_name, res_class. */ - int win_name; - - int startup_message; - - /* Decides whether the window list is displayed in a row or a - column. */ - int window_list_style; - - /* Pointer warping toggle. */ - int warp; - - int history_size; - /* remove older history when adding the same again */ - int history_compaction; - /* expand ! when compiled with libhistory */ - int history_expansion; - - char *frame_selectors; - - /* How many frame sets to remember when undoing. */ - int maxundos; - - /* The name of the top level keymap */ - char *top_kmap; - - /* Frame indicator format */ - char *frame_fmt; -}; - -/* Information about a child process. */ -struct rp_child_info -{ - /* The command that was executed. */ - char *cmd; - - /* PID of the process. */ - int pid; - - /* Return status when the child process finished. */ - int status; - - /* When this is != 0 then the process finished. */ - int terminated; - - /* what was current when it was launched? */ - rp_group *group; - rp_frame *frame; - rp_screen *screen; - - /* Non-zero when the pid has mapped a window. This is to prevent - every window the program opens from getting mapped in the frame - it was launched from. Only the first window should do this. */ - int window_mapped; - - /* This structure can exist in a list. */ - struct list_head node; -}; - -/* These defines should be used to specify the modifier mask for keys - and they are translated into the X11 modifier mask when the time - comes to compare modifier masks. */ -#define RP_SHIFT_MASK 1 -#define RP_CONTROL_MASK 2 -#define RP_META_MASK 4 -#define RP_ALT_MASK 8 -#define RP_SUPER_MASK 16 -#define RP_HYPER_MASK 32 - -struct modifier_info -{ -/* unsigned int mode_switch_mask; */ - unsigned int meta_mod_mask; - unsigned int alt_mod_mask; - unsigned int super_mod_mask; - unsigned int hyper_mod_mask; - - /* Keep track of these because they mess up the grab and should be - ignored. */ - unsigned int num_lock_mask; - unsigned int scroll_lock_mask; -}; - -typedef struct list_head *(*completion_fn)(char *string); - -struct rp_completions -{ - /* A pointer to the partial string that is being completed. We need - to store this so that the user can cycle through all possible - completions. */ - char *partial; - - /* A pointer to the string that was last matched string. Used to - keep track of where we are in the completion list. */ - struct sbuf *last_match; - - /* A list of sbuf's which are possible completions. */ - struct list_head completion_list; - - /* The function that generates the completions. */ - completion_fn complete_fn; - - /* virgin = 1 means no completions have been attempted on the input - string. */ - unsigned short int virgin; -}; - -struct rp_input_line -{ - char *buffer; - char *prompt; - char *saved; - int position; - int length; - int size; - rp_completions *compl; - Atom selection; - int history_id; -}; - -/* The hook dictionary. */ -struct rp_hook_db_entry -{ - char *name; - struct list_head *hook; -}; - -typedef struct rp_frame_undo rp_frame_undo; -struct rp_frame_undo -{ - char *frames; - rp_screen *screen; - struct list_head node; -}; - -typedef struct rp_xselection rp_xselection; -struct rp_xselection -{ - char *text; - int len; -}; - -#endif /* _RATPOISON_DATA_H */ diff --git a/src/editor.c b/src/editor.c deleted file mode 100644 index 6c17754..0000000 --- a/src/editor.c +++ /dev/null @@ -1,580 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <ctype.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <X11/Xlib.h> -#include <X11/keysym.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> - -#include "ratpoison.h" - -/* bind functions */ -static edit_status editor_forward_char (rp_input_line *line); -static edit_status editor_backward_char (rp_input_line *line); -static edit_status editor_forward_word (rp_input_line *line); -static edit_status editor_backward_word (rp_input_line *line); -static edit_status editor_beginning_of_line (rp_input_line *line); -static edit_status editor_end_of_line (rp_input_line *line); -static edit_status editor_delete_char (rp_input_line *line); -static edit_status editor_backward_delete_char (rp_input_line *line); -static edit_status editor_kill_word (rp_input_line *line); -static edit_status editor_backward_kill_word (rp_input_line *line); -static edit_status editor_kill_line (rp_input_line *line); -static edit_status editor_paste_selection (rp_input_line *line); -static edit_status editor_abort (rp_input_line *line); -static edit_status editor_no_action (rp_input_line *line); -static edit_status editor_enter (rp_input_line *line); -static edit_status editor_history_previous (rp_input_line *line); -static edit_status editor_history_next (rp_input_line *line); -static edit_status editor_backward_kill_line (rp_input_line *line); -static edit_status editor_complete_prev (rp_input_line *line); -static edit_status editor_complete_next (rp_input_line *line); - -/* default edit action */ -static edit_status editor_insert (rp_input_line *line, char *keysym_buf); - - -static char *saved_command = NULL; - -typedef struct edit_binding edit_binding; - -struct edit_binding -{ - struct rp_key key; - edit_status (*func)(rp_input_line *); -}; - -static edit_binding edit_bindings[] = - { {{XK_g, RP_CONTROL_MASK}, editor_abort}, - {{XK_Escape, 0}, editor_abort}, - {{XK_f, RP_CONTROL_MASK}, editor_forward_char}, - {{XK_Right, 0}, editor_forward_char}, - {{XK_b, RP_CONTROL_MASK}, editor_backward_char}, - {{XK_Left, 0}, editor_backward_char}, - {{XK_f, RP_META_MASK}, editor_forward_word}, - {{XK_b, RP_META_MASK}, editor_backward_word}, - {{XK_a, RP_CONTROL_MASK}, editor_beginning_of_line}, - {{XK_Home, 0}, editor_beginning_of_line}, - {{XK_e, RP_CONTROL_MASK}, editor_end_of_line}, - {{XK_End, 0}, editor_end_of_line}, - {{XK_d, RP_CONTROL_MASK}, editor_delete_char}, - {{XK_Delete, 0}, editor_delete_char}, - {{XK_BackSpace, 0}, editor_backward_delete_char}, - {{XK_h, RP_CONTROL_MASK}, editor_backward_delete_char}, - {{XK_BackSpace, RP_META_MASK}, editor_backward_kill_word}, - {{XK_d, RP_META_MASK}, editor_kill_word}, - {{XK_k, RP_CONTROL_MASK}, editor_kill_line}, - {{XK_u, RP_CONTROL_MASK}, editor_backward_kill_line}, - {{XK_y, RP_CONTROL_MASK}, editor_paste_selection}, - {{XK_p, RP_CONTROL_MASK}, editor_history_previous}, - {{XK_Up, 0}, editor_history_previous}, - {{XK_n, RP_CONTROL_MASK}, editor_history_next}, - {{XK_Down, 0}, editor_history_next}, - {{XK_Return, 0}, editor_enter}, - {{XK_m, RP_CONTROL_MASK}, editor_enter}, - {{XK_KP_Enter, 0}, editor_enter}, - {{XK_Tab, 0}, editor_complete_next}, - {{XK_ISO_Left_Tab, 0}, editor_complete_prev}, - { {0, 0}, 0} }; - -rp_input_line * -input_line_new (char *prompt, char *preinput, int history_id, completion_fn fn) -{ - rp_input_line *line; - - line = xmalloc (sizeof (rp_input_line)); - line->prompt = prompt; - line->compl = completions_new (fn); - line->history_id = history_id; - - /* Allocate some memory to start with */ - line->size = strlen (preinput) + 100; - line->buffer = (char *) xmalloc (line->size); - - /* load in the preinput */ - strcpy (line->buffer, preinput); - line->position = line->length = strlen (preinput); - - return line; -} - -void -input_line_free (rp_input_line *line) -{ - completions_free (line->compl); - free (line->buffer); - free (line); -} - -edit_status -execute_edit_action (rp_input_line *line, KeySym ch, unsigned int modifier, char *keysym_buf) -{ - struct edit_binding *binding = NULL; - int found_binding = 0; - edit_status status; - - for (binding = edit_bindings; binding->func; binding++) - { - if (ch == binding->key.sym && modifier == binding->key.state) - { - found_binding = 1; - break; - } - } - - if (found_binding) - status = binding->func (line); - else if (modifier) - status = editor_no_action (line); - else - status = editor_insert (line, keysym_buf); - - return status; -} - -static edit_status -editor_forward_char (rp_input_line *line) -{ - if (line->position == line->length) - return EDIT_NO_OP; - - if (RP_IS_UTF8_START (line->buffer[line->position])) - { - do - line->position++; - while (RP_IS_UTF8_CONT (line->buffer[line->position])); - } - else - line->position++; - - return EDIT_MOVE; -} - -static edit_status -editor_backward_char (rp_input_line *line) -{ - if (line->position == 0) - return EDIT_NO_OP; - - do - line->position--; - while (line->position > 0 && RP_IS_UTF8_CONT (line->buffer[line->position])); - - return EDIT_MOVE; -} - -static edit_status -editor_forward_word (rp_input_line *line) -{ - if (line->position == line->length) - return EDIT_NO_OP; - - while (line->position < line->length - && !isalnum (line->buffer[line->position])) - line->position++; - - while (line->position < line->length - && (isalnum (line->buffer[line->position]) - || RP_IS_UTF8_CHAR (line->buffer[line->position]))) - line->position++; - - return EDIT_MOVE; -} - -static edit_status -editor_backward_word (rp_input_line *line) -{ - if (line->position == 0) - return EDIT_NO_OP; - - while (line->position > 0 && !isalnum (line->buffer[line->position])) - line->position--; - - while (line->position > 0 - && (isalnum (line->buffer[line->position]) - || RP_IS_UTF8_CHAR (line->buffer[line->position]))) - line->position--; - - return EDIT_MOVE; -} - -static edit_status -editor_beginning_of_line (rp_input_line *line) -{ - if (line->position == 0) - return EDIT_NO_OP; - else - { - line->position = 0; - return EDIT_MOVE; - } -} - -static edit_status -editor_end_of_line (rp_input_line *line) -{ - if (line->position == line->length) - return EDIT_NO_OP; - else - { - line->position = line->length; - return EDIT_MOVE; - } -} - -static edit_status -editor_delete_char (rp_input_line *line) -{ - size_t diff = 0; - - if (line->position == line->length) - return EDIT_NO_OP; - - if (RP_IS_UTF8_START (line->buffer[line->position])) - { - do - diff++; - while (RP_IS_UTF8_CONT (line->buffer[line->position + diff])); - } - else - diff++; - - memmove (&line->buffer[line->position], - &line->buffer[line->position + diff], - line->length - line->position + diff + 1); - - line->length -= diff; - - return EDIT_DELETE; -} - -static edit_status -editor_backward_delete_char (rp_input_line *line) -{ - size_t diff = 1; - - if (line->position == 0) - return EDIT_NO_OP; - - while (line->position - diff > 0 - && RP_IS_UTF8_CONT (line->buffer[line->position - diff])) - diff++; - - memmove (&line->buffer[line->position - diff], - &line->buffer[line->position], - line->length - line->position + 1); - - line->position -= diff; - line->length -= diff; - - return EDIT_DELETE; -} - -static edit_status -editor_kill_word (rp_input_line *line) -{ - size_t diff = 0; - - if (line->position == line->length) - return EDIT_NO_OP; - - while (line->position + diff < line->length && - !isalnum (line->buffer[line->position + diff])) - diff++; - - while (line->position + diff < line->length - && (isalnum (line->buffer[line->position + diff]) - || RP_IS_UTF8_CHAR (line->buffer[line->position + diff]))) - diff++; - - /* Add the word to the X11 selection. */ - set_nselection (&line->buffer[line->position], diff); - - memmove (&line->buffer[line->position], - &line->buffer[line->position + diff], - line->length - line->position + diff + 1); - - line->length -= diff; - - return EDIT_DELETE; -} - -static edit_status -editor_backward_kill_word (rp_input_line *line) -{ - size_t diff = 1; - - if (line->position == 0) - return EDIT_NO_OP; - - while (line->position - diff > 0 && - !isalnum (line->buffer[line->position - diff])) - diff++; - - while (line->position - diff > 0 - && (isalnum (line->buffer[line->position - diff]) - || RP_IS_UTF8_CHAR (line->buffer[line->position - diff]))) - diff++; - - /* Add the word to the X11 selection. */ - set_nselection (&line->buffer[line->position - diff], diff); - - memmove (&line->buffer[line->position - diff], - &line->buffer[line->position], - line->length - line->position + 1); - - line->position -= diff; - line->length -= diff; - - return EDIT_DELETE; -} - -static edit_status -editor_kill_line (rp_input_line *line) -{ - if (line->position == line->length) - return EDIT_NO_OP; - - /* Add the line to the X11 selection. */ - set_selection (&line->buffer[line->position]); - - line->length = line->position; - line->buffer[line->length] = '\0'; - - return EDIT_DELETE; -} - -/* Do the dirty work of killing a line backwards. */ -static void -backward_kill_line (rp_input_line *line) -{ - memmove (&line->buffer[0], - &line->buffer[line->position], - line->length - line->position + 1); - - line->length -= line->position; - line->position = 0; -} - -static edit_status -editor_backward_kill_line (rp_input_line *line) -{ - if (line->position == 0) - return EDIT_NO_OP; - - /* Add the line to the X11 selection. */ - set_nselection (line->buffer, line->position); - - backward_kill_line (line); - - return EDIT_DELETE; -} - -static edit_status -editor_history_previous (rp_input_line *line) -{ - const char *entry = history_previous (line->history_id); - - if (entry) - { - if (!saved_command) - { - line->buffer[line->length] = '\0'; - saved_command = xstrdup (line->buffer); - PRINT_DEBUG (("saved current command line: \'%s\'\n", saved_command)); - } - - free (line->buffer); - line->buffer = xstrdup (entry); - line->length = strlen (line->buffer); - line->size = line->length + 1; - line->position = line->length; - PRINT_DEBUG (("entry: \'%s\'\n", line->buffer)); - } - else - { - PRINT_DEBUG (("- do nothing -\n")); - return EDIT_NO_OP; - } - - return EDIT_INSERT; -} - -static edit_status -editor_history_next (rp_input_line *line) -{ - const char *entry = history_next (line->history_id); - - if (entry) - { - free (line->buffer); - line->buffer = xstrdup (entry); - PRINT_DEBUG (("entry: \'%s\'\n", line->buffer)); - } - else if (saved_command) - { - free (line->buffer); - line->buffer = saved_command; - saved_command = NULL; - PRINT_DEBUG (("restored command line: \'%s\'\n", line->buffer)); - } - else - { - PRINT_DEBUG (("- do nothing -\n")); - return EDIT_NO_OP; - } - - line->length = strlen (line->buffer); - line->size = line->length + 1; - line->position = line->length; - - return EDIT_INSERT; -} - -static edit_status -editor_abort (rp_input_line *line UNUSED) -{ - return EDIT_ABORT; -} - -static edit_status -editor_no_action (rp_input_line *line UNUSED) -{ - return EDIT_NO_OP; -} - -static edit_status -editor_insert (rp_input_line *line, char *keysym_buf) -{ - size_t nbytes; - - PRINT_DEBUG (("keysym_buf: '%s'\n", keysym_buf)); - - nbytes = strlen (keysym_buf); - if (line->length + nbytes > line->size - 1) - { - /* FIXME: This seems like a very bad idea. */ - line->size += nbytes + 100; - line->buffer = xrealloc (line->buffer, line->size); - } - - memmove (&line->buffer[line->position + nbytes], - &line->buffer[line->position], - line->length - line->position + 1); - memcpy (&line->buffer[line->position], keysym_buf, nbytes); - - line->length += nbytes; - line->position += nbytes; - - return EDIT_INSERT; -} - -static edit_status -editor_enter (rp_input_line *line) -{ - int result; - char *expansion; - - line->buffer[line->length] = '\0'; - - if (!defaults.history_expansion) { - history_add (line->history_id, line->buffer); - return EDIT_DONE; - } - - result = history_expand_line (line->history_id, line->buffer, &expansion); - - PRINT_DEBUG (("History Expansion - result: %d\n", result)); - PRINT_DEBUG (("History Expansion - expansion: \'%s\'\n", expansion)); - - if (result == -1 || result == 2) - { - marked_message_printf (0, 0, "%s", expansion); - free (expansion); - return EDIT_ABORT; - } - else /* result == 0 || result == 1 */ - { - history_add (line->history_id, expansion); - free (line->buffer); - line->buffer = expansion; - } - - return EDIT_DONE; -} - -static edit_status -editor_paste_selection (rp_input_line *line) -{ - char *text; - text = get_selection(); - if (text) - { - editor_insert(line, text); - free (text); - return EDIT_INSERT; - } - else - return EDIT_NO_OP; -} - -static edit_status -editor_complete (rp_input_line *line, int direction) -{ - char *tmp; - char *s; - - /* Create our partial string that will be used for completion. It is - the characters up to the position of the cursor. */ - tmp = xmalloc ((line->position + 1) * sizeof (char)); - strncpy (tmp, line->buffer, line->position); - tmp[line->position] = '\0'; - - /* We don't need to free s because it's a string from the completion - list. */ - s = completions_complete (line->compl, tmp, direction); - free (tmp); - - if (s == NULL) - return EDIT_NO_OP; - - /* Insert the completion. */ - backward_kill_line (line); - editor_insert (line, s); - - return EDIT_COMPLETE; -} - -static edit_status -editor_complete_next (rp_input_line *line) -{ - return editor_complete (line, COMPLETION_NEXT); -} - -static edit_status -editor_complete_prev (rp_input_line *line) -{ - return editor_complete (line, COMPLETION_PREVIOUS); -} diff --git a/src/editor.h b/src/editor.h deleted file mode 100644 index b6e4b76..0000000 --- a/src/editor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_EDITOR_H -#define _RATPOISON_EDITOR_H 1 - -typedef enum edit_status edit_status; - -enum -edit_status -{ - EDIT_INSERT, - EDIT_DELETE, - EDIT_MOVE, - EDIT_COMPLETE, - EDIT_ABORT, - EDIT_DONE, - EDIT_NO_OP -}; - -/* UTF-8 handling macros */ -#define RP_IS_UTF8_CHAR(c) (defaults.utf8_locale && (c) & 0xC0) -#define RP_IS_UTF8_START(c) (defaults.utf8_locale && ((c) & 0xC0) == 0xC0) -#define RP_IS_UTF8_CONT(c) (defaults.utf8_locale && ((c) & 0xC0) == 0x80) - -/* Input line functions */ -rp_input_line *input_line_new (char *prompt, char *preinput, int history_id, completion_fn fn); -void input_line_free (rp_input_line *line); - -edit_status execute_edit_action (rp_input_line *line, KeySym ch, unsigned int modifier, char *keysym_buf); - -#endif /* ! _RATPOISON_EDITOR_H */ diff --git a/src/events.c b/src/events.c deleted file mode 100644 index 37bfc01..0000000 --- a/src/events.c +++ /dev/null @@ -1,1012 +0,0 @@ -/* Ratpoison X events - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> -#include <X11/keysym.h> -#include <X11/Xmd.h> /* for CARD32. */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <strings.h> -#include <signal.h> -#include <errno.h> -#include <unistd.h> -#include <sys/time.h> -#include <sys/wait.h> - -#include "ratpoison.h" - -/* The event currently being processed. Mostly used in functions from - action.c which need to forward events to other windows. */ -XEvent rp_current_event; - -/* RAISED is non zero if a raised message should be used 0 for a map message. */ -void -show_rudeness_msg (rp_window *win, int raised) -{ - rp_group *g = groups_find_group_by_window (win); - rp_window_elem *elem = group_find_window (&g->mapped_windows, win); - if (g == rp_current_group) - { - if (win->transient) - marked_message_printf (0, 0, raised ? MESSAGE_RAISE_TRANSIENT:MESSAGE_MAP_TRANSIENT, - elem->number, window_name (win)); - else - marked_message_printf (0, 0, raised ? MESSAGE_RAISE_WINDOW:MESSAGE_MAP_WINDOW, - elem->number, window_name (win)); - } - else - { - if (win->transient) - marked_message_printf (0, 0, raised ? MESSAGE_RAISE_TRANSIENT_GROUP:MESSAGE_MAP_TRANSIENT_GROUP, - elem->number, window_name (win), g->name); - else - marked_message_printf (0, 0, raised ? MESSAGE_RAISE_WINDOW_GROUP:MESSAGE_MAP_WINDOW_GROUP, - elem->number, window_name (win), g->name); - } -} - -static void -new_window (XCreateWindowEvent *e) -{ - rp_window *win; - rp_screen *s; - - if (e->override_redirect) - return; - - win = find_window (e->window); - - /* In Xinerama mode, all windows have the same root, so check - * all Xinerama screens - */ - if (rp_have_xinerama) - { - /* New windows belong to the current screen */ - s = &screens[rp_current_screen]; - } - else - { - s = find_screen (e->parent); - } - if (is_rp_window_for_screen(e->window, s)) return; - - if (s && win == NULL - && e->window != s->key_window - && e->window != s->bar_window - && e->window != s->input_window - && e->window != s->frame_window - && e->window != s->help_window) - { - win = add_to_window_list (s, e->window); - update_window_information (win); - } -} - -static void -unmap_notify (XEvent *ev) -{ - rp_frame *frame; - rp_window *win; - - /* ignore SubstructureNotify unmaps. */ - if(ev->xunmap.event != ev->xunmap.window - && ev->xunmap.send_event != True) - return; - - /* FIXME: Should we only look in the mapped window list? */ - win = find_window_in_list (ev->xunmap.window, &rp_mapped_window); - - if (win == NULL) - return; - - switch (win->state) - { - case IconicState: - PRINT_DEBUG (("Withdrawing iconized window '%s'\n", window_name (win))); - if (ev->xunmap.send_event) withdraw_window (win); - break; - case NormalState: - PRINT_DEBUG (("Withdrawing normal window '%s'\n", window_name (win))); - /* If the window was inside a frame, fill the frame with another - window. */ - frame = find_windows_frame (win); - if (frame) - { - cleanup_frame (frame); - if (frame->number == win->scr->current_frame - && current_screen() == win->scr) - set_active_frame (frame, 0); - /* Since we may have switched windows, call the hook. */ - if (frame->win_number != EMPTY) - hook_run (&rp_switch_win_hook); - } - - withdraw_window (win); - break; - } - - update_window_names (win->scr, defaults.window_fmt); -} - -static void -map_request (XEvent *ev) -{ - rp_window *win; - - win = find_window (ev->xmap.window); - if (win == NULL) - { - PRINT_DEBUG (("Map request from an unknown window.\n")); - XMapWindow (dpy, ev->xmap.window); - return; - } - - PRINT_DEBUG (("Map request from a managed window\n")); - - switch (win->state) - { - case WithdrawnState: - if (unmanaged_window (win->w)) - { - PRINT_DEBUG (("Mapping Unmanaged Window\n")); - XMapWindow (dpy, win->w); - break; - } - else - { - PRINT_DEBUG (("Mapping Withdrawn Window\n")); - map_window (win); - break; - } - break; - case IconicState: - PRINT_DEBUG (("Mapping Iconic window\n")); - if (win->last_access == 0) - { - /* Depending on the rudeness level, actually map the - window. */ - if ((rp_honour_transient_map && win->transient) - || (rp_honour_normal_map && !win->transient)) - set_active_window (win); - } - else - { - /* Depending on the rudeness level, actually map the - window. */ - if ((rp_honour_transient_raise && win->transient) - || (rp_honour_normal_raise && !win->transient)) - set_active_window (win); - else - show_rudeness_msg (win, 1); - } - break; - } -} - -static void -destroy_window (XDestroyWindowEvent *ev) -{ - rp_window *win; - - win = find_window (ev->window); - if (win == NULL) return; - - ignore_badwindow++; - - /* If, somehow, the window is not withdrawn before it is destroyed, - perform the necessary steps to withdraw the window before it is - unmanaged. */ - if (win->state == IconicState) - { - PRINT_DEBUG (("Destroying Iconic Window (%s)\n", window_name (win))); - withdraw_window (win); - } - else if (win->state == NormalState) - { - rp_frame *frame; - - PRINT_DEBUG (("Destroying Normal Window (%s)\n", window_name (win))); - frame = find_windows_frame (win); - if (frame) - { - cleanup_frame (frame); - if (frame->number == win->scr->current_frame - && current_screen() == win->scr) - set_active_frame (frame, 0); - /* Since we may have switched windows, call the hook. */ - if (frame->win_number != EMPTY) - hook_run (&rp_switch_win_hook); - } - withdraw_window (win); - } - - /* Now that the window is guaranteed to be in the unmapped window - list, we can safely stop managing it. */ - unmanage (win); - ignore_badwindow--; -} - -static void -configure_request (XConfigureRequestEvent *e) -{ - XWindowChanges changes; - rp_window *win; - - win = find_window (e->window); - - if (win) - { - if (e->value_mask & CWStackMode) - { - if (e->detail == Above && win->state != WithdrawnState) - { - /* Depending on the rudeness level, actually map the - window. */ - if ((rp_honour_transient_raise && win->transient) - || (rp_honour_normal_raise && !win->transient)) - { - if (win->state == IconicState) - set_active_window (win); - else if (find_windows_frame (win)) - goto_window (win); - } - else if (current_window() != win) - { - show_rudeness_msg (win, 1); - } - - } - - PRINT_DEBUG(("request CWStackMode %d\n", e->detail)); - } - - PRINT_DEBUG (("'%s' window size: %d %d %d %d %d\n", window_name (win), - win->x, win->y, win->width, win->height, win->border)); - - /* Collect the changes to be granted. */ - if (e->value_mask & CWBorderWidth) - { - changes.border_width = e->border_width; - win->border = e->border_width; - PRINT_DEBUG(("request CWBorderWidth %d\n", e->border_width)); - } - - if (e->value_mask & CWWidth) - { - changes.width = e->width; - win->width = e->width; - PRINT_DEBUG(("request CWWidth %d\n", e->width)); - } - - if (e->value_mask & CWHeight) - { - changes.height = e->height; - win->height = e->height; - PRINT_DEBUG(("request CWHeight %d\n", e->height)); - } - - if (e->value_mask & CWX) - { - changes.x = e->x; - win->x = e->x; - PRINT_DEBUG(("request CWX %d\n", e->x)); - } - - if (e->value_mask & CWY) - { - changes.y = e->y; - win->y = e->y; - PRINT_DEBUG(("request CWY %d\n", e->y)); - } - - if (e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight)) - { - /* Grant the request, then immediately maximize it. */ - XConfigureWindow (dpy, win->w, - e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight), - &changes); - XSync(dpy, False); - if (win->state == NormalState) - maximize (win); - } - } - else - { - /* Its an unmanaged window, so give it what it wants. But don't - change the stack mode.*/ - if (e->value_mask & CWX) changes.x = e->x; - if (e->value_mask & CWY) changes.x = e->x; - if (e->value_mask & CWWidth) changes.x = e->x; - if (e->value_mask & CWHeight) changes.x = e->x; - if (e->value_mask & CWBorderWidth) changes.x = e->x; - XConfigureWindow (dpy, e->window, - e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight), - &changes); - } -} - -static void -client_msg (XClientMessageEvent *ev) -{ - PRINT_DEBUG (("Received client message.\n")); - - if (ev->message_type == wm_change_state) - { - rp_window *win; - - PRINT_DEBUG (("WM_CHANGE_STATE\n")); - - win = find_window (ev->window); - if (win == NULL) return; - if (ev->format == 32 && ev->data.l[0] == IconicState) - { - /* FIXME: This means clients can hide themselves without the - user's intervention. This is bad, but Emacs is the only - program I know of that iconifies itself and this is - generally from the user pressing C-z. */ - PRINT_DEBUG (("Iconify Request.\n")); - if (win->state == NormalState) - { - rp_window *w = find_window_other(win->scr); - - if (w) - set_active_window (w); - else - blank_frame (screen_get_frame (win->scr, win->scr->current_frame)); - } - } - else - { - PRINT_ERROR (("Non-standard WM_CHANGE_STATE format\n")); - } - } -} - -static void -handle_key (KeySym ks, unsigned int mod, rp_screen *s) -{ - rp_action *key_action; - rp_keymap *map = find_keymap (defaults.top_kmap); - - if (map == NULL) - { - PRINT_ERROR (("Unable to find %s keymap\n", defaults.top_kmap)); - return; - } - - PRINT_DEBUG (("handling key...\n")); - - /* All functions hide the program bar and the frame indicator. */ - if (defaults.bar_timeout > 0) hide_bar (s); - hide_frame_indicator(); - - /* Disable any alarm that was going to go off. */ - alarm (0); - alarm_signalled = 0; - - /* Call the top level key pressed hook. */ - hook_run (&rp_key_hook); - - PRINT_DEBUG (("handle_key\n")); - - /* Read a key and execute the command associated with it on the - default keymap. Ignore the key if it doesn't have a binding. */ - if ((key_action = find_keybinding (ks, x11_mask_to_rp_mask (mod), map))) - { - cmdret *result; - - PRINT_DEBUG(("%s\n", key_action->data)); - - result = command (1, key_action->data); - - if (result) - { - if (result->output) - message (result->output); - cmdret_free (result); - } - } - else - { - PRINT_DEBUG(("Impossible: No matching key")); - } -} - -static void -key_press (XEvent *ev) -{ - rp_screen *s; - unsigned int modifier; - KeySym ks; - - if (rp_have_xinerama) - s = current_screen(); - else - s = find_screen (ev->xkey.root); - - if (!s) return; - -#ifdef HIDE_MOUSE - XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->left + s->width - 2, s->top + s->height - 2); -#endif - - modifier = ev->xkey.state; - cook_keycode ( &ev->xkey, &ks, &modifier, NULL, 0, 1); - - handle_key (ks, modifier, s); -} - -/* Read a command off the window and execute it. Some commands return - text. This text is passed back using the RP_COMMAND_RESULT - Atom. The client will wait for this property change so something - must be returned. */ -static cmdret * -execute_remote_command (Window w) -{ - int status; - cmdret *ret; - Atom type_ret; - int format_ret; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *req; - - status = XGetWindowProperty (dpy, w, rp_command, - 0, 0, False, xa_string, - &type_ret, &format_ret, &nitems, &bytes_after, - &req); - - if (status != Success || req == NULL) - { - return cmdret_new (RET_FAILURE, "Couldn't get RP_COMMAND Property"); - } - - /* XGetWindowProperty always allocates one extra byte even if - the property is zero length. */ - XFree (req); - - status = XGetWindowProperty (dpy, w, rp_command, - 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0), - True, xa_string, &type_ret, &format_ret, &nitems, - &bytes_after, &req); - - if (status != Success || req == NULL) - { - return cmdret_new (RET_FAILURE, "Couldn't get RP_COMMAND Property"); - } - - PRINT_DEBUG (("command: %s\n", req)); - ret = command (req[0], (char *)&req[1]); - XFree (req); - - return ret; -} - -/* Command requests are posted as a property change using the - RP_COMMAND_REQUEST Atom on the root window. A Command request is a - Window that holds the actual command as a property using the - RP_COMMAND Atom. receive_command reads the list of Windows and - executes their associated command. */ -static void -receive_command (Window root) -{ - cmdret *cmd_ret; - char *result; - Atom type_ret; - int format_ret; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *prop_return; - int offset; - - /* Init offset to 0. In the case where there is more than one window - in the property, a partial read does not delete the property and - we need to grab the next window by incementing offset to the - offset of the next window. */ - offset = 0; - do - { - int ret; - int length; - Window w; - - length = sizeof (Window) / 4 + (sizeof (Window) % 4 ?1:0); - ret = XGetWindowProperty (dpy, root, - rp_command_request, - offset, length, - True, XA_WINDOW, &type_ret, &format_ret, - &nitems, - &bytes_after, &prop_return); - - /* Update the offset to point to the next window (if there is - another one). */ - offset += length; - - if (ret != Success) - { - PRINT_ERROR (("XGetWindowProperty Failed\n")); - if (prop_return) - XFree (prop_return); - break; - } - - /* If there was no window, then we're done. */ - if (prop_return == NULL) - { - PRINT_DEBUG (("No property to read\n")); - break; - } - - /* We grabbed a window, so now read the command stored in - this window and execute it. */ - w = *(Window *)prop_return; - XFree (prop_return); - cmd_ret = execute_remote_command (w); - - /* notify the client of any text that was returned by the - command. see communications.c:receive_command_result() */ - if (cmd_ret->output) - result = xsprintf ("%c%s", cmd_ret->success ? '1':'0', cmd_ret->output); - else if (!cmd_ret->success) - result = xstrdup("0"); - else - result = NULL; - - if (result) - XChangeProperty (dpy, w, rp_command_result, xa_string, - 8, PropModeReplace, (unsigned char *)result, strlen (result)); - else - XChangeProperty (dpy, w, rp_command_result, xa_string, - 8, PropModeReplace, NULL, 0); - free (result); - cmdret_free (cmd_ret); - } while (bytes_after > 0); -} - -static void -property_notify (XEvent *ev) -{ - rp_window *win; - - PRINT_DEBUG (("atom: %ld\n", ev->xproperty.atom)); - - if (ev->xproperty.atom == rp_command_request - && is_a_root_window (ev->xproperty.window) - && ev->xproperty.state == PropertyNewValue) - { - PRINT_DEBUG (("ratpoison command\n")); - receive_command(ev->xproperty.window); - } - - win = find_window (ev->xproperty.window); - - if (win) - { - if (ev->xproperty.atom == _net_wm_pid) - { - struct rp_child_info *child_info; - - PRINT_DEBUG (("updating _NET_WM_PID\n")); - child_info = get_child_info(win->w); - if (child_info && !child_info->window_mapped) - { - if (child_info->frame) - { - PRINT_DEBUG (("frame=%p\n", child_info->frame)); - win->intended_frame_number = child_info->frame->number; - /* Only map the first window in the launch frame. */ - child_info->window_mapped = 1; - } - /* TODO: also adopt group information? */ - } - } else - switch (ev->xproperty.atom) - { - case XA_WM_NAME: - PRINT_DEBUG (("updating window name\n")); - if (update_window_name (win)) { - update_window_names (win->scr, defaults.window_fmt); - hook_run (&rp_title_changed_hook); - } - break; - - case XA_WM_NORMAL_HINTS: - PRINT_DEBUG (("updating window normal hints\n")); - update_normal_hints (win); - if (win->state == NormalState) - maximize (win); - break; - - case XA_WM_TRANSIENT_FOR: - PRINT_DEBUG (("Transient for\n")); - win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for); - break; - - default: - PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom)); - break; - } - } -} - -static void -colormap_notify (XEvent *ev) -{ - rp_window *win; - - win = find_window (ev->xcolormap.window); - - if (win != NULL) - { - XWindowAttributes attr; - - /* SDL sets the colormap just before destroying the window, so - ignore BadWindow errors. */ - ignore_badwindow++; - - XGetWindowAttributes (dpy, win->w, &attr); - win->colormap = attr.colormap; - - if (win == current_window() - && !current_screen()->bar_is_raised) - { - XInstallColormap (dpy, win->colormap); - } - - ignore_badwindow--; - } -} - -static void -focus_change (XFocusChangeEvent *ev) -{ - rp_window *win; - - /* We're only interested in the NotifyGrab mode */ - if (ev->mode != NotifyGrab) return; - - win = find_window (ev->window); - - if (win != NULL) - { - PRINT_DEBUG (("Re-grabbing prefix key\n")); - grab_top_level_keys (win->w); - } -} - -static void -mapping_notify (XMappingEvent *ev) -{ - ungrab_keys_all_wins(); - - switch (ev->request) - { - case MappingModifier: - update_modifier_map(); - /* This is meant to fall through. */ - case MappingKeyboard: - XRefreshKeyboardMapping (ev); - break; - } - - grab_keys_all_wins(); -} - -static void -configure_notify (XConfigureEvent *ev) -{ - rp_screen *s; - - s = find_screen(ev->window); - if (s != NULL) - /* This is a root window of a screen, - * look if its width or height changed: */ - screen_update(s,ev->width,ev->height); -} - -/* This is called whan an application has requested the - selection. Copied from rxvt. */ -static void -selection_request (XSelectionRequestEvent *rq) -{ - XEvent ev; - CARD32 target_list[4]; - Atom target; - static Atom xa_targets = None; - static Atom xa_text = None; /* XXX */ - XTextProperty ct; - XICCEncodingStyle style; - char *cl[4]; - - if (xa_text == None) - xa_text = XInternAtom(dpy, "TEXT", False); - if (xa_targets == None) - xa_targets = XInternAtom(dpy, "TARGETS", False); - - ev.xselection.type = SelectionNotify; - ev.xselection.property = None; - ev.xselection.display = rq->display; - ev.xselection.requestor = rq->requestor; - ev.xselection.selection = rq->selection; - ev.xselection.target = rq->target; - ev.xselection.time = rq->time; - - if (rq->target == xa_targets) { - target_list[0] = (CARD32) xa_targets; - target_list[1] = (CARD32) xa_string; - target_list[2] = (CARD32) xa_text; - target_list[3] = (CARD32) xa_compound_text; - XChangeProperty(dpy, rq->requestor, rq->property, rq->target, - (8 * sizeof(target_list[0])), PropModeReplace, - (unsigned char *)target_list, - (sizeof(target_list) / sizeof(target_list[0]))); - ev.xselection.property = rq->property; - } else if (rq->target == xa_string - || rq->target == xa_compound_text - || rq->target == xa_text) { - if (rq->target == xa_string) { - style = XStringStyle; - target = xa_string; - } else { - target = xa_compound_text; - style = (rq->target == xa_compound_text) ? XCompoundTextStyle - : XStdICCTextStyle; - } - cl[0] = selection.text; - XmbTextListToTextProperty(dpy, cl, 1, style, &ct); - XChangeProperty(dpy, rq->requestor, rq->property, - target, 8, PropModeReplace, - ct.value, ct.nitems); - ev.xselection.property = rq->property; - } - XSendEvent(dpy, rq->requestor, False, 0, &ev); -} - -static void -selection_clear (void) -{ - if (selection.text) - free (selection.text); - selection.text = NULL; - selection.len = 0; -} - -/* Given an event, call the correct function to handle it. */ -static void -delegate_event (XEvent *ev) -{ - switch (ev->type) - { - case ConfigureRequest: - PRINT_DEBUG (("--- Handling ConfigureRequest ---\n")); - configure_request (&ev->xconfigurerequest); - break; - - case CreateNotify: - PRINT_DEBUG (("--- Handling CreateNotify ---\n")); - new_window (&ev->xcreatewindow); - break; - - case DestroyNotify: - PRINT_DEBUG (("--- Handling DestroyNotify ---\n")); - destroy_window (&ev->xdestroywindow); - break; - - case ClientMessage: - PRINT_DEBUG (("--- Handling ClientMessage ---\n")); - client_msg (&ev->xclient); - break; - - case ColormapNotify: - PRINT_DEBUG (("--- Handling ColormapNotify ---\n")); - colormap_notify (ev); - break; - - case PropertyNotify: - PRINT_DEBUG (("--- Handling PropertyNotify ---\n")); - property_notify (ev); - break; - - case MapRequest: - PRINT_DEBUG (("--- Handling MapRequest ---\n")); - map_request (ev); - break; - - case KeyPress: - PRINT_DEBUG (("--- Handling KeyPress ---\n")); - key_press (ev); - break; - - case UnmapNotify: - PRINT_DEBUG (("--- Handling UnmapNotify ---\n")); - unmap_notify (ev); - break; - - case FocusOut: - PRINT_DEBUG (("--- Handling FocusOut ---\n")); - focus_change (&ev->xfocus); - break; - - case FocusIn: - PRINT_DEBUG (("--- Handling FocusIn ---\n")); - focus_change (&ev->xfocus); - break; - - case MappingNotify: - PRINT_DEBUG (("--- Handling MappingNotify ---\n")); - mapping_notify( &ev->xmapping ); - break; - - case SelectionRequest: - selection_request(&ev->xselectionrequest); - break; - - case SelectionClear: - selection_clear(); - break; - - case ConfigureNotify: - PRINT_DEBUG (("--- Handling ConfigureNotify ---\n")); - configure_notify( &ev->xconfigure ); - break; - - case MapNotify: - case Expose: - case MotionNotify: - case KeyRelease: - case ReparentNotify: - case EnterNotify: - case SelectionNotify: - case CirculateRequest: - /* Ignore these events. */ - break; - - default: - PRINT_DEBUG (("--- Unknown event %d ---\n",- ev->type)); - } -} - -static void -handle_signals (void) -{ - /* An alarm means we need to hide the popup windows. */ - if (alarm_signalled > 0) - { - int i; - - PRINT_DEBUG (("Alarm received.\n")); - - /* Only hide the bar if it times out. */ - if (defaults.bar_timeout > 0) - for (i=0; i<num_screens; i++) - hide_bar (&screens[i]); - - hide_frame_indicator(); - alarm_signalled = 0; - } - - if (chld_signalled > 0) - { - rp_child_info *cur; - struct list_head *iter, *tmp; - - /* Report and remove terminated processes. */ - list_for_each_safe_entry (cur, iter, tmp, &rp_children, node) - { - if (cur->terminated) - { - /* Report any child that didn't return 0. */ - if (cur->status != 0) - marked_message_printf (0,0, "/bin/sh -c \"%s\" finished (%d)", - cur->cmd, cur->status); - list_del (&cur->node); - free (cur->cmd); - free (cur); - } - } - - chld_signalled = 0; - } - - if (rp_exec_newwm) - { - int i; - - PRINT_DEBUG (("Switching to %s\n", rp_exec_newwm)); - - putenv(current_screen()->display_string); - unhide_all_windows(); - XSync(dpy, False); - for (i=0; i<num_screens; i++) - { - deactivate_screen(&screens[i]); - } - execlp(rp_exec_newwm, rp_exec_newwm, NULL); - - /* Failed. Clean up. */ - PRINT_ERROR (("exec %s ", rp_exec_newwm)); - perror(" failed"); - free (rp_exec_newwm); - rp_exec_newwm = NULL; - for (i=0; i<num_screens; i++) - { - activate_screen(&screens[i]); - } - } - - if (hup_signalled > 0) - { - PRINT_DEBUG (("Restarting\n")); - hook_run (&rp_restart_hook); - clean_up (); - execvp(myargv[0], myargv); - } - - if (kill_signalled > 0) - { - PRINT_DEBUG (("Exiting\n")); - hook_run (&rp_quit_hook); - clean_up (); - exit (EXIT_SUCCESS); - } - - /* Report any X11 errors that have occurred. */ - if (rp_error_msg) - { - marked_message_printf (0, 6, "ERROR: %s", rp_error_msg); - free (rp_error_msg); - rp_error_msg = NULL; - } -} - -/* The main loop. */ -void -listen_for_events (void) -{ - int x_fd; - fd_set fds; - - x_fd = ConnectionNumber (dpy); - FD_ZERO (&fds); - - /* Loop forever. */ - for (;;) - { - handle_signals (); - - /* Handle the next event. */ - FD_SET (x_fd, &fds); - XFlush(dpy); - - if (QLength (dpy) > 0 - || select(x_fd+1, &fds, NULL, NULL, NULL) == 1) - { - XNextEvent (dpy, &rp_current_event); - delegate_event (&rp_current_event); - XSync(dpy, False); - } - } -} diff --git a/src/events.h b/src/events.h deleted file mode 100644 index 69eb27d..0000000 --- a/src/events.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Function prototypes - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_EVENTS_H -#define _RATPOISON_EVENTS_H 1 - -void listen_for_events (void); -void show_rudeness_msg (rp_window *win, int raised); - -#endif /* _RATPOISON_EVENTS_H */ diff --git a/src/format.c b/src/format.c deleted file mode 100644 index 0706f21..0000000 --- a/src/format.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (C) 2006 Antti Nykänen <aon@iki.fi> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "ratpoison.h" - -/* Function prototypes for format char expanders. */ -#define RP_FMT(fn) static void fmt_ ## fn (rp_window_elem *elem, struct sbuf *buf) -RP_FMT(framenum); -RP_FMT(lastaccess); -RP_FMT(name); -RP_FMT(number); -RP_FMT(resname); -RP_FMT(resclass); -RP_FMT(status); -RP_FMT(windowid); -RP_FMT(height); -RP_FMT(width); -RP_FMT(incheight); -RP_FMT(incwidth); -RP_FMT(gravity); -RP_FMT(screen); -RP_FMT(xinescreen); -RP_FMT(transient); -RP_FMT(maxsize); -RP_FMT(pid); - -struct fmt_item { - /* The format character */ - char fmt_char; - - /* Callback to return the expanded string. */ - void (*fmt_fn)(rp_window_elem *, struct sbuf *); -}; - -struct fmt_item fmt_items[] = { - { 'a', fmt_resname }, - { 'g', fmt_gravity }, - { 'h', fmt_height }, - { 'H', fmt_incheight }, - { 'c', fmt_resclass }, - { 'f', fmt_framenum }, - { 'i', fmt_windowid }, - { 'l', fmt_lastaccess }, - { 'n', fmt_number }, - { 'p', fmt_pid }, - { 's', fmt_status }, - { 'S', fmt_screen }, - { 't', fmt_name }, - { 'T', fmt_transient }, - { 'M', fmt_maxsize }, - { 'w', fmt_width }, - { 'W', fmt_incwidth }, - { 'x', fmt_xinescreen }, - { 0, NULL } -}; - -/* if width >= 0 then limit the width of s to width chars. */ -static void -concat_width (struct sbuf *buf, char *s, int width) -{ - if (width >= 0) - { - char *s1 = xsprintf ("%%.%ds", width); - char *s2 = xsprintf (s1, s); - sbuf_concat (buf, s2); - free (s1); - free (s2); - } - else - sbuf_concat (buf, s); -} - -void -format_string (char *fmt, rp_window_elem *win_elem, struct sbuf *buffer) -{ -#define STATE_READ 0 -#define STATE_NUMBER 1 -#define STATE_ESCAPE 2 - int state = STATE_READ; - char dbuf[10]; - int width = -1; - struct sbuf *retbuf; - int fip, found; - - retbuf = sbuf_new (0); - - for(; *fmt; fmt++) - { - if (*fmt == '%' && state == STATE_READ) - { - state = STATE_ESCAPE; - continue; - } - - if ((state == STATE_ESCAPE || state == STATE_NUMBER) && isdigit(*fmt)) - { - /* Accumulate the width one digit at a time. */ - if (state == STATE_ESCAPE) - width = 0; - width *= 10; - width += *fmt - '0'; - state = STATE_NUMBER; - continue; - } - - found = 0; - if (state == STATE_ESCAPE || state == STATE_NUMBER) - { - if (*fmt == '%') - sbuf_concat (buffer, "%"); - else - { - for (fip = 0; fmt_items[fip].fmt_char; fip++) - { - if (fmt_items[fip].fmt_char == *fmt) - { - sbuf_clear (retbuf); - fmt_items[fip].fmt_fn(win_elem, retbuf); - concat_width (buffer, sbuf_get (retbuf), width); - found = 1; - break; - } - } - if (!found) - { - sbuf_printf_concat (buffer, "%%%c", *fmt); - break; - } - } - state = STATE_READ; - width = -1; - } - else - { - /* Insert the character. */ - dbuf[0] = *fmt; - dbuf[1] = 0; - sbuf_concat (buffer, dbuf); - } - } - sbuf_free (retbuf); -#undef STATE_READ -#undef STATE_ESCAPE -#undef STATE_NUMBER -} - -static void -fmt_framenum (rp_window_elem *win_elem, struct sbuf *buf) -{ - if (win_elem->win->frame_number != EMPTY) - { - sbuf_printf_concat (buf, "%d", win_elem->win->frame_number); - } - else - sbuf_copy (buf, " "); -} - -static void -fmt_lastaccess (rp_window_elem *win_elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%d", win_elem->win->last_access); -} - -static void -fmt_name (rp_window_elem *win_elem, struct sbuf *buf) -{ - sbuf_copy(buf, window_name (win_elem->win)); -} - -static void -fmt_number (rp_window_elem *win_elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%d", win_elem->number); -} - -static void -fmt_resname (rp_window_elem *win_elem, struct sbuf *buf) -{ - if (win_elem->win->res_name) - sbuf_copy (buf, win_elem->win->res_name); - else - sbuf_copy (buf, "None"); -} - -static void -fmt_resclass (rp_window_elem *win_elem, struct sbuf *buf) -{ - if (win_elem->win->res_class) - sbuf_copy (buf, win_elem->win->res_class); - else - sbuf_copy (buf, "None"); -} - -static void -fmt_status (rp_window_elem *win_elem, struct sbuf *buf) -{ - rp_window *other_window; - - other_window = find_window_other (current_screen()); - if (win_elem->win == other_window) - sbuf_copy (buf, "+"); - else if (win_elem->win == current_window()) - sbuf_copy (buf, "*"); - else - sbuf_copy (buf, "-"); -} - -static void -fmt_windowid (rp_window_elem *elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%ld", (unsigned long)elem->win->w); -} - -static void -fmt_height (rp_window_elem *elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%d", elem->win->height); -} - -static void -fmt_width (rp_window_elem *elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%d", elem->win->width); -} - -static void -fmt_incheight (rp_window_elem *elem, struct sbuf *buf) -{ - int height; - height = elem->win->height; - - if (elem->win->hints->flags & PResizeInc) - height /= elem->win->hints->height_inc; - - sbuf_printf_concat (buf, "%d", height); -} - -static void -fmt_incwidth (rp_window_elem *elem, struct sbuf *buf) -{ - int width; - width = elem->win->width; - - if (elem->win->hints->flags & PResizeInc) - width /= elem->win->hints->width_inc; - - sbuf_printf_concat (buf, "%d", width); -} - -static void -fmt_gravity (rp_window_elem *elem, struct sbuf *buf) -{ - sbuf_copy (buf, wingravity_to_string (elem->win->gravity)); -} - -static void -fmt_screen (rp_window_elem *elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%d", elem->win->scr->screen_num); -} - -static void -fmt_xinescreen (rp_window_elem *elem, struct sbuf *buf) -{ - sbuf_printf_concat (buf, "%d", elem->win->scr->xine_screen_num); -} - -static void -fmt_transient (rp_window_elem *elem, struct sbuf *buf) -{ - if (elem->win->transient) - sbuf_concat (buf, "Transient"); -} - -static void -fmt_maxsize (rp_window_elem *elem, struct sbuf *buf) -{ - if (elem->win->hints->flags & PMaxSize) - sbuf_concat (buf, "Maxsize"); -} - -static void -fmt_pid (rp_window_elem *elem, struct sbuf *buf) -{ - struct rp_child_info *info; - - info = get_child_info (elem->win->w); - if (info) - sbuf_printf_concat (buf, "%d", info->pid); - else - sbuf_concat (buf, "?"); -} diff --git a/src/format.h b/src/format.h deleted file mode 100644 index 83b6acb..0000000 --- a/src/format.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Prototypes for format functions. - * Copyright (C) 2006 Antti Nykänen <aon@iki.fi> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_FORMAT_H -#define _RATPOISON_FORMAT_H 1 - -void format_string(char *fmt, rp_window_elem *win_elem, struct sbuf *buffer); - -#endif /* _RATPOISON_FORMAT_H */ diff --git a/src/frame.c b/src/frame.c deleted file mode 100644 index c42e2ab..0000000 --- a/src/frame.c +++ /dev/null @@ -1,302 +0,0 @@ -/* functions that manipulate the frame structure. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include "ratpoison.h" - -#include <string.h> - -int -frame_left (rp_frame *frame) -{ - return frame->x; -} - -int -frame_top (rp_frame *frame) -{ - return frame->y; -} - -int -frame_right (rp_frame *frame) -{ - return frame->x + frame->width; -} - -int -frame_bottom (rp_frame *frame) -{ - return frame->y + frame->height; -} - -int -frame_width(rp_frame *frame) -{ - return frame->width; -} - -int -frame_height(rp_frame *frame) -{ - return frame->height; -} - -void -frame_resize_left (rp_frame *frame, int amount) -{ - frame->x -= amount; - frame->width += amount; -} - -void -frame_resize_right (rp_frame *frame, int amount) -{ - frame->width += amount; -} - -void -frame_resize_up (rp_frame *frame, int amount) -{ - frame->y -= amount; - frame->height += amount; -} - -void -frame_resize_down (rp_frame *frame, int amount) -{ - frame->height += amount; -} - -void -frame_move_left (rp_frame *frame, int amount) -{ - frame->x -= amount; -} - -void -frame_move_right (rp_frame *frame, int amount) -{ - frame->x += amount; -} - -void -frame_move_up (rp_frame *frame, int amount) -{ - frame->y -= amount; -} - -void -frame_move_down (rp_frame *frame, int amount) -{ - frame->y += amount; -} - -static void -init_frame (rp_frame *f) -{ - f->number = 0; - f->x = 0; - f->y = 0; - f->width = 0; - f->height = 0; - f->win_number = 0; - f->last_access = 0; - f->dedicated = 0; -} - -rp_frame * -frame_new (rp_screen *s) -{ - rp_frame *f; - - f = xmalloc (sizeof (rp_frame)); - init_frame(f); - f->number = numset_request (s->frames_numset); - - return f; -} - -void -frame_free (rp_screen *s, rp_frame *f) -{ - numset_release (s->frames_numset, f->number); - free (f); -} - - -rp_frame * -frame_copy (rp_frame *frame) -{ - rp_frame *copy; - - copy = xmalloc (sizeof (rp_frame)); - - copy->number = frame->number; - copy->x = frame->x; - copy->y = frame->y; - copy->width = frame->width; - copy->height = frame->height; - copy->win_number = frame->win_number; - copy->last_access = frame->last_access; - - return copy; -} - -char * -frame_dump (rp_frame *frame, rp_screen *screen) -{ - rp_window *win; - char *tmp; - struct sbuf *s; - - /* rather than use win_number, use the X11 window ID. */ - win = find_window_number (frame->win_number); - - s = sbuf_new (0); - sbuf_printf (s, "(frame :number %d :x %d :y %d :width %d :height %d :screenw %d :screenh %d :window %ld :last-access %d :dedicated %d)", - frame->number, - frame->x, - frame->y, - frame->width, - frame->height, - screen->width, - screen->height, - win ? win->w:0, - frame->last_access, - frame->dedicated); - - /* Extract the string and return it, and don't forget to free s. */ - tmp = sbuf_get (s); - free (s); - return tmp; -} - -/* Used only by frame_read */ -#define read_slot(x) do { tmp = strtok_ws (NULL); x = strtol(tmp,NULL,10); } while(0) - -rp_frame * -frame_read (char *str, rp_screen *screen) -{ - Window w = 0L; - rp_window *win; - rp_frame *f; - char *tmp, *d; - int s_width = -1; - int s_height = -1; - - /* Create a blank frame. */ - f = xmalloc (sizeof (rp_frame)); - init_frame(f); - - PRINT_DEBUG(("parsing '%s'\n", str)); - - d = xstrdup(str); - tmp = strtok_ws (d); - - /* Verify it starts with '(frame ' */ - if (strcmp(tmp, "(frame")) - { - PRINT_DEBUG(("Doesn't start with '(frame '\n")); - free (d); - free (f); - return NULL; - } - /* NOTE: there is no check to make sure each field was filled in. */ - tmp = strtok_ws(NULL); - while (tmp) - { - if (!strcmp(tmp, ":number")) - read_slot(f->number); - else if (!strcmp(tmp, ":x")) - read_slot(f->x); - else if (!strcmp(tmp, ":y")) - read_slot(f->y); - else if (!strcmp(tmp, ":width")) - read_slot(f->width); - else if (!strcmp(tmp, ":height")) - read_slot(f->height); - else if (!strcmp(tmp, ":screenw")) - read_slot(s_width); - else if (!strcmp(tmp, ":screenh")) - read_slot(s_height); - else if (!strcmp(tmp, ":window")) - read_slot(w); - else if (!strcmp(tmp, ":last-access")) - read_slot(f->last_access); - else if (!strcmp(tmp, ":dedicated")) { - /* f->dedicated is unsigned, so read into local variable. */ - long dedicated; - - read_slot(dedicated); - if (dedicated <= 0) - f->dedicated = 0; - else - f->dedicated = 1; - } - else if (!strcmp(tmp, ")")) - break; - else - PRINT_ERROR(("Unknown slot %s\n", tmp)); - /* Read the next token. */ - tmp = strtok_ws(NULL); - } - if (tmp) - PRINT_ERROR(("Frame has trailing garbage\n")); - free (d); - - /* adjust x, y, width and height to a possible screen size change */ - if (s_width > 0) - { - f->x = (f->x*screen->width)/s_width; - f->width = (f->width*screen->width)/s_width; - } - if (s_height > 0) - { - f->y = (f->y*screen->height)/s_height; - f->height = (f->height*screen->height)/s_height; - } - - /* Perform some integrity checks on what we got and fix any - problems. */ - if (f->number <= 0) - f->number = 0; - if (f->x <= 0) - f->x = 0; - if (f->y <= 0) - f->y = 0; - if (f->width <= defaults.window_border_width*2) - f->width = defaults.window_border_width*2 + 1; - if (f->height <= defaults.window_border_width*2) - f->height = defaults.window_border_width*2 + 1; - if (f->last_access < 0) - f->last_access = 0; - - /* Find the window with the X11 window ID. */ - win = find_window_in_list (w, &rp_mapped_window); - if (win) - f->win_number = win->number; - else - f->win_number = EMPTY; - - return f; -} - -#undef read_slot diff --git a/src/frame.h b/src/frame.h deleted file mode 100644 index 611ecc0..0000000 --- a/src/frame.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef FRAME_H -#define FRAME_H - -void frame_move_down (rp_frame *frame, int amount); -void frame_move_up (rp_frame *frame, int amount); -void frame_move_right (rp_frame *frame, int amount); -void frame_move_left (rp_frame *frame, int amount); -void frame_resize_down (rp_frame *frame, int amount); -void frame_resize_up (rp_frame *frame, int amount); -void frame_resize_right (rp_frame *frame, int amount); -void frame_resize_left (rp_frame *frame, int amount); -int frame_height(rp_frame *frame); -int frame_width(rp_frame *frame); -int frame_bottom (rp_frame *frame); -int frame_right (rp_frame *frame); -int frame_top (rp_frame *frame); -int frame_left (rp_frame *frame); - -rp_frame *frame_new (rp_screen *s); -void frame_free (rp_screen *s, rp_frame *f); -rp_frame *frame_copy (rp_frame *frame); -char *frame_dump (rp_frame *frame, rp_screen *screen); -rp_frame *frame_read (char *str, rp_screen *screen); - -rp_screen *frames_screen (rp_frame *); - -#endif diff --git a/src/getopt.c b/src/getopt.c deleted file mode 100644 index d5c40f1..0000000 --- a/src/getopt.c +++ /dev/null @@ -1,1052 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 - Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - 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, 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. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. - Ditto for AIX 3.2 and <stdlib.h>. */ - -#ifndef _NO_PROTO -#define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <strings.h> - -#ifndef HAVE_GETOPT_LONG - -#if !defined (__STDC__) || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include <stdio.h> - -/* 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 <gnu-versions.h> -#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__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -#include <stdlib.h> -#include <unistd.h> -#endif /* GNU C library. */ - -#ifdef VMS -#include <unixlib.h> -#if HAVE_STRING_H - 0 -#include <string.h> -#endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -#ifdef HAVE_LIBINTL_H -# include <libintl.h> -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* 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. */ - -char *optarg = NULL; - -/* 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. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -#include <string.h> -#define my_index strchr -#else - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -char *getenv (); - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -#if !defined (__STDC__) || !__STDC__ -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -#endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined (__STDC__) && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined (__STDC__) && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - 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 '?': - 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 */ - -#endif /* HAVE_GETOPT_LONG */ diff --git a/src/getopt.h b/src/getopt.h deleted file mode 100644 index d0ae1c6..0000000 --- a/src/getopt.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - 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, 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. */ - -#ifndef _GETOPT_H -#define _GETOPT_H 1 - -#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; - -/* 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__ - 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 - -#if defined (__STDC__) && __STDC__ -#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__ */ -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); -#else /* not __STDC__ */ -extern int getopt (); -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* getopt.h */ diff --git a/src/getopt1.c b/src/getopt1.c deleted file mode 100644 index 5c1fd42..0000000 --- a/src/getopt1.c +++ /dev/null @@ -1,194 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - 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, 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. */ - - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifndef HAVE_GETOPT_LONG - -#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 <stdio.h> - -/* 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 <gnu-versions.h> -#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 <stdlib.h> -#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 <stdio.h> - -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 */ - -#endif /* HAVE_GETOPT_LONG */ diff --git a/src/globals.c b/src/globals.c deleted file mode 100644 index 05ebe28..0000000 --- a/src/globals.c +++ /dev/null @@ -1,346 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include "ratpoison.h" - -#include <unistd.h> /* for usleep(). */ - -int alarm_signalled = 0; -int kill_signalled = 0; -int hup_signalled = 0; -int chld_signalled = 0; -int rat_x; -int rat_y; -int rat_visible = 1; /* rat is visible by default */ - -char *rp_exec_newwm = NULL; - -int rp_font_ascent, rp_font_descent, rp_font_width; - -Atom wm_name; -Atom wm_state; -Atom wm_change_state; -Atom wm_protocols; -Atom wm_delete; -Atom wm_take_focus; -Atom wm_colormaps; - -Atom rp_command; -Atom rp_command_request; -Atom rp_command_result; -Atom rp_selection; - -/* TEXT atoms */ -Atom xa_string; -Atom xa_compound_text; -Atom xa_utf8_string; - -/* netwm atoms */ -Atom _net_wm_pid; -Atom _net_supported; -Atom _net_wm_window_type; -Atom _net_wm_window_type_dialog; -Atom _net_wm_name; - -int rp_current_screen; -rp_screen *screens; -int num_screens; -Display *dpy; - -rp_group *rp_current_group; -LIST_HEAD (rp_groups); -LIST_HEAD (rp_children); -struct rp_defaults defaults; - -int ignore_badwindow = 0; - -char **myargv; - -struct rp_key prefix_key; - -struct modifier_info rp_modifier_info; - -/* rudeness levels */ -int rp_honour_transient_raise = 1; -int rp_honour_normal_raise = 1; -int rp_honour_transient_map = 1; -int rp_honour_normal_map = 1; - -char *rp_error_msg = NULL; - -/* Global frame numset */ -struct numset *rp_frame_numset; - -/* The X11 selection globals */ -rp_xselection selection; - -static void -x_export_selection (void) -{ - /* Hang the selections off screen 0's key window. */ - XSetSelectionOwner(dpy, XA_PRIMARY, screens[0].key_window, CurrentTime); - if (XGetSelectionOwner(dpy, XA_PRIMARY) != screens[0].key_window) - PRINT_ERROR(("can't get primary selection")); - XChangeProperty(dpy, screens[0].root, XA_CUT_BUFFER0, xa_string, 8, - PropModeReplace, (unsigned char*)selection.text, selection.len); -} - -void -set_nselection (char *txt, int len) -{ - int i; - - /* Update the selection structure */ - if (selection.text != NULL) - free(selection.text); - - /* Copy the string by hand. */ - selection.text = malloc(len+1); - selection.len = len + 1; - for (i=0; i<len; i++) - selection.text[i] = txt[i]; - selection.text[len] = 0; - - x_export_selection(); -} - -void -set_selection (char *txt) -{ - /* Update the selection structure */ - if (selection.text != NULL) - free(selection.text); - selection.text = xstrdup (txt); - selection.len = strlen (txt); - - x_export_selection(); -} - -static char * -get_cut_buffer (void) -{ - int nbytes; - char *data; - - PRINT_DEBUG (("trying the cut buffer\n")); - - data = XFetchBytes (dpy, &nbytes); - - if (data) - { - struct sbuf *s = sbuf_new (0); - sbuf_nconcat (s, data, nbytes); - XFree (data); - return sbuf_free_struct (s); - } - else - return NULL; -} - -/* Lifted the code from rxvt. */ -static char * -get_primary_selection(void) -{ - long nread; - unsigned long bytes_after; - XTextProperty ct; - struct sbuf *s = sbuf_new(0); - - for (nread = 0, bytes_after = 1; bytes_after > 0; nread += ct.nitems) { - if ((XGetWindowProperty(dpy, current_screen()->input_window, rp_selection, (nread / 4), 4096, - True, AnyPropertyType, &ct.encoding, - &ct.format, &ct.nitems, &bytes_after, - &ct.value) != Success)) { - XFree(ct.value); - sbuf_free(s); - return NULL; - } - if (ct.value == NULL) - continue; - /* Accumulate the data. FIXME: ct.value may not be NULL - terminated. */ - sbuf_nconcat (s, (const char*)ct.value, ct.nitems); - XFree(ct.value); - } - return sbuf_free_struct (s); -} - -char * -get_selection (void) -{ - Atom property; - XEvent ev; - rp_screen *s = current_screen (); - int loops = 1000; - - /* Just insert our text, if we own the selection. */ - if (selection.text) - { - return xstrdup (selection.text); - } - else - { - /* be a good icccm citizen */ - XDeleteProperty (dpy, s->input_window, rp_selection); - /* TODO: we shouldn't use CurrentTime here, use the time of the XKeyEvent, should we fake it? */ - XConvertSelection (dpy, XA_PRIMARY, xa_string, rp_selection, s->input_window, CurrentTime); - - /* This seems like a hack. */ - while (!XCheckTypedWindowEvent (dpy, s->input_window, SelectionNotify, &ev)) - { - if (loops == 0) - { - PRINT_ERROR (("selection request timed out\n")); - return NULL; - } - usleep (10000); - loops--; - } - - PRINT_DEBUG (("SelectionNotify event\n")); - - property = ev.xselection.property; - - if (property != None) - return get_primary_selection (); - else - return get_cut_buffer (); - } -} - -/* The hook dictionary globals. */ - -LIST_HEAD (rp_key_hook); -LIST_HEAD (rp_switch_win_hook); -LIST_HEAD (rp_switch_frame_hook); -LIST_HEAD (rp_switch_group_hook); -LIST_HEAD (rp_switch_screen_hook); -LIST_HEAD (rp_quit_hook); -LIST_HEAD (rp_restart_hook); -LIST_HEAD (rp_delete_window_hook); -LIST_HEAD (rp_new_window_hook); -LIST_HEAD (rp_title_changed_hook); - -struct rp_hook_db_entry rp_hook_db[]= - {{"key", &rp_key_hook}, - {"switchwin", &rp_switch_win_hook}, - {"switchframe", &rp_switch_frame_hook}, - {"switchgroup", &rp_switch_group_hook}, - {"switchscreen", &rp_switch_screen_hook}, - {"deletewindow", &rp_delete_window_hook}, - {"quit", &rp_quit_hook}, - {"restart", &rp_restart_hook}, - {"newwindow", &rp_new_window_hook}, - {"titlechanged", &rp_title_changed_hook}, - {NULL, NULL}}; - -void -set_rp_window_focus (rp_window *win) -{ - PRINT_DEBUG (("Giving focus to '%s'\n", window_name (win))); - XSetInputFocus (dpy, win->w, - RevertToPointerRoot, CurrentTime); -} - -void -set_window_focus (Window window) -{ - PRINT_DEBUG (("Giving focus to %ld\n", window)); - XSetInputFocus (dpy, window, - RevertToPointerRoot, CurrentTime); -} - -LIST_HEAD (rp_frame_undos); -LIST_HEAD (rp_frame_redos); - -void -init_globals (void) -{ - selection.text = NULL; - selection.len = 0; -} - -/* Wrapper font functions to support Xft */ - -void -rp_draw_string (rp_screen *s, Drawable d, int style, int x, int y, - char *string, int length) -{ - if (length < 0) - length = strlen (string); - -#ifdef USE_XFT_FONT - if (s->xft_font) - { - XftDraw *draw; - draw = XftDrawCreate (dpy, d, DefaultVisual (dpy, s->screen_num), - DefaultColormap (dpy, s->screen_num)); - if (!draw) - { - PRINT_ERROR (("Failed to allocate XftDraw object\n")); - return; - } - - if (defaults.utf8_locale) - { - XftDrawStringUtf8 (draw, style == STYLE_NORMAL ? &s->xft_fg_color : - &s->xft_bg_color, s->xft_font, x, y, - (FcChar8*) string, length); - } - else - { - XftDrawString8 (draw, style == STYLE_NORMAL ? &s->xft_fg_color : - &s->xft_bg_color, s->xft_font, x, y, - (FcChar8*) string, length); - } - XftDrawDestroy (draw); - } - else - PRINT_ERROR (("No Xft font available.\n")); -#else - XmbDrawString (dpy, d, defaults.font, style == STYLE_NORMAL ? s->normal_gc : - s->inverse_gc, x, y, string, length); -#endif -} - -int -rp_text_width (rp_screen *s, char *string, int count) -{ - (void) s; /* avoid "unused" warning */ - if (count < 0) - count = strlen (string); - -#ifdef USE_XFT_FONT - if (s->xft_font) - { - XGlyphInfo extents; - if (defaults.utf8_locale) - XftTextExtentsUtf8 (dpy, s->xft_font, (FcChar8*) string, count, &extents); - else - XftTextExtents8 (dpy, s->xft_font, (FcChar8*) string, count, &extents); - return extents.xOff; - } - PRINT_ERROR (("No Xft font available.\n")); - return 0; -#else - return XmbTextEscapement (defaults.font, string, count); -#endif -} - diff --git a/src/globals.h b/src/globals.h deleted file mode 100644 index 12ccffd..0000000 --- a/src/globals.h +++ /dev/null @@ -1,217 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef GLOBALS_H -#define GLOBALS_H - -#include "data.h" - -/* codes used in the cmdret code in actions.c */ -#define RET_SUCCESS 1 -#define RET_FAILURE 0 - -#ifdef USE_XFT_FONT -#include <X11/Xft/Xft.h> - -#define FONT_HEIGHT(s) ((s)->xft_font->ascent + (s)->xft_font->descent) -#define FONT_ASCENT(s) ((s)->xft_font->ascent) - -#else - -#define FONT_HEIGHT(f) (rp_font_ascent + rp_font_descent) -#define FONT_ASCENT(f) (rp_font_ascent) - -#endif - -#define MAX_FONT_WIDTH(f) (rp_font_width) - -#define WIN_EVENTS (StructureNotifyMask | PropertyChangeMask | ColormapChangeMask | FocusChangeMask) -/* EMPTY is used when a frame doesn't contain a window, or a window - doesn't have a frame. Any time a field refers to the number of a - window/frame/screen/etc, Use EMPTY to denote a lack there of. */ -#define EMPTY -1 - -/* Possible values for defaults.window_list_style */ -#define STYLE_ROW 0 -#define STYLE_COLUMN 1 - -/* Possible values for defaults.win_name */ -#define WIN_NAME_TITLE 0 -#define WIN_NAME_RES_CLASS 1 -#define WIN_NAME_RES_NAME 2 - -/* Possible directions to traverse the completions list. */ -#define COMPLETION_NEXT 0 -#define COMPLETION_PREVIOUS 1 - -/* Error codes for group_delete_group() */ -#define GROUP_DELETE_GROUP_OK 0 -#define GROUP_DELETE_GROUP_NONEMPTY 1 -#define GROUP_DELETE_LAST_GROUP 2 - -/* Font styles */ -#define STYLE_NORMAL 0 -#define STYLE_INVERSE 1 - -#ifdef __GNUC__ -#define UNUSED __attribute__ ((unused)) -#else -#define UNUSED -#endif - -/* The list of groups. */ -extern struct list_head rp_groups; - -extern rp_group *rp_current_group; - -/* Each child process is stored in this list. spawn, creates a new - entry in this list, the SIGCHLD handler sets child.terminated to be - true and handle_signals in events.c processes each terminated - process by printing a message saying the process ended and - displaying it's exit code. */ -extern struct list_head rp_children; - -extern struct rp_defaults defaults; - -/* Cached font info. */ -extern int rp_font_ascent, rp_font_descent, rp_font_width; - -/* The prefix key also known as the command character under screen. */ -extern struct rp_key prefix_key; - -/* A list of mapped windows. These windows show up in the window - list and have a number assigned to them. */ -extern struct list_head rp_mapped_window; - -/* A list of unmapped windows. These windows do not have a number - assigned to them and are not visible/active. */ -extern struct list_head rp_unmapped_window; - -extern int rp_current_screen; -extern rp_screen *screens; -extern int num_screens; - -extern XEvent rp_current_event; - -extern Display *dpy; -extern Atom rp_command; -extern Atom rp_command_request; -extern Atom rp_command_result; -extern Atom rp_selection; - -extern Atom wm_name; -extern Atom wm_state; -extern Atom wm_change_state; -extern Atom wm_protocols; -extern Atom wm_delete; -extern Atom wm_take_focus; -extern Atom wm_colormaps; - -/* TEXT atoms */ -extern Atom xa_string; -extern Atom xa_compound_text; -extern Atom xa_utf8_string; - -/* netwm atoms. */ -extern Atom _net_wm_pid; -extern Atom _net_supported; -extern Atom _net_wm_window_type; -extern Atom _net_wm_window_type_dialog; -extern Atom _net_wm_name; - -/* mouse properties */ -extern int rat_x; -extern int rat_y; -extern int rat_visible; - -/* When unmapping or deleting windows, it is sometimes helpful to - ignore a bad window when attempting to clean the window up. This - does just that when set to 1 */ -extern int ignore_badwindow; - -/* Arguments passed to ratpoison. */ -extern char **myargv; - -/* Keeps track of which mod mask each modifier is under. */ -extern struct modifier_info rp_modifier_info; - -/* nonzero if an alarm signal was raised. This means ratpoison should - hide its popup windows. */ -extern int alarm_signalled; -extern int kill_signalled; -extern int hup_signalled; -extern int chld_signalled; - -/* When set to a string, ratpoison should exec the command. The reason - this variable is needed and why it is not exec'd in cmd_newwm is - because if called with ratpoison -c, the rp -c process never - returns. */ -extern char *rp_exec_newwm; - -/* rudeness levels */ -extern int rp_honour_transient_raise; -extern int rp_honour_normal_raise; -extern int rp_honour_transient_map; -extern int rp_honour_normal_map; - -/* Keep track of X11 error messages. */ -extern char *rp_error_msg; - -/* Number sets for windows. */ -extern struct numset *rp_window_numset; - -extern struct list_head rp_key_hook; -extern struct list_head rp_switch_win_hook; -extern struct list_head rp_switch_frame_hook; -extern struct list_head rp_switch_group_hook; -extern struct list_head rp_switch_screen_hook; -extern struct list_head rp_delete_window_hook; -extern struct list_head rp_quit_hook; -extern struct list_head rp_restart_hook; -extern struct list_head rp_new_window_hook; -extern struct list_head rp_title_changed_hook; - -extern struct rp_hook_db_entry rp_hook_db[]; - -void set_rp_window_focus (rp_window *win); -void set_window_focus (Window window); - -extern int rp_have_xinerama; -extern int xine_screen_count; - -extern struct numset *rp_frame_numset; - -extern struct list_head rp_frame_undos; -extern struct list_head rp_frame_redos; - -/* Selection handling globals */ -extern rp_xselection selection; -void set_selection (char *txt); -void set_nselection (char *txt, int len); -char *get_selection (void); - -void init_globals (void); - -/* Wrapper font functions to support Xft */ - -void rp_draw_string (rp_screen *s, Drawable d, int style, int x, int y, char *string, int length); -int rp_text_width (rp_screen *s, char *string, int count); - -#endif diff --git a/src/group.c b/src/group.c deleted file mode 100644 index 5448006..0000000 --- a/src/group.c +++ /dev/null @@ -1,661 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include "ratpoison.h" - -#include <string.h> - -/* XXX Should be static */ -struct numset *group_numset; - -static void -set_current_group_1 (rp_group *g) -{ - static int counter = 1; - rp_current_group = g; - if (g) - g->last_access = counter++; -} - -void -init_groups(void) -{ - rp_group *g; - - group_numset = numset_new(); - INIT_LIST_HEAD (&rp_groups); - - /* Create the first group in the list (We always need at least - one). */ - g = group_new (numset_request (group_numset), DEFAULT_GROUP_NAME); - set_current_group_1 (g); - list_add_tail (&g->node, &rp_groups); -} - -void -free_groups(void) -{ - rp_group *cur; - struct list_head *iter, *tmp; - - list_for_each_safe_entry (cur, iter, tmp, &rp_groups, node) - { - group_free (cur); - } -} - -rp_group * -group_new (int number, char *name) -{ - rp_group *g; - - g = xmalloc (sizeof (rp_group)); - - if (name) - g->name = xstrdup (name); - else - g->name = NULL; - g->last_access = 0; - g->number = number; - g->numset = numset_new(); - INIT_LIST_HEAD (&g->unmapped_windows); - INIT_LIST_HEAD (&g->mapped_windows); - - return g; -} - -void -group_free (rp_group *g) -{ - if (g->name) - free (g->name); - numset_free (g->numset); - numset_release (group_numset, g->number); - free (g); -} - -rp_group * -group_add_new_group (char *name) -{ - rp_group *g; - rp_group *cur; - - g = group_new (numset_request (group_numset), name); - - list_for_each_entry (cur, &rp_groups, node) - { - if(cur->number > g->number) - { - list_add_tail (&g->node, &cur->node); - return g; - } - } - - list_add_tail (&g->node, &rp_groups); - - return g; -} - -void -group_resort_group (rp_group *g) -{ - rp_group *cur; - struct list_head *last = &rp_groups; - - list_del (&g->node); - list_for_each_entry (cur, &rp_groups, node) - { - if(cur->number > g->number) - { - list_add (&g->node, last); - return; - } - last = &cur->node; - } - list_add (&g->node, last); -} - -void -group_rename (rp_group *g, char *name) -{ - if (g->name) - free (g->name); - g->name = xstrdup (name); -} - -rp_group * -group_next_group (void) -{ - return list_next_entry (rp_current_group, &rp_groups, node); -} - -rp_group * -group_prev_group (void) -{ - return list_prev_entry (rp_current_group, &rp_groups, node); -} - -rp_group * -group_last_group (void) -{ - int last_access = 0; - rp_group *most_recent = NULL; - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - if (cur != rp_current_group && cur->last_access > last_access) { - most_recent = cur; - last_access = cur->last_access; - } - } - return most_recent; -} - -rp_group * -groups_find_group_by_name (char *s, int exact_match) -{ - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - if (cur->name) - { - if ((!exact_match && str_comp (s, cur->name, strlen (s))) || - (exact_match && !strcmp (cur->name, s))) - return cur; - } - } - - return NULL; -} - -rp_group * -groups_find_group_by_number (int n) -{ - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - if (cur->number == n) - return cur; - } - - return NULL; -} - -/* Return the first group that contains the window. */ -rp_group * -groups_find_group_by_window (rp_window *win) -{ - rp_group *cur; - rp_window_elem *elem; - - list_for_each_entry (cur, &rp_groups, node) - { - elem = group_find_window (&cur->mapped_windows, win); - if (elem) - return cur; - } - - return NULL; -} - - -/* Return the first group that is g. */ -rp_group * -groups_find_group_by_group (rp_group *g) -{ - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - if (cur == g) - return cur; - } - - return NULL; -} - -rp_window_elem * -group_find_window (struct list_head *list, rp_window *win) -{ - rp_window_elem *cur; - - list_for_each_entry (cur, list, node) - { - if (cur->win == win) - return cur; - } - - return NULL; -} - -rp_window_elem * -group_find_window_by_number (rp_group *g, int num) -{ - rp_window_elem *cur; - - list_for_each_entry (cur, &g->mapped_windows, node) - { - if (cur->number == num) - return cur; - } - - return NULL; - -} - - -/* Insert a window_elem into the correct spot in the group's window - list to preserve window number ordering. */ -static void -group_insert_window (struct list_head *h, rp_window_elem *w) -{ - rp_window_elem *cur; - - list_for_each_entry (cur, h, node) - { - if (cur->number > w->number) - { - list_add_tail (&w->node, &cur->node); - return; - } - } - - list_add_tail(&w->node, h); -} - -static int -group_in_list (struct list_head *h, rp_window_elem *w) -{ - rp_window_elem *cur; - - list_for_each_entry (cur, h, node) - { - if (cur == w) - return 1; - } - - return 0; -} - -/* If a window_elem's number has changed then the list has to be - resorted. */ -void -group_resort_window (rp_group *g, rp_window_elem *w) -{ - /* Only a mapped window can be resorted. */ - if (!group_in_list (&g->mapped_windows, w)) - { - PRINT_DEBUG (("Attempting to restort an unmapped window!\n")); - return; - } - - list_del (&w->node); - group_insert_window (&g->mapped_windows, w); -} - -void -group_add_window (rp_group *g, rp_window *w) -{ - rp_window_elem *we; - - /* Create our container structure for the window. */ - we = malloc (sizeof (rp_window_elem)); - we->win = w; - we->number = -1; - - /* Finally, add it to our list. */ - list_add_tail (&we->node, &g->unmapped_windows); -} - -void -group_map_window (rp_group *g, rp_window *win) -{ - rp_window_elem *we; - - we = group_find_window (&g->unmapped_windows, win); - - if (we) - { - we->number = numset_request (g->numset); - list_del (&we->node); - group_insert_window (&g->mapped_windows, we); - } -} - -void -groups_map_window (rp_window *win) -{ - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - group_map_window (cur, win); - } -} - -void -group_unmap_window (rp_group *g, rp_window *win) -{ - rp_window_elem *we; - - we = group_find_window (&g->mapped_windows, win); - - if (we) - { - numset_release (g->numset, we->number); - list_move_tail (&we->node, &g->unmapped_windows); - } -} - -void -groups_unmap_window (rp_window *win) -{ - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - group_unmap_window (cur, win); - } -} - -void -group_del_window (rp_group *g, rp_window *win) -{ - rp_window_elem *cur; - struct list_head *iter, *tmp; - - /* The assumption is that a window is unmapped before it's deleted. */ - list_for_each_safe_entry (cur, iter, tmp, &g->unmapped_windows, node) - { - if (cur->win == win) - { - list_del (&cur->node); - free (cur); - } - } - - /* Make sure the window isn't in the list of mapped windows. This - would mean there is a bug. */ -#ifdef DEBUG - list_for_each_entry (cur, &g->mapped_windows, node) - { - if (cur->win == win) - PRINT_DEBUG (("This window wasn't removed from the mapped window list.\n")); - } -#endif -} - -/* Remove the window from any groups in resides in. */ -void -groups_del_window (rp_window *win) -{ - rp_group *cur; - - list_for_each_entry (cur, &rp_groups, node) - { - group_del_window (cur, win); - } -} - -rp_window * -group_last_window (rp_group *g, rp_screen *s) -{ - int last_access = 0; - rp_window_elem *most_recent = NULL; - rp_window_elem *cur; - - list_for_each_entry (cur, &g->mapped_windows, node) - { - if (cur->win->last_access >= last_access - && cur->win != current_window() - && !find_windows_frame (cur->win) - && (cur->win->scr == s || rp_have_xinerama)) - { - most_recent = cur; - last_access = cur->win->last_access; - } - } - - if (most_recent) - return most_recent->win; - - return NULL; -} - -rp_window * -group_next_window (rp_group *g, rp_window *win) -{ - rp_window_elem *cur, *we; - - /* If there is no window, then get the last accessed one. */ - if (win == NULL) - return group_last_window (g, current_screen()); - - /* If we can't find the window, then it's in a different group, so - get the last accessed one in this group. */ - we = group_find_window (&g->mapped_windows, win); - if (we == NULL) - return group_last_window (g, win->scr); - - /* The window is in this group, so find the next one in the list - that isn't already displayed. */ - for (cur = list_next_entry (we, &g->mapped_windows, node); - cur != we; - cur = list_next_entry (cur, &g->mapped_windows, node)) - { - if (!find_windows_frame (cur->win) && (cur->win->scr == win->scr || rp_have_xinerama)) - { - return cur->win; - } - } - - return NULL; -} - -rp_window * -group_prev_window (rp_group *g, rp_window *win) -{ - rp_window_elem *cur, *we; - - /* If there is no window, then get the last accessed one. */ - if (win == NULL) - return group_last_window (g, current_screen()); - - /* If we can't find the window, then it's in a different group, so - get the last accessed one in this group. */ - we = group_find_window (&g->mapped_windows, win); - if (we == NULL) - return group_last_window (g, win->scr); - - /* The window is in this group, so find the previous one in the list - that isn't already displayed. */ - for (cur = list_prev_entry (we, &g->mapped_windows, node); - cur != we; - cur = list_prev_entry (cur, &g->mapped_windows, node)) - { - if (!find_windows_frame (cur->win) && (cur->win->scr == win->scr || rp_have_xinerama)) - { - return cur->win; - } - } - - return NULL; - -} - -void -group_move_window (rp_group *to, rp_window *win) -{ - rp_group *cur, *from = NULL; - rp_window_elem *we = NULL; - - /* Find the group that the window belongs to. FIXME: If the window - exists in multiple groups, then we're going to find the first - group with this window in it. */ - list_for_each_entry (cur, &rp_groups, node) - { - we = group_find_window (&cur->mapped_windows, win); - if (we) - { - from = cur; - break; - } - } - - if (we == NULL || from == NULL) - { - PRINT_DEBUG (("Unable to find window in mapped window lists.\n")); - return; - } - - /* Manually remove the window from one group...*/ - numset_release (from->numset, we->number); - list_del (&we->node); - - /* and shove it into the other one. */ - we->number = numset_request (to->numset); - group_insert_window (&to->mapped_windows, we); -} - -void -groups_merge (rp_group *from, rp_group *to) -{ - rp_window_elem *cur; - struct list_head *iter, *tmp; - - /* Merging a group with itself makes no sense. */ - if (from == to) - return; - - /* Move the unmapped windows. */ - list_for_each_safe_entry (cur, iter, tmp, &from->unmapped_windows, node) - { - list_del (&cur->node); - list_add_tail (&cur->node, &to->unmapped_windows); - } - - /* Move the mapped windows. */ - list_for_each_safe_entry (cur, iter, tmp, &from->mapped_windows, node) - { - numset_release (from->numset, cur->number); - list_del (&cur->node); - - cur->number = numset_request (to->numset); - group_insert_window (&to->mapped_windows, cur); - } -} - -void -set_current_group (rp_group *g) -{ - if (rp_current_group == g || g == NULL) - return; - - set_current_group_1 (g); - - /* Call the switch group hook. */ - hook_run (&rp_switch_group_hook); -} - -int -group_delete_group (rp_group *g) -{ - if (list_empty (&(g->mapped_windows)) - && list_empty (&(g->unmapped_windows))) - { - /* don't delete the last group */ - if (list_size (&rp_groups) == 1) - return GROUP_DELETE_LAST_GROUP; - - /* we can safely delete the group */ - if (g == rp_current_group) - { - rp_group *next = group_last_group (); - set_current_group (next ? next : group_next_group ()); - } - - list_del (&(g->node)); - group_free (g); - return GROUP_DELETE_GROUP_OK; - } - else - { - return GROUP_DELETE_GROUP_NONEMPTY; - } -} - -/* Used by :cother / :iother */ -rp_window * -group_last_window_by_class (rp_group *g, char *class) -{ - int last_access = 0; - rp_window_elem *most_recent = NULL; - rp_window_elem *cur; - rp_screen *s = current_screen(); - - list_for_each_entry (cur, &g->mapped_windows, node) - { - if (cur->win->last_access >= last_access - && cur->win != current_window() - && !find_windows_frame (cur->win) - && (cur->win->scr == s || rp_have_xinerama) - && strcmp(class, cur->win->res_class)) - { - most_recent = cur; - last_access = cur->win->last_access; - } - } - - if (most_recent) - return most_recent->win; - - return NULL; -} - -/* Used by :cother / :iother */ -rp_window * -group_last_window_by_class_complement (rp_group *g, char *class) -{ - int last_access = 0; - rp_window_elem *most_recent = NULL; - rp_window_elem *cur; - rp_screen *s = current_screen(); - - list_for_each_entry (cur, &g->mapped_windows, node) - { - if (cur->win->last_access >= last_access - && cur->win != current_window() - && !find_windows_frame (cur->win) - && (cur->win->scr == s || rp_have_xinerama) - && !strcmp(class, cur->win->res_class)) - { - most_recent = cur; - last_access = cur->win->last_access; - } - } - - if (most_recent) - return most_recent->win; - - return NULL; -} diff --git a/src/group.h b/src/group.h deleted file mode 100644 index 364100f..0000000 --- a/src/group.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef GROUP_H -#define GROUP_H - -void init_groups (void); -void free_groups (void); - -void group_add_window (rp_group *g, rp_window *w); -void group_resort_window (rp_group *g, rp_window_elem *w); -void group_free (rp_group *g); -rp_group *group_new (int number, char *name); -int group_delete_group (rp_group *g); - -void group_del_window (rp_group *g, rp_window *win); -void groups_del_window (rp_window *win); - -void group_map_window (rp_group *g, rp_window *win); -void groups_map_window (rp_window *win); - -void group_unmap_window (rp_group *g, rp_window *win); -void groups_unmap_window (rp_window *win); - -rp_window *group_prev_window (rp_group *g, rp_window *win); -rp_window *group_next_window (rp_group *g, rp_window *win); -rp_group *groups_find_group_by_name (char *s, int exact_match); -rp_group *groups_find_group_by_number (int n); -rp_group *groups_find_group_by_window (rp_window *win); -rp_group *groups_find_group_by_group (rp_group *g); - -rp_window *group_last_window (rp_group *g, rp_screen *screen); - -rp_group *group_prev_group (void); -rp_group *group_next_group (void); -rp_group *group_last_group (void); - -rp_group *group_add_new_group (char *name); -void group_rename (rp_group *g, char *name); - -rp_window_elem *group_find_window (struct list_head *list, rp_window *win); -rp_window_elem *group_find_window_by_number (rp_group *g, int num); - -void group_move_window (rp_group *to, rp_window *win); -void groups_merge (rp_group *from, rp_group *to); - -void set_current_group (rp_group *g); - -rp_window *group_last_window_by_class (rp_group *g, char *class); -rp_window *group_last_window_by_class_complement (rp_group *g, char *class); -#endif diff --git a/src/history.c b/src/history.c deleted file mode 100644 index a63658c..0000000 --- a/src/history.c +++ /dev/null @@ -1,320 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <ctype.h> -#include <errno.h> -#include <string.h> -#include <limits.h> - -#include "ratpoison.h" - -#ifdef HAVE_HISTORY -#include "readline/history.h" -#endif - -static char * -get_history_filename (void) -{ - char *homedir = getenv ("HOME"); - char *filename; - - if (homedir) - { - filename = xmalloc (strlen (homedir) + strlen ("/" HISTORY_FILE) + 1); - sprintf (filename, "%s/" HISTORY_FILE, homedir); - } - else - { - filename = xstrdup (HISTORY_FILE); - } - - return filename; -} - -static const char * -extract_shell_part (const char *p) -{ - if (strncmp(p, "exec", 4) && - strncmp(p, "verbexec", 8)) - return NULL; - while( *p && !isspace(*p) ) - p++; - while( *p && isspace(*p) ) - p++; - if (*p) - return p; - return NULL; -} - -struct history_item { - struct list_head node; - char *line; -}; - -static struct history { - struct list_head head, *current; - size_t count; -} histories[hist_COUNT]; - -#ifndef HAVE_GETLINE -ssize_t -getline(char **lineptr, size_t *n, FILE *f) -{ - size_t ofs; - - if (!*lineptr) { - *lineptr = xmalloc (4096); - *n = 4096; - } - ofs = 0; - do { - (*lineptr)[ofs] = '\0'; - if (!fgets (*lineptr, (*n) - ofs, f)) { - /* do not tread unterminated last lines as errors, - * (it's still a malformed text file and noone should - * have created it) */ - return ofs?(ssize_t)ofs:-1; - } - ofs += strlen ((*lineptr) + ofs); - if (ofs >= *n) - /* should never happen... */ - return -1; - if (ofs > 0 && (*lineptr)[ofs-1] == '\n') - return ofs; - if (ofs + 1 == *n) { - if (*n >= INT_MAX - 4096) - return -1; - *n += 4096; - *lineptr = xrealloc(*lineptr, *n); - } - } while(1); -} -#endif - -static void -history_add_upto (int history_id, const char *item, size_t max) -{ - struct history *h = histories + history_id; - struct history_item *i; - - if (item == NULL || *item == '\0' || isspace(*item)) - return; - - list_last (i, &histories[history_id].head, node); - if (i && !strcmp (i->line, item)) - return; - - if (history_id == hist_COMMAND) { - const char *p = extract_shell_part (item); - if (p) - history_add_upto (hist_SHELLCMD, p, max); - } - - if (defaults.history_compaction && max != INT_MAX) { - struct list_head *l; - - for (l = h->head.prev ; l != &h->head ; l = l->prev) { - if (!strcmp (list_entry(l, struct history_item, node)->line, item)) { - list_del (l); - list_add_tail (l, &h->head); - return; - } - } - } - - while (h->count >= max) { - list_first (i, &h->head, node); - if (!i) { - h->count = 0; - break; - } - list_del (&i->node); - free (i->line); - free (i); - h->count--; - } - - if( max == 0 ) - return; - - i = xmalloc (sizeof (*i)); - i->line = xstrdup (item); - - list_add_tail (&i->node, &h->head); - h->count++; -} - -void -history_add (int history_id, const char *item) -{ - history_add_upto (history_id, item, defaults.history_size); -} - -void -history_load (void) -{ - char *filename = get_history_filename (); - FILE *f; - char *line = NULL; - size_t s = 0; - ssize_t linelen; - int id; - - for (id = hist_NONE ; id < hist_COUNT ; id++ ) { - INIT_LIST_HEAD (&histories[id].head); - histories[id].current = &histories[id].head; - histories[id].count = 0; - } - - if (!filename) - return; - f = fopen (filename, "r"); - if (!f) { - PRINT_DEBUG (("ratpoison: could not read %s - %s\n", filename, strerror (errno))); - free (filename); - return; - } - - while ((linelen = getline (&line, &s, f)) >= 0) { - while (linelen > 0 && (line[linelen-1] == '\n' || line[linelen-1] == '\r')) { - line[--linelen] = '\0'; - } - if (linelen == 0) - continue; - /* defaults.history_size might be only set later */ - history_add_upto (hist_COMMAND, line, INT_MAX); - } - if (ferror (f)) { - PRINT_DEBUG (("ratpoison: error reading %s - %s\n", filename, strerror (errno))); - fclose(f); - free (filename); - return; - } - if (!fclose(f)) - PRINT_DEBUG (("ratpoison: error reading %s - %s\n", filename, strerror (errno))); - free (filename); -} - -void -history_save (void) -{ - char *filename = get_history_filename (); - FILE *f; - struct history_item *item; - - if (!defaults.history_size) - return; - - if (!filename) - return; - f = fopen (filename, "w"); - if (!f) { - PRINT_DEBUG (("ratpoison: could not write %s - %s\n", filename, strerror (errno))); - free (filename); - return; - } - - list_for_each_entry(item, &histories[hist_COMMAND].head, node) { - fputs(item->line, f); - putc('\n', f); - } - - if (ferror (f)) { - PRINT_DEBUG (("ratpoison: error writing %s - %s\n", filename, strerror (errno))); - fclose(f); - free (filename); - return; - } - if (!fclose(f)) - PRINT_DEBUG (("ratpoison: error writing %s - %s\n", filename, strerror (errno))); - free (filename); -} - -void -history_reset (void) -{ - int id; - - for (id = hist_NONE ; id < hist_COUNT ; id++ ) - histories[id].current = &histories[id].head; -} - -void -history_resize (int size) -{ - struct history_item *i; - struct history *h; - int id; - - for (id = hist_NONE ; id < hist_COUNT ; id++ ) { - h = histories + id; - while (h->count >= (size_t)size) { - list_first (i, &h->head, node); - list_del (&i->node); - free (i->line); - free (i); - h->count--; - } - } -} - -const char * -history_previous (int history_id) -{ - if (history_id == hist_NONE) - return NULL; - /* return NULL, if list empty or already at first */ - if (histories[history_id].current == histories[history_id].head.next) - return NULL; - histories[history_id].current = histories[history_id].current->prev; - return list_entry(histories[history_id].current, struct history_item, node)->line; -} - -const char * -history_next (int history_id) -{ - if (history_id == hist_NONE) - return NULL; - /* return NULL, if list empty or already behind last */ - if (histories[history_id].current == &histories[history_id].head) - return NULL; - histories[history_id].current = histories[history_id].current->next; - if (histories[history_id].current == &histories[history_id].head) - return NULL; - return list_entry(histories[history_id].current, struct history_item, node)->line; -} - -int history_expand_line (int history_id UNUSED, char *string, char **output) -{ -#ifdef HAVE_HISTORY - struct history_item *item; - - if (strchr (string, '!')) { - clear_history (); - using_history (); - list_for_each_entry(item, &histories[history_id].head, node) { - add_history (item->line); - } - return history_expand (string, output); - } -#endif - *output = xstrdup(string); - return 0; -} diff --git a/src/history.h b/src/history.h deleted file mode 100644 index 193874d..0000000 --- a/src/history.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_HISTORY_H -#define _RATPOISON_HISTORY_H 1 - -enum { hist_NONE=0, hist_COMMAND, hist_SHELLCMD, - hist_SELECT, hist_KEYMAP, hist_KEY, - hist_WINDOW, hist_GRAVITY, hist_GROUP, - hist_HOOK, hist_VARIABLE, hist_PROMPT, - hist_OTHER, - /* must be last, do not use, for length only: */ - hist_COUNT}; - -#ifndef HAVE_GETLINE -ssize_t getline (char **lineptr, size_t *n, FILE *f); -#endif - -void history_load (void); -void history_save (void); -void history_resize (int size); -void history_reset (void); -void history_add (int, const char *item); -const char *history_next (int); -const char *history_previous (int); -int history_expand_line (int, char *string, char **output); - -#endif /* ! _RATPOISON_HISTORY_H */ diff --git a/src/hook.c b/src/hook.c deleted file mode 100644 index 3ff4751..0000000 --- a/src/hook.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -/* A hook is simply a list of strings that get passed to command() in - sequence. */ - -#include "ratpoison.h" - -#include <string.h> - -void -hook_add (struct list_head *hook, struct sbuf *s) -{ - struct sbuf *cur; - - /* Check if it's in the list already. */ - list_for_each_entry (cur, hook, node) - { - if (!strcmp (sbuf_get (cur), sbuf_get (s))) - return; - } - - /* It's not in the list, so add it. */ - list_add_tail (&s->node, hook); -} - -void -hook_remove (struct list_head *hook, struct sbuf *s) -{ - struct list_head *tmp, *iter; - struct sbuf *cur; - - /* If it's in the list, delete it. */ - list_for_each_safe_entry (cur, iter, tmp, hook, node) - { - if (!strcmp (sbuf_get (cur), sbuf_get (s))) - { - list_del (&cur->node); - sbuf_free (cur); - } - } -} - -void -hook_run (struct list_head *hook) -{ - struct sbuf *cur; - cmdret *result; - - list_for_each_entry (cur, hook, node) - { - result = command (1, sbuf_get (cur)); - if (result) - { - if (result->output) - message (result->output); - cmdret_free (result); - } - } -} - -struct list_head * -hook_lookup (char *s) -{ - struct rp_hook_db_entry *entry; - - for (entry = rp_hook_db; entry->name; entry++) - { - if (!strcmp (s, entry->name)) - { - return entry->hook; - } - } - - return NULL; -} diff --git a/src/hook.h b/src/hook.h deleted file mode 100644 index da53428..0000000 --- a/src/hook.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef HOOKS_H -#define HOOKS_H - -void hook_run (struct list_head *hook); -void hook_remove (struct list_head *hook, struct sbuf *s); -void hook_add (struct list_head *hook, struct sbuf *s); -struct list_head *hook_lookup (char *s); - -#endif diff --git a/src/input.c b/src/input.c deleted file mode 100644 index 5757bf7..0000000 --- a/src/input.c +++ /dev/null @@ -1,622 +0,0 @@ -/* Read kdb input from the user. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <X11/Xlib.h> -#include <X11/keysym.h> -#include <X11/Xutil.h> - -#include "ratpoison.h" - -/* Convert an X11 modifier mask to the rp modifier mask equivalent, as - best it can (the X server may not have a hyper key defined, for - instance). */ -unsigned int -x11_mask_to_rp_mask (unsigned int mask) -{ - unsigned int result = 0; - - PRINT_DEBUG (("x11 mask = %x\n", mask)); - - result |= mask & ShiftMask ? RP_SHIFT_MASK:0; - result |= mask & ControlMask ? RP_CONTROL_MASK:0; - result |= mask & rp_modifier_info.meta_mod_mask ? RP_META_MASK:0; - result |= mask & rp_modifier_info.alt_mod_mask ? RP_ALT_MASK:0; - result |= mask & rp_modifier_info.hyper_mod_mask ? RP_HYPER_MASK:0; - result |= mask & rp_modifier_info.super_mod_mask ? RP_SUPER_MASK:0; - - PRINT_DEBUG (("rp mask = %x\n", mask)); - - return result; -} - -/* Convert an rp modifier mask to the x11 modifier mask equivalent, as - best it can (the X server may not have a hyper key defined, for - instance). */ -unsigned int -rp_mask_to_x11_mask (unsigned int mask) -{ - unsigned int result = 0; - - PRINT_DEBUG (("rp mask = %x\n", mask)); - - result |= mask & RP_SHIFT_MASK ? ShiftMask:0; - result |= mask & RP_CONTROL_MASK ? ControlMask:0; - result |= mask & RP_META_MASK ? rp_modifier_info.meta_mod_mask:0; - result |= mask & RP_ALT_MASK ? rp_modifier_info.alt_mod_mask:0; - result |= mask & RP_HYPER_MASK ? rp_modifier_info.hyper_mod_mask:0; - result |= mask & RP_SUPER_MASK ? rp_modifier_info.super_mod_mask:0; - - PRINT_DEBUG (("x11 mask = %x\n", result)); - - return result; -} - - -/* /\* The caller is responsible for freeing the keycodes. *\/ */ -/* KeyCode * */ -/* keysym_to_keycodes (KeySym sym, int *n_returned) */ -/* { */ -/* int min_code, max_code; */ -/* int syms_per_code; */ -/* KeySym *syms; */ -/* KeyCode *codes; */ -/* int code, code_col; */ - -/* XDisplayKeycodes (dpy, &min_code, &max_code); */ -/* syms = XGetKeyboardMapping (dpy, */ -/* min_code, max_code - min_code + 1, */ -/* &syms_per_code); */ - -/* *n_returned = 0; */ -/* codes = (KeyCode *)xmalloc (sizeof(KeyCode) * n_returned); */ -/* for (code = min_code; code < max_code; code++) */ -/* for (code_col = 0; code_col < syms_per_code; code_col++) */ -/* { */ -/* int s = syms[((code - min_code) * syms_per_code) + code_col]; */ - -/* if (sym == s) */ -/* { */ -/* n_returned++; */ -/* codes = (KeyCode *)xrealloc (sizeof(KeyCode) * n_returned); */ -/* codes[n_returned-1] = code; */ -/* } */ -/* } */ - -/* XFree ((char *) syms); */ - -/* if (n_returned > 0) */ -/* return codes; */ -/* else */ -/* { */ -/* xfree (codes) */ -/* return NULL; */ -/* } */ -/* } */ - -/* Figure out what keysyms are attached to what modifiers */ -void -update_modifier_map (void) -{ - unsigned int modmasks[] = - { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; - int row, col; /* The row and column in the modifier table. */ - int found_alt_or_meta; - XModifierKeymap *mods; - int min_code, max_code; - int syms_per_code; - KeySym *syms; - - rp_modifier_info.meta_mod_mask = 0; - rp_modifier_info.alt_mod_mask = 0; - rp_modifier_info.super_mod_mask = 0; - rp_modifier_info.hyper_mod_mask = 0; - rp_modifier_info.num_lock_mask = 0; - rp_modifier_info.scroll_lock_mask = 0; - - XDisplayKeycodes (dpy, &min_code, &max_code); - syms = XGetKeyboardMapping (dpy, - min_code, max_code - min_code + 1, - &syms_per_code); - mods = XGetModifierMapping (dpy); - - for (row=3; row < 8; row++) - { - found_alt_or_meta = 0; - for (col=0; col < mods->max_keypermod; col++) - { - KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col]; - - PRINT_DEBUG (("row: %d col: %d code: %d\n", row, col, code)); - - if (code == 0) continue; - - /* Are any of this keycode's keysyms a meta key? */ - { - int code_col; - - for (code_col = 0; code_col < syms_per_code; code_col++) - { - int sym = syms[((code - min_code) * syms_per_code) + code_col]; - - switch (sym) - { - case XK_Meta_L: - case XK_Meta_R: - found_alt_or_meta = 1; - rp_modifier_info.meta_mod_mask |= modmasks[row - 3]; - PRINT_DEBUG (("Found Meta on %d\n", - rp_modifier_info.meta_mod_mask)); - break; - - case XK_Alt_L: - case XK_Alt_R: - found_alt_or_meta = 1; - rp_modifier_info.alt_mod_mask |= modmasks[row - 3]; - PRINT_DEBUG (("Found Alt on %d\n", - rp_modifier_info.alt_mod_mask)); - break; - - case XK_Super_L: - case XK_Super_R: - if (!found_alt_or_meta) - { - rp_modifier_info.super_mod_mask |= modmasks[row - 3]; - PRINT_DEBUG (("Found Super on %d\n", - rp_modifier_info.super_mod_mask)); - } - code_col = syms_per_code; - col = mods->max_keypermod; - break; - - case XK_Hyper_L: - case XK_Hyper_R: - if (!found_alt_or_meta) - { - rp_modifier_info.hyper_mod_mask |= modmasks[row - 3]; - PRINT_DEBUG (("Found Hyper on %d\n", - rp_modifier_info.hyper_mod_mask)); - } - code_col = syms_per_code; - col = mods->max_keypermod; - - break; - - case XK_Num_Lock: - rp_modifier_info.num_lock_mask |= modmasks[row - 3]; - PRINT_DEBUG (("Found NumLock on %d\n", - rp_modifier_info.num_lock_mask)); - break; - - case XK_Scroll_Lock: - rp_modifier_info.scroll_lock_mask |= modmasks[row - 3]; - PRINT_DEBUG (("Found ScrollLock on %d\n", - rp_modifier_info.scroll_lock_mask)); - break; - default: - break; - } - } - } - } - } - - /* Stolen from Emacs 21.0.90 - xterm.c */ - /* If we couldn't find any meta keys, accept any alt keys as meta keys. */ - if (! rp_modifier_info.meta_mod_mask) - { - rp_modifier_info.meta_mod_mask = rp_modifier_info.alt_mod_mask; - rp_modifier_info.alt_mod_mask = 0; - } - - /* If some keys are both alt and meta, - make them just meta, not alt. */ - if (rp_modifier_info.alt_mod_mask & rp_modifier_info.meta_mod_mask) - { - rp_modifier_info.alt_mod_mask &= ~rp_modifier_info.meta_mod_mask; - } - - XFree ((char *) syms); - XFreeModifiermap (mods); -} - -/* we need a keycode + modifier to generate the proper keysym (such as - @). Return 1 if successful, 0 otherwise. This function can fail if a - keysym doesn't map to a keycode. */ -static int -keysym_to_keycode_mod (KeySym keysym, KeyCode *code, unsigned int *mod) -{ - KeySym lower, upper; - - *mod = 0; - *code = XKeysymToKeycode (dpy, keysym); - lower = XKeycodeToKeysym (dpy, *code, 0); - upper = XKeycodeToKeysym (dpy, *code, 1); - /* If you need to press shift to get the keysym, add the shift - mask. */ - if (upper == keysym && lower != keysym) - *mod = ShiftMask; - - return *code != 0; -} - -/* Grab the key while ignoring annoying modifier keys including - caps lock, num lock, and scroll lock. */ -void -grab_key (KeySym keysym, unsigned int modifiers, Window grab_window) -{ - unsigned int mod_list[8]; - int i; - KeyCode keycode; - unsigned int mod; - - /* Convert to a modifier mask that X Windows will understand. */ - modifiers = rp_mask_to_x11_mask (modifiers); - if (!keysym_to_keycode_mod (keysym, &keycode, &mod)) - return; - PRINT_DEBUG (("keycode_mod: %ld %d %d\n", keysym, keycode, mod)); - modifiers |= mod; - - /* Create a list of all possible combinations of ignored - modifiers. Assumes there are only 3 ignored modifiers. */ - mod_list[0] = 0; - mod_list[1] = LockMask; - mod_list[2] = rp_modifier_info.num_lock_mask; - mod_list[3] = mod_list[1] | mod_list[2]; - mod_list[4] = rp_modifier_info.scroll_lock_mask; - mod_list[5] = mod_list[1] | mod_list[4]; - mod_list[6] = mod_list[2] | mod_list[4]; - mod_list[7] = mod_list[1] | mod_list[2] | mod_list[4]; - - /* Grab every combination of ignored modifiers. */ - for (i=0; i<8; i++) - { - XGrabKey(dpy, keycode, modifiers | mod_list[i], - grab_window, True, GrabModeAsync, GrabModeAsync); - } -} - - -/* Return the name of the keysym. caller must free returned pointer */ -char * -keysym_to_string (KeySym keysym, unsigned int modifier) -{ - static char *null_string = "NULL"; /* A NULL string. */ - struct sbuf *name; - char *tmp; - - name = sbuf_new (0); - - if (modifier & RP_SHIFT_MASK) sbuf_concat (name, "S-"); - if (modifier & RP_CONTROL_MASK) sbuf_concat (name, "C-"); - if (modifier & RP_META_MASK) sbuf_concat (name, "M-"); - if (modifier & RP_ALT_MASK) sbuf_concat (name, "A-"); - if (modifier & RP_HYPER_MASK) sbuf_concat (name, "H-"); - if (modifier & RP_SUPER_MASK) sbuf_concat (name, "s-"); - - /* On solaris machines (perhaps other machines as well) this call - can return NULL. In this case use the "NULL" string. */ - tmp = XKeysymToString (keysym); - if (tmp == NULL) - tmp = null_string; - - sbuf_concat (name, tmp); - - /* Eat the nut and throw away the shells. */ - tmp = sbuf_get (name); - free (name); - - return tmp; -} - -/* Cooks a keycode + modifier into a keysym + modifier. This should be - used anytime meaningful key information is to be extracted from a - KeyPress or KeyRelease event. - - returns the number of bytes in keysym_name. If you are not - interested in the keysym name pass in NULL for keysym_name and 0 - for len. */ -int -cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_name, int len, int ignore_bad_mods) -{ - int nbytes; - int shift = 0; - KeySym lower, upper; - - if (ignore_bad_mods) - { - ev->state &= ~(LockMask - | rp_modifier_info.num_lock_mask - | rp_modifier_info.scroll_lock_mask); - } - - if (len > 0) len--; - nbytes = XLookupString (ev, keysym_name, len, keysym, NULL); - - /* Null terminate the string (not all X servers do it for us). */ - if (keysym_name) { - keysym_name[nbytes] = '\0'; - } - - /* Find out if XLookupString gobbled the shift modifier */ - if (ev->state & ShiftMask) - { - lower = XKeycodeToKeysym (dpy, ev->keycode, 0); - upper = XKeycodeToKeysym (dpy, ev->keycode, 1); - /* If the keysym isn't affected by the shift key, then keep the - shift modifier. */ - if (lower == upper) - shift = ShiftMask; - } - - *mod = ev->state; - *mod &= (rp_modifier_info.meta_mod_mask - | rp_modifier_info.alt_mod_mask - | rp_modifier_info.hyper_mod_mask - | rp_modifier_info.super_mod_mask - | ControlMask - | shift); - - return nbytes; -} - -/* Wait for a key and discard it. */ -void -read_any_key () -{ - char buffer[513]; - unsigned int mod; - KeySym c; - - read_single_key (&c, &mod, buffer, sizeof (buffer)); -} - -/* The same as read_key, but handle focusing the key_window and reverting focus. */ -int -read_single_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len) -{ - Window focus; - int revert; - int nbytes; - - XGetInputFocus (dpy, &focus, &revert); - set_window_focus (current_screen()->key_window); - nbytes = read_key (keysym, modifiers, keysym_name, len); - set_window_focus (focus); - - return nbytes; -} - -int -read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len) -{ - XEvent ev; - int nbytes; - - /* Read a key from the keyboard. */ - do - { - XMaskEvent (dpy, KeyPressMask|KeyRelease, &ev); - *modifiers = ev.xkey.state; - nbytes = cook_keycode (&ev.xkey, keysym, modifiers, keysym_name, len, 0); - } while (IsModifierKey (*keysym) || ev.xkey.type == KeyRelease); - - return nbytes; -} - -static void -update_input_window (rp_screen *s, rp_input_line *line) -{ - int prompt_width, input_width, total_width; - int char_len = 0, height; - GC lgc; - XGCValues gcv; - - prompt_width = rp_text_width (s, line->prompt, -1); - input_width = rp_text_width (s, line->buffer, line->length); - total_width = defaults.bar_x_padding * 2 + prompt_width + input_width + MAX_FONT_WIDTH (defaults.font); - height = (FONT_HEIGHT (s) + defaults.bar_y_padding * 2); - - if (RP_IS_UTF8_START (line->buffer[line->position])) - do - char_len++; - while (RP_IS_UTF8_CONT (line->buffer[line->position + char_len])); - else - char_len = 1; - - if (total_width < defaults.input_window_size + prompt_width) - { - total_width = defaults.input_window_size + prompt_width; - } - - XMoveResizeWindow (dpy, s->input_window, - bar_x (s, total_width), bar_y (s, height), total_width, - (FONT_HEIGHT (s) + defaults.bar_y_padding * 2)); - - XClearWindow (dpy, s->input_window); - XSync (dpy, False); - - rp_draw_string (s, s->input_window, STYLE_NORMAL, - defaults.bar_x_padding, - defaults.bar_y_padding + FONT_ASCENT(s), - line->prompt, - -1); - - rp_draw_string (s, s->input_window, STYLE_NORMAL, - defaults.bar_x_padding + prompt_width, - defaults.bar_y_padding + FONT_ASCENT(s), - line->buffer, - line->length); - - gcv.function = GXxor; - gcv.foreground = s->fg_color ^ s->bg_color; - lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gcv); - - /* Draw a cheap-o cursor - MkIII */ - XFillRectangle (dpy, s->input_window, lgc, - defaults.bar_x_padding + prompt_width + - rp_text_width (s, line->buffer, line->position), - defaults.bar_y_padding, - rp_text_width (s, &line->buffer[line->position], char_len), - FONT_HEIGHT (s)); - - XFlush (dpy); - XFreeGC (dpy, lgc); -} - -void -ring_bell (void) -{ -#ifdef VISUAL_BELL - GC lgc; - XGCValues gcv; - XWindowAttributes attr; - rp_screen *s = current_screen (); - - XGetWindowAttributes (dpy, s->input_window, &attr); - - gcv.function = GXxor; - gcv.foreground = s->fg_color ^ s->bg_color; - lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gcv); - - XFillRectangle (dpy, s->input_window, lgc, 0, 0, attr.width, attr.height); - XFlush (dpy); - -#ifdef HAVE_USLEEP - usleep (15000); -#else - { - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = 15000; - select (0, NULL, NULL, NULL, &tv); - } -#endif - XFillRectangle (dpy, s->input_window, lgc, 0, 0, attr.width, attr.height); - XFlush (dpy); - XFreeGC (dpy, lgc); -#else - XBell (dpy, 0); -#endif -} - -char * -get_input (char *prompt, int history_id, completion_fn fn) -{ - return get_more_input (prompt, "", history_id, fn); -} - -char * -get_more_input (char *prompt, char *preinput, int history_id, - completion_fn compl_fn) -{ - /* Emacs 21 uses a 513 byte string to store the keysym name. */ - char keysym_buf[513]; - rp_screen *s = current_screen (); - KeySym ch; - unsigned int modifier; - rp_input_line *line; - char *final_input; - edit_status status; - Window focus; - int revert, done = 0; - - history_reset(); - - /* Create our line structure */ - line = input_line_new (prompt, preinput, history_id, compl_fn); - - /* We don't want to draw overtop of the program bar. */ - hide_bar (s); - - /* Switch to the default colormap. */ - if (current_window()) - XUninstallColormap (dpy, current_window()->colormap); - XInstallColormap (dpy, s->def_cmap); - - XMapWindow (dpy, s->input_window); - XRaiseWindow (dpy, s->input_window); - XClearWindow (dpy, s->input_window); - /* Switch focus to our input window to read the next key events. */ - XGetInputFocus (dpy, &focus, &revert); - set_window_focus (s->input_window); - XSync (dpy, False); - - update_input_window (s, line); - - while (!done) - { - read_key (&ch, &modifier, keysym_buf, sizeof (keysym_buf)); - modifier = x11_mask_to_rp_mask (modifier); - PRINT_DEBUG (("ch = %ld, modifier = %d, keysym_buf = %s", - ch, modifier, keysym_buf)); - status = execute_edit_action (line, ch, modifier, keysym_buf); - - switch (status) - { - case EDIT_COMPLETE: - case EDIT_DELETE: - case EDIT_INSERT: - case EDIT_MOVE: - /* If the text changed (and we didn't just complete - something) then set the virgin bit. */ - if (status != EDIT_COMPLETE) - line->compl->virgin = 1; - /* In all cases, we need to redisplay the input string. */ - update_input_window (s, line); - break; - case EDIT_NO_OP: - ring_bell (); - break; - case EDIT_ABORT: - final_input = NULL; - done = 1; - break; - case EDIT_DONE: - final_input = xstrdup (line->buffer); - done = 1; - break; - default: - PRINT_ERROR (("Unhandled status %d; this is a *BUG*\n", status)); - exit (EXIT_FAILURE); - } - } - - /* Clean up our line structure */ - input_line_free (line); - - /* Revert focus. */ - set_window_focus (focus); - XUnmapWindow (dpy, s->input_window); - - /* Possibly restore colormap. */ - if (current_window()) - { - XUninstallColormap (dpy, s->def_cmap); - XInstallColormap (dpy, current_window()->colormap); - } - - return final_input; -} diff --git a/src/input.h b/src/input.h deleted file mode 100644 index 5beb96e..0000000 --- a/src/input.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Function prototypes. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_INPUT_H -#define _RATPOISON_INPUT_H 1 - -char *keysym_to_string (KeySym keysym, unsigned int modifier); -int cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_name, int len, int ignore_bad_mods); -char *get_input (char *prompt, int history_id, completion_fn fn); -char *get_more_input (char *prompt, char *preinput, int history_id, completion_fn fn); -void read_any_key (void); -int read_single_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len); -int read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len); -unsigned int x11_mask_to_rp_mask (unsigned int mask); -unsigned int rp_mask_to_x11_mask (unsigned int mask); -void update_modifier_map (void); -void grab_key (KeySym keysym, unsigned int modifiers, Window grab_window); - -void ring_bell (void); - -#endif /* ! _RATPOISON_INPUT_H */ diff --git a/src/linkedlist.c b/src/linkedlist.c deleted file mode 100644 index ae3d143..0000000 --- a/src/linkedlist.c +++ /dev/null @@ -1,204 +0,0 @@ -/* This file was taken from the Linux kernel and is - * Copyright (C) 2003 Linus Torvalds - * - * Modified by Shawn Betts. Portions created by Shawn Betts are - * Copyright (C) 2003, 2004 Shawn Betts - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include "linkedlist.h" - -#if __GNUC__ <= 3 -void -prefetch(const void *x) -{;} -#endif - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -void -__list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -void -list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -void -list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -void -__list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -void -list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -void -list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -void -list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -void -list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -int -list_empty(struct list_head *head) -{ - return head->next == head; -} - -void -__list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -void -list_splice(struct list_head *list, struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - -/** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -void -list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -int -list_size (struct list_head *list) -{ - struct list_head *cur; - - int i = 0; - list_for_each (cur, list) - i++; - - return i; -} diff --git a/src/linkedlist.h b/src/linkedlist.h deleted file mode 100644 index 4434766..0000000 --- a/src/linkedlist.h +++ /dev/null @@ -1,215 +0,0 @@ -/* This file was taken from the Linux kernel and is - * Copyright (C) 2003 Linus Torvalds - * - * Modified by Shawn Betts. Portions created by Shawn Betts are - * Copyright (C) 2003, 2004 Shawn Betts - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_LINKLIST_H -#define _RATPOISON_LINKLIST_H - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* Prototypes of C functions. */ -int list_size (struct list_head *list); -void list_splice_init(struct list_head *list, - struct list_head *head); - -void list_splice_init(struct list_head *list, - struct list_head *head); - -void list_splice(struct list_head *list, struct list_head *head); - -void __list_splice(struct list_head *list, - struct list_head *head); - -int list_empty(struct list_head *head); - -void list_move_tail(struct list_head *list, - struct list_head *head); - -void list_move(struct list_head *list, struct list_head *head); - -void list_del_init(struct list_head *entry); -void list_del(struct list_head *entry); -void __list_del(struct list_head * prev, struct list_head * next); -void list_add_tail(struct list_head *new, struct list_head *head); -void list_add(struct list_head *new, struct list_head *head); -void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next); -#if __GNUC__ > 3 -#define prefetch __builtin_prefetch -#else -void prefetch(const void *x); -#endif - -/* Return the last element in the list. */ -#define list_last(last, head, member) \ -{ \ - last = list_entry((head)->prev, typeof(*last), member); \ - if (&last->member == (head)) \ - last = NULL; \ -} - - -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - - -/** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code, no prefetching is done. - * Use this for code that knows the list to be very short (empty - * or 1 entry) most of the time. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ - pos = pos->prev, prefetch(pos->prev)) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -#define list_for_each_safe_entry(item, pos, n, head, member) \ - for (pos = (head)->next, \ - item = list_entry(pos, typeof(*item), member), \ - n = pos->next \ - ; \ - pos != (head) \ - ; \ - pos = n, \ - item = list_entry(pos, typeof(*item), member), \ - n = pos->next) \ - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - prefetch(pos->member.next); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member), \ - prefetch(pos->member.next)) - -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, \ - n = list_entry(pos->member.next, typeof(*pos), member)) - -#define list_direction_entry(pos, head, member, direction) \ -({ \ - typeof(pos) ret = NULL; \ - struct list_head *a_head = head; \ - if (pos->member.direction == a_head) { \ - ret = list_entry(a_head->direction, \ - typeof(*pos), member); \ - } else { \ - ret = list_entry(pos->member.direction, \ - typeof(*pos), member); \ - } \ - ret; \ -}) - -#define list_next_entry(pos, head, member) \ - list_direction_entry(pos, head, member, next) - -#define list_prev_entry(pos, head, member) \ - list_direction_entry(pos, head, member, prev) - -#define list_for_each_entry_prev(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - prefetch(pos->member.prev); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member), \ - prefetch(pos->member.prev)) - -#endif - - -/* Return the first element in the list. */ -#define list_first(first, head, member) \ -{ \ - first = list_entry((head)->next, typeof(*first), member); \ - if (&first->member == (head)) \ - first = NULL; \ -} diff --git a/src/main.c b/src/main.c deleted file mode 100644 index de2a793..0000000 --- a/src/main.c +++ /dev/null @@ -1,863 +0,0 @@ -/* Ratpoison. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> -#include <X11/Xproto.h> -#include <X11/cursorfont.h> - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <getopt.h> -#include <string.h> -#include <sys/wait.h> -#include <ctype.h> - -#include "ratpoison.h" - -#ifdef HAVE_LANGINFO_CODESET -# include <langinfo.h> -#endif - -/* Several systems seem not to have WAIT_ANY defined, so define it if - it isn't. */ -#ifndef WAIT_ANY -# define WAIT_ANY -1 -#endif - -/* Command line options */ -static struct option ratpoison_longopts[] = - { {"help", no_argument, 0, 'h'}, - {"interactive", no_argument, 0, 'i'}, - {"version", no_argument, 0, 'v'}, - {"command", required_argument, 0, 'c'}, - {"display", required_argument, 0, 'd'}, - {"screen", required_argument, 0, 's'}, - {"file", required_argument, 0, 'f'}, - {0, 0, 0, 0} }; - -static char ratpoison_opts[] = "hvic:d:s:f:"; - -void -fatal (const char *msg) -{ - fprintf (stderr, "ratpoison: %s", msg); - abort (); -} - -void * -xmalloc (size_t size) -{ - register void *value = malloc (size); - if (value == 0) - fatal ("Virtual memory exhausted"); - return value; -} - -void * -xrealloc (void *ptr, size_t size) -{ - register void *value = realloc (ptr, size); - if (value == 0) - fatal ("Virtual memory exhausted"); - return value; -} - -char * -xstrdup (const char *s) -{ - char *value; - value = strdup (s); - if (value == 0) - fatal ("Virtual memory exhausted"); - return value; -} - -/* Return a new string based on fmt. */ -char * -xvsprintf (char *fmt, va_list ap) -{ - int size, nchars; - char *buffer; - va_list ap_copy; - - /* A resonable starting value. */ - size = strlen (fmt) + 1; - buffer = (char *)xmalloc (size); - - while (1) - { -#if defined(va_copy) - va_copy (ap_copy, ap); -#elif defined(__va_copy) - __va_copy (ap_copy, ap); -#else - /* If there is no copy macro then this MAY work. On some systems - this could fail because va_list is a pointer so assigning one - to the other as below wouldn't make a copy of the data, but - just the pointer to the data. */ - ap_copy = ap; -#endif - nchars = vsnprintf (buffer, size, fmt, ap_copy); -#if defined(va_copy) || defined(__va_copy) - va_end (ap_copy); -#endif - - if (nchars > -1 && nchars < size) - return buffer; - else if (nchars > -1) - size = nchars + 1; - /* c99 says -1 is an error other than truncation, - * which thus will not go away with a larger buffer. - * To support older system but not making errors fatal - * (ratpoison will abort when trying to get too much memory otherwise), - * try to increase a bit but not too much: */ - else if (size < MAX_LEGACY_SNPRINTF_SIZE) - size *= 2; - else - { - free(buffer); - break; - } - - /* Resize the buffer and try again. */ - buffer = (char *)xrealloc (buffer, size); - } - - return xstrdup("<FAILURE>"); -} - -/* Return a new string based on fmt. */ -char * -xsprintf (char *fmt, ...) -{ - char *buffer; - va_list ap; - - va_start (ap, fmt); - buffer = xvsprintf (fmt, ap); - va_end (ap); - - return buffer; -} - -/* strtok but do it for whitespace and be locale compliant. */ -char * -strtok_ws (char *s) -{ - char *nonws; - static char *last = NULL; - - if (s == NULL) - last = s; - else if (last == NULL) - { - PRINT_ERROR (("strtok_ws() called but not initalized, this is a *BUG*\n")); - abort(); - } - - /* skip to first non-whitespace char. */ - while (*last && isspace (*last)) last++; - - /* If we reached the end of the string here then there is no more - data. */ - if (*last == '\0') - return NULL; - - /* Now skip to the end of the data. */ - nonws = last; - while (*last && !isspace (*last)) last++; - if (*last) - { - *last = '\0'; - last++; - } - return nonws; -} - -/* A case insensitive strncmp. */ -int -str_comp (char *s1, char *s2, int len) -{ - int i; - - for (i=0; i<len; i++) - if (toupper (s1[i]) != toupper (s2[i])) return 0; - - return 1; -} - -static void -sighandler (int signum UNUSED) -{ - kill_signalled++; -} - -static void -hup_handler (int signum UNUSED) -{ - hup_signalled++; -} - -static void -alrm_handler (int signum UNUSED) -{ - alarm_signalled++; -} - -/* Check for child processes that have quit but haven't been - acknowledged yet. Update their structure. */ -void -check_child_procs (void) -{ - rp_child_info *cur; - int pid, status; - while (1) - { - pid = waitpid (WAIT_ANY, &status, WNOHANG); - if (pid <= 0) - break; - - PRINT_DEBUG(("Child status: %d\n", WEXITSTATUS (status))); - - /* Find the child and update its structure. */ - list_for_each_entry (cur, &rp_children, node) - { - if (cur->pid == pid) - { - cur->terminated = 1; - cur->status = WEXITSTATUS (status); - break; - } - } - - chld_signalled = 1; - } -} - -void -chld_handler (int signum UNUSED) -{ - int serrno; - - serrno = errno; - check_child_procs(); - errno = serrno; -} - -static int -handler (Display *d, XErrorEvent *e) -{ - char error_msg[100]; - - if (e->request_code == X_ChangeWindowAttributes && e->error_code == BadAccess) - { - fprintf(stderr, "ratpoison: There can be only ONE.\n"); - exit(EXIT_FAILURE); - } - -#ifdef IGNORE_BADWINDOW - return 0; -#else - if (ignore_badwindow && e->error_code == BadWindow) return 0; -#endif - - XGetErrorText (d, e->error_code, error_msg, sizeof (error_msg)); - fprintf (stderr, "ratpoison: ERROR: %s!\n", error_msg); - - /* If there is already an error to report, replace it with this new - one. */ - if (rp_error_msg) - free (rp_error_msg); - rp_error_msg = xstrdup (error_msg); - - return 0; -} - -void -set_sig_handler (int sig, void (*action)(int)) -{ - /* use sigaction because SVR4 systems do not replace the signal - handler by default which is a tip of the hat to some god-aweful - ancient code. So use the POSIX sigaction call instead. */ - struct sigaction act; - - /* check setting for sig */ - if (sigaction (sig, NULL, &act)) - { - PRINT_ERROR (("Error %d fetching SIGALRM handler\n", errno )); - } - else - { - /* if the existing action is to ignore then leave it intact - otherwise add our handler */ - if (act.sa_handler != SIG_IGN) - { - act.sa_handler = action; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - if (sigaction (sig, &act, NULL)) - { - PRINT_ERROR (("Error %d setting SIGALRM handler\n", errno )); - } - } - } -} - -static void -print_version (void) -{ - printf ("%s %s (built %s %s)\n", PACKAGE, VERSION, __DATE__, __TIME__); - printf ("Copyright (C) 2000-2008 Shawn Betts\n\n"); - - exit (EXIT_SUCCESS); -} - -static void -print_help (void) -{ - printf ("Help for %s %s\n\n", PACKAGE, VERSION); - printf ("-h, --help Display this help screen\n"); - printf ("-v, --version Display the version\n"); - printf ("-d, --display <dpy> Set the X display to use\n"); - printf ("-s, --screen <num> Only use the specified screen\n"); - printf ("-c, --command <cmd> Send ratpoison a colon-command\n"); - printf ("-i, --interactive Execute commands in interactive mode\n"); - printf ("-f, --file <file> Specify an alternative configuration file\n\n"); - - printf ("Report bugs to ratpoison-devel@nongnu.org\n\n"); - - exit (EXIT_SUCCESS); -} - -void -set_close_on_exec (FILE *fd) -{ - int fnum = fileno (fd); - int flags = fcntl (fnum, F_GETFD); - if (flags >= 0) - fcntl (fnum, F_SETFD, flags | FD_CLOEXEC); -} - -void -read_rc_file (FILE *file) -{ - char *line; - size_t linesize = 256; - - line = xmalloc (linesize); - - while (getline (&line, &linesize, file) != -1) - { - line[strcspn (line, "\n")] = '\0'; - - PRINT_DEBUG (("rcfile line: %s\n", line)); - - if (*line != '\0' && *line != '#') - { - cmdret *result; - result = command (0, line); - - /* Gobble the result. */ - if (result) - cmdret_free (result); - } - } - - free (line); -} - -static void -read_startup_files (char *alt_rcfile) -{ - char *homedir; - FILE *fileptr = NULL; - - if (alt_rcfile) - { - if ((fileptr = fopen (alt_rcfile, "r")) == NULL) - { - /* we probably don't need to report this, its not an error */ - PRINT_DEBUG (("ratpoison: could not open %s\n", alt_rcfile)); - } - } - else - { - /* first check $HOME/.ratpoisonrc and if that does not exist then try - /etc/ratpoisonrc */ - - homedir = getenv ("HOME"); - if (!homedir) - { - PRINT_ERROR (("ratpoison: $HOME not set!?\n")); - } - else - { - char *filename; - filename = xsprintf ("%s/.ratpoisonrc", homedir); - - if ((fileptr = fopen (filename, "r")) == NULL) - { - /* we probably don't need to report this, its not an error */ - PRINT_DEBUG (("ratpoison: could not open %s\n", filename)); - - if ((fileptr = fopen ("/etc/ratpoisonrc", "r")) == NULL) - { - /* neither is this */ - PRINT_DEBUG (("ratpoison: could not open /etc/ratpoisonrc\n")); - } - } - free (filename); - } - } - - if (fileptr) - { - set_close_on_exec(fileptr); - read_rc_file (fileptr); - fclose (fileptr); - } -} - -/* Odd that we spend so much code on making sure the silly welcome - message is correct. Oh well... */ -static void -show_welcome_message (void) -{ - rp_action *help_action; - char *prefix, *help; - rp_keymap *map; - - prefix = keysym_to_string (prefix_key.sym, prefix_key.state); - - map = find_keymap (ROOT_KEYMAP); - - /* Find the help key binding. */ - help_action = find_keybinding_by_action ("help " ROOT_KEYMAP, map); - if (help_action) - help = keysym_to_string (help_action->key, help_action->state); - else - help = NULL; - - - if (help) - { - /* A little kludge to use ? instead of `question' for the help - key. */ - if (!strcmp (help, "question")) - marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, "?"); - else - marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, help); - - free (help); - } - else - { - marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, ":help"); - } - - free (prefix); -} - -static void -init_defaults (void) -{ - defaults.top_kmap = xstrdup(TOP_KEYMAP); - - defaults.win_gravity = NorthWestGravity; - defaults.trans_gravity = CenterGravity; - defaults.maxsize_gravity = CenterGravity; - - defaults.input_window_size = 200; - defaults.window_border_width = 1; - defaults.bar_x_padding = 4; - defaults.bar_y_padding = 0; - defaults.bar_location = NorthEastGravity; - defaults.bar_timeout = 5; - defaults.bar_border_width = 1; - defaults.bar_in_padding = 0; - - defaults.frame_indicator_timeout = 1; - defaults.frame_resize_unit = 10; - - defaults.padding_left = 0; - defaults.padding_right = 0; - defaults.padding_top = 0; - defaults.padding_bottom = 0; - -#ifdef USE_XFT_FONT - defaults.font_string = xstrdup (DEFAULT_XFT_FONT); -#else - /* Attempt to load a font */ - defaults.font = load_query_font_set (dpy, DEFAULT_FONT); - if (defaults.font == NULL) - { - PRINT_ERROR (("ratpoison: Cannot load font %s.\n", DEFAULT_FONT)); - defaults.font = load_query_font_set (dpy, BACKUP_FONT); - if (defaults.font == NULL) - { - PRINT_ERROR (("ratpoison: Cannot load backup font %s . You lose.\n", BACKUP_FONT)); - exit (EXIT_FAILURE); - } - } - - defaults.font_string = xstrdup (DEFAULT_FONT); - set_extents_of_fontset (defaults.font); -#endif - -#ifdef HAVE_LANGINFO_CODESET - defaults.utf8_locale = !strcmp (nl_langinfo (CODESET), "UTF-8"); -#endif - PRINT_DEBUG (("UTF-8 locale detected: %s\n", - defaults.utf8_locale ? "yes" : "no")); - - defaults.fgcolor_string = xstrdup ("black"); - defaults.bgcolor_string = xstrdup ("white"); - defaults.fwcolor_string = xstrdup ("black"); - defaults.bwcolor_string = xstrdup ("black"); - - defaults.wait_for_key_cursor = 1; - - defaults.window_fmt = xstrdup ("%n%s%t"); - defaults.info_fmt = xstrdup ("(%H, %W) %n(%t)"); - defaults.frame_fmt = xstrdup ("Current Frame"); - - defaults.win_name = WIN_NAME_TITLE; - defaults.startup_message = 1; - defaults.warp = 0; - defaults.window_list_style = STYLE_COLUMN; - - defaults.history_size = 20; - defaults.history_compaction = True; - defaults.history_expansion = False; - defaults.frame_selectors = xstrdup (""); - defaults.maxundos = 20; -} - -int -main (int argc, char *argv[]) -{ - int i; - int c; - char **cmd = NULL; - int cmd_count = 0; - int screen_arg = 0; - int screen_num = 0; - char *display = NULL; - unsigned char interactive = 0; - char *alt_rcfile = NULL; - - setlocale (LC_CTYPE, ""); - if (XSupportsLocale ()) - { - if (!XSetLocaleModifiers ("")) - PRINT_ERROR (("Couldn't set X locale modifiers.\n")); - } - else - PRINT_ERROR (("X doesn't seem to support your locale.\n")); - - /* Parse the arguments */ - myargv = argv; - while (1) - { - int option_index = 0; - - c = getopt_long (argc, argv, ratpoison_opts, ratpoison_longopts, &option_index); - if (c == -1) break; - - switch (c) - { - case 'h': - print_help (); - break; - case 'v': - print_version (); - break; - case 'c': - if (!cmd) - { - cmd = xmalloc (sizeof(char *)); - cmd_count = 0; - } - else - { - cmd = xrealloc (cmd, sizeof (char *) * (cmd_count + 1)); - } - - cmd[cmd_count] = xstrdup (optarg); - cmd_count++; - break; - case 'd': - free (display); - display = xstrdup (optarg); - break; - case 's': - screen_arg = 1; - screen_num = strtol (optarg, NULL, 10); - break; - case 'i': - interactive = 1; - break; - case 'f': - free (alt_rcfile); - alt_rcfile = xstrdup (optarg); - break; - - default: - exit (EXIT_FAILURE); - } - } - - /* Report extra unparsed arguments. */ - if (optind < argc) - { - fprintf (stderr, "Error: junk arguments: "); - while (optind < argc) - fprintf (stderr, "%s ", argv[optind++]); - fputc ('\n', stderr); - exit (EXIT_FAILURE); - } - - if (!(dpy = XOpenDisplay (display))) - { - fprintf (stderr, "Can't open display\n"); - exit (EXIT_FAILURE); - } - - /* Set ratpoison specific Atoms. */ - rp_command = XInternAtom (dpy, "RP_COMMAND", False); - rp_command_request = XInternAtom (dpy, "RP_COMMAND_REQUEST", False); - rp_command_result = XInternAtom (dpy, "RP_COMMAND_RESULT", False); - rp_selection = XInternAtom (dpy, "RP_SELECTION", False); - - /* TEXT atoms */ - xa_string = XA_STRING; - xa_compound_text = XInternAtom(dpy, "COMPOUND_TEXT", False); - xa_utf8_string = XInternAtom(dpy, "UTF8_STRING", False); - - if (cmd_count > 0) - { - int j, screen, exit_status = EXIT_SUCCESS; - - screen = screen_arg ? screen_num : -1; - - for (j = 0; j < cmd_count; j++) - { - if (!send_command (interactive, (unsigned char *)cmd[j], screen)) - exit_status = EXIT_FAILURE; - free (cmd[j]); - } - - free (cmd); - XCloseDisplay (dpy); - return exit_status; - } - - /* Set our Atoms */ - wm_name = XInternAtom(dpy, "WM_NAME", False); - wm_state = XInternAtom(dpy, "WM_STATE", False); - wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False); - wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False); - wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", False); - wm_take_focus = XInternAtom(dpy, "WM_TAKE_FOCUS", False); - wm_colormaps = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False); - - /* netwm atoms */ - _net_wm_pid = XInternAtom(dpy, "_NET_WM_PID", False); - PRINT_DEBUG (("_NET_WM_PID = %ld\n", _net_wm_pid)); - _net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False); - PRINT_DEBUG (("_NET_SUPPORTED = %ld\n", _net_supported)); - _net_wm_window_type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); - _net_wm_window_type_dialog = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); - _net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False); - - /* Setup signal handlers. */ - XSetErrorHandler(handler); - set_sig_handler (SIGALRM, alrm_handler); - set_sig_handler (SIGTERM, sighandler); - set_sig_handler (SIGINT, sighandler); - set_sig_handler (SIGHUP, hup_handler); - set_sig_handler (SIGCHLD, chld_handler); - - /* Add RATPOISON to the environment */ - putenv (xsprintf ("RATPOISON=%s", argv[0])); - - /* Setup ratpoison's internal structures */ - init_globals (); - init_defaults (); - init_groups (); - init_window_stuff (); - init_xinerama (); - init_screens (screen_arg, screen_num); - - init_frame_lists (); - update_modifier_map (); - init_user_commands(); - initialize_default_keybindings (); - history_load (); - - /* Scan for windows */ - if (screen_arg) - { - rp_current_screen = screen_num; - scanwins (&screens[0]); - } - else - { - rp_current_screen = 0; - for (i=0; i<num_screens; i++) - { - scanwins (&screens[i]); - } - } - - read_startup_files (alt_rcfile); - if (alt_rcfile) - free (alt_rcfile); - - /* Indicate to the user that ratpoison has booted. */ - if (defaults.startup_message) - show_welcome_message(); - - /* If no window has focus, give the key_window focus. */ - if (current_window() == NULL) - set_window_focus (current_screen()->key_window); - - listen_for_events (); - - return EXIT_SUCCESS; -} - -static void -free_screen (rp_screen *s) -{ - rp_frame *frame; - struct list_head *iter, *tmp; - - /* Relinquish our hold on the root window. */ - XSelectInput(dpy, RootWindow (dpy, s->screen_num), 0); - - list_for_each_safe_entry (frame, iter, tmp, &s->frames, node) - { - frame_free (s, frame); - } - - deactivate_screen(s); - - XDestroyWindow (dpy, s->bar_window); - XDestroyWindow (dpy, s->key_window); - XDestroyWindow (dpy, s->input_window); - XDestroyWindow (dpy, s->frame_window); - XDestroyWindow (dpy, s->help_window); - -#ifdef USE_XFT_FONT - if (s->xft_font) - { - XftColorFree (dpy, DefaultVisual (dpy, s->screen_num), - DefaultColormap (dpy, s->screen_num), &s->xft_fg_color); - XftColorFree (dpy, DefaultVisual (dpy, s->screen_num), - DefaultColormap (dpy, s->screen_num), &s->xft_bg_color); - XftFontClose (dpy, s->xft_font); - } -#endif - - XFreeCursor (dpy, s->rat); - XFreeColormap (dpy, s->def_cmap); - XFreeGC (dpy, s->normal_gc); - XFreeGC (dpy, s->inverse_gc); - - free (s->display_string); -} - -void -clean_up (void) -{ - int i; - - history_save (); - - free_keymaps (); - free_aliases (); - free_user_commands (); - free_bar (); - free_window_stuff (); - free_groups (); - - for (i=0; i<num_screens; i++) - { - free_screen (&screens[i]); - } - free (screens); - - /* Delete the undo histories */ - while (list_size (&rp_frame_undos) > 0) - { - /* Delete the oldest node */ - rp_frame_undo *cur; - list_last (cur, &rp_frame_undos, node); - del_frame_undo (cur); - } - - /* Free the global frame numset shared by all screens. */ - numset_free (rp_frame_numset); - - free_xinerama(); - -#ifndef USE_XFT_FONT - XFreeFontSet (dpy, defaults.font); -#endif - free (defaults.window_fmt); - - XSetInputFocus (dpy, PointerRoot, RevertToPointerRoot, CurrentTime); - XCloseDisplay (dpy); -} - -void -set_extents_of_fontset (XFontSet font) -{ - XFontSetExtents *extent; - extent = XExtentsOfFontSet(font); - rp_font_ascent = extent->max_logical_extent.height * 9 / 10; - rp_font_descent = extent->max_logical_extent.height / 5; - rp_font_width = extent->max_logical_extent.width; -} - -XFontSet load_query_font_set (Display *disp, const char *fontset_name) -{ - XFontSet fontset; - int missing_charset_count; - char **missing_charset_list; - char *def_string; - - fontset = XCreateFontSet(disp, fontset_name, - &missing_charset_list, &missing_charset_count, - &def_string); - if (missing_charset_count) { - PRINT_DEBUG (("Missing charsets in FontSet(%s) creation.\n", fontset_name)); - XFreeStringList(missing_charset_list); - } - return fontset; -} diff --git a/src/manage.c b/src/manage.c deleted file mode 100644 index f404c13..0000000 --- a/src/manage.c +++ /dev/null @@ -1,1001 +0,0 @@ -/* Manage windows, such as Mapping them and making sure the proper key - * Grabs have been put in place. - * - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> -#include <X11/keysymdef.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "ratpoison.h" - -static char **unmanaged_window_list = NULL; -static int num_unmanaged_windows = 0; - -void -clear_unmanaged_list (void) -{ - if (unmanaged_window_list) - { - int i; - - for (i = 0; i < num_unmanaged_windows; i++) - free(unmanaged_window_list[i]); - - free(unmanaged_window_list); - - unmanaged_window_list = NULL; - } - num_unmanaged_windows = 0; -} - -char * -list_unmanaged_windows (void) -{ - char *tmp = NULL; - if (unmanaged_window_list) - { - char *tpos; - int len = 0; - int i; - - for (i = 0; i < num_unmanaged_windows; i++) - len += (strlen(unmanaged_window_list[i]) + 1); - - tmp = xmalloc(len + 1); - tpos = tmp; - - for (i = 0; i < num_unmanaged_windows; i++) - { - sprintf(tpos, "%s\n", unmanaged_window_list[i]); - tpos += strlen(unmanaged_window_list[i])+1; - } - tpos--; - *tpos = '\0'; - } - return tmp; -} - -void -add_unmanaged_window (char *name) -{ - char **tmp; - - if (!name) return; - - tmp = xmalloc((num_unmanaged_windows + 1) * sizeof(char *)); - - if (unmanaged_window_list) - { - memcpy(tmp, unmanaged_window_list, num_unmanaged_windows * sizeof(char *)); - free(unmanaged_window_list); - } - - tmp[num_unmanaged_windows] = xstrdup(name); - num_unmanaged_windows++; - - unmanaged_window_list = tmp; -} - -extern Atom wm_state; - -void -grab_top_level_keys (Window w) -{ -#ifdef HIDE_MOUSE - XGrabKey(dpy, AnyKey, AnyModifier, w, True, - GrabModeAsync, GrabModeAsync); -#else - rp_keymap *map = find_keymap (defaults.top_kmap); - int i; - - if (map == NULL) - { - PRINT_ERROR (("Unable to find %s level keymap\n", defaults.top_kmap)); - return; - } - - PRINT_DEBUG(("grabbing top level key\n")); - for (i=0; i<map->actions_last; i++) - { - PRINT_DEBUG(("%d\n", i)); - grab_key (map->actions[i].key, map->actions[i].state, w); - } -#endif -} - -void -ungrab_top_level_keys (Window w) -{ - XUngrabKey(dpy, AnyKey, AnyModifier, w); -} - -void -ungrab_keys_all_wins (void) -{ - rp_window *cur; - - /* Remove the grab on the current prefix key */ - list_for_each_entry (cur, &rp_mapped_window, node) - { - ungrab_top_level_keys (cur->w); - } -} - -void -grab_keys_all_wins (void) -{ - rp_window *cur; - - /* Remove the grab on the current prefix key */ - list_for_each_entry (cur, &rp_mapped_window, node) - { - grab_top_level_keys (cur->w); - } -} - -rp_screen* -current_screen (void) -{ - int i; - - for (i=0; i<num_screens; i++) - { - if (screens[i].xine_screen_num == rp_current_screen) - return &screens[i]; - } - - /* This should never happen. */ - return &screens[0]; -} - -void -update_normal_hints (rp_window *win) -{ - long supplied; - - XGetWMNormalHints (dpy, win->w, win->hints, &supplied); - - /* Print debugging output for window hints. */ -#ifdef DEBUG - if (win->hints->flags & PMinSize) - PRINT_DEBUG (("minx: %d miny: %d\n", win->hints->min_width, win->hints->min_height)); - - if (win->hints->flags & PMaxSize) - PRINT_DEBUG (("maxx: %d maxy: %d\n", win->hints->max_width, win->hints->max_height)); - - if (win->hints->flags & PResizeInc) - PRINT_DEBUG (("incx: %d incy: %d\n", win->hints->width_inc, win->hints->height_inc)); - -#endif -} - - -static char * -get_wmname (Window w) -{ - char *name = NULL; - XTextProperty text_prop; - int ret = None, n; - char** cl; - - /* If current encoding is UTF-8, try to use the window's _NET_WM_NAME ewmh - property */ - if (defaults.utf8_locale) - { - Atom type = None; - unsigned long nitems, bytes_after; - int format; - char *val = NULL; - - ret = XGetWindowProperty (dpy, w, _net_wm_name, 0, 40, False, - xa_utf8_string, &type, &format, &nitems, - &bytes_after, (unsigned char **) &val); - /* We have a valid UTF-8 string */ - if (ret == Success && type == xa_utf8_string - && format == 8 && nitems > 0) - { - name = xstrdup (val); - XFree (val); - PRINT_DEBUG (("Fetching window name using _NET_WM_NAME succeeded\n")); - PRINT_DEBUG (("WM_NAME: %s\n", name)); - return name; - } - /* Something went wrong for whatever reason */ - if (ret == Success && val) - XFree (val); - PRINT_DEBUG (("Could not fetch window name using _NET_WM_NAME\n")); - } - - if (XGetWMName (dpy, w, &text_prop) == 0) - { - PRINT_DEBUG (("XGetWMName failed\n")); - return NULL; - } - - PRINT_DEBUG (("WM_NAME encoding: ")); - if (text_prop.encoding == xa_string) - PRINT_DEBUG (("STRING\n")); - else if (text_prop.encoding == xa_compound_text) - PRINT_DEBUG (("COMPOUND_TEXT\n")); - else if (text_prop.encoding == xa_utf8_string) - PRINT_DEBUG (("UTF8_STRING\n")); - else - PRINT_DEBUG (("unknown (%d)\n", (int) text_prop.encoding)); - -#ifdef X_HAVE_UTF8_STRING - /* It seems that most applications supporting UTF8_STRING and - _NET_WM_NAME don't bother making their WM_NAME available as - UTF8_STRING (but only as either STRING or COMPOUND_TEXT). - Let's try anyway. */ - if (defaults.utf8_locale && text_prop.encoding == xa_utf8_string) - { - ret = Xutf8TextPropertyToTextList (dpy, &text_prop, &cl, &n); - PRINT_DEBUG (("Xutf8TextPropertyToTextList: %s\n", - ret == Success ? "success" : "error")); - } - else -#endif - { - /* XmbTextPropertyToTextList should be fine for all cases, - even UTF8_STRING encoded WM_NAME */ - ret = XmbTextPropertyToTextList (dpy, &text_prop, &cl, &n); - PRINT_DEBUG (("XmbTextPropertyToTextList: %s\n", - ret == Success ? "success" : "error")); - } - - if (ret == Success && cl && n > 0) - { - name = xstrdup (cl[0]); - XFreeStringList (cl); - } - else if (text_prop.value) - { - /* Convertion failed, try to get the raw string */ - name = xstrdup ((char *) text_prop.value); - XFree (text_prop.value); - } - - if (name == NULL) { - PRINT_DEBUG (("I can't get the WMName.\n")); - } else { - PRINT_DEBUG (("WM_NAME: '%s'\n", name)); - } - - return name; -} - -static XClassHint * -get_class_hints (Window w) -{ - XClassHint *class; - - class = XAllocClassHint(); - - if (class == NULL) - { - PRINT_ERROR (("Not enough memory for WM_CLASS structure.\n")); - exit (EXIT_FAILURE); - } - - XGetClassHint (dpy, w, class); - - return class; -} - -/* Reget the WM_NAME property for the window and update its - name. Return 1 if the name changed. */ -int -update_window_name (rp_window *win) -{ - char *newstr; - int changed = 0; - XClassHint *class; - - newstr = get_wmname (win->w); - if (newstr != NULL) - { - changed = changed || win->wm_name == NULL || strcmp (newstr, win->wm_name); - free (win->wm_name); - win->wm_name = newstr; - } - - class = get_class_hints (win->w); - - if (class->res_class != NULL - && (win->res_class == NULL || strcmp (class->res_class, win->res_class))) - { - changed = 1; - free (win->res_class); - win->res_class = xstrdup(class->res_class); - } - - if (class->res_name != NULL - && (win->res_name == NULL || strcmp (class->res_name, win->res_name))) - { - changed = 1; - free (win->res_name); - win->res_name = xstrdup(class->res_name); - } - - XFree (class->res_name); - XFree (class->res_class); - XFree (class); - return changed; -} - -/* Send an artificial configure event to the window. */ -void -send_configure (Window w, int x, int y, int width, int height, int border) -{ - XConfigureEvent ce; - - ce.type = ConfigureNotify; - ce.event = w; - ce.window = w; - ce.x = x; - ce.y = y; - ce.width = width; - ce.height = height; - ce.border_width = border; - ce.above = None; - ce.override_redirect = 0; - - XSendEvent (dpy, w, False, StructureNotifyMask, (XEvent*)&ce); -} - -/* This function is used to determine if the window should be treated - as a transient. */ -int -window_is_transient (rp_window *win) -{ - return win->transient -#ifdef ASPECT_WINDOWS_ARE_TRANSIENTS - || win->hints->flags & PAspect -#endif -#ifdef MAXSIZE_WINDOWS_ARE_TRANSIENTS -|| (win->hints->flags & PMaxSize - && (win->hints->max_width < win->scr->width - || win->hints->max_height < win->scr->height)) -#endif - ; -} - -static Atom -get_net_wm_window_type (rp_window *win) -{ - Atom type, window_type = None; - int format; - unsigned long nitems; - unsigned long bytes_left; - unsigned char *data; - - if (win == NULL) - return None; - - if (XGetWindowProperty (dpy, win->w, _net_wm_window_type, 0, 1L, - False, XA_ATOM, &type, &format, - &nitems, &bytes_left, - &data) == Success && nitems > 0) - { - window_type = *(Atom *)data; - XFree (data); - PRINT_DEBUG(("hey ya %ld %ld\n", window_type, _net_wm_window_type_dialog)); - } - - return window_type; -} - - -void -update_window_information (rp_window *win) -{ - XWindowAttributes attr; - - update_window_name (win); - - /* Get the WM Hints */ - update_normal_hints (win); - - /* Get the colormap */ - XGetWindowAttributes (dpy, win->w, &attr); - win->colormap = attr.colormap; - win->x = attr.x; - win->y = attr.y; - win->width = attr.width; - win->height = attr.height; - win->border = attr.border_width; - - /* Transient status */ - win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for); - - if (get_net_wm_window_type(win) == _net_wm_window_type_dialog) - win->transient = 1; - - update_window_gravity (win); -} - -void -unmanage (rp_window *w) -{ - list_del (&w->node); - groups_del_window (w); - - free_window (w); - -#ifdef AUTO_CLOSE - if (rp_mapped_window.next == &rp_mapped_window - && rp_mapped_window.prev == &rp_mapped_window) - { - /* If the mapped window list is empty then we have run out of - managed windows, so kill ratpoison. */ - - /* FIXME: The unmapped window list may also have to be checked - in the case that the only mapped window in unmapped and - shortly after another window is mapped most likely by the - same app. */ - - kill_signalled = 1; - } -#endif -} - -/* When starting up scan existing windows and start managing them. */ -void -scanwins(rp_screen *s) -{ - rp_window *win; - XWindowAttributes attr; - unsigned int i, nwins; - Window dw1, dw2, *wins; - - XQueryTree(dpy, s->root, &dw1, &dw2, &wins, &nwins); - PRINT_DEBUG (("windows: %d\n", nwins)); - - for (i = 0; i < nwins; i++) - { - XGetWindowAttributes(dpy, wins[i], &attr); - if (is_rp_window_for_screen(wins[i], s) - || attr.override_redirect == True - || unmanaged_window (wins[i])) continue; - - /* FIXME - with this code, windows which are entirely off-screen - * when RP starts won't ever be managed when Xinerama is enabled. - */ - { - XWindowAttributes root_attr; - - XGetWindowAttributes (dpy, s->root, &root_attr); - PRINT_DEBUG (("attrs: %d %d %d %d %d %d\n", root_attr.x, root_attr.y, - s->left, s->top, s->left + s->width, s->top + s->height));} - - if (rp_have_xinerama - && ((attr.x > s->left + s->width) - || (attr.x < s->left) - || (attr.y > s->top + s->height) - || (attr.y < s->top))) continue; - - win = add_to_window_list (s, wins[i]); - - PRINT_DEBUG (("map_state: %s\n", - attr.map_state == IsViewable ? "IsViewable": - attr.map_state == IsUnviewable ? "IsUnviewable" : "IsUnmapped")); - PRINT_DEBUG (("state: %s\n", - get_state(win) == IconicState ? "Iconic": - get_state(win) == NormalState ? "Normal" : "Other")); - - /* Collect mapped and iconized windows. */ - if (attr.map_state == IsViewable - || (attr.map_state == IsUnmapped - && get_state (win) == IconicState)) - map_window (win); - } - - XFree(wins); -} - -int -unmanaged_window (Window w) -{ - char *wname; - int i; - - if (!unmanaged_window_list) return 0; - - for (i = 0; i < num_unmanaged_windows; i++) - { - wname = get_wmname(w); - if (!wname) return 0; - if (!strcmp(unmanaged_window_list[i], wname)) - { - free(wname); - return 1; - } - free(wname); - } - return 0; -} - -/* Set the state of the window. */ -void -set_state (rp_window *win, int state) -{ - long data[2]; - - win->state = state; - - data[0] = (long)win->state; - data[1] = (long)None; - - XChangeProperty (dpy, win->w, wm_state, wm_state, 32, - PropModeReplace, (unsigned char *)data, 2); -} - -/* Get the WM state of the window. */ -long -get_state (rp_window *win) -{ - long state = WithdrawnState; - Atom type; - int format; - unsigned long nitems; - unsigned long bytes_left; - unsigned char *data; - - if (win == NULL) - return state; - - if (XGetWindowProperty (dpy, win->w, wm_state, 0L, 2L, - False, wm_state, &type, &format, - &nitems, &bytes_left, - &data) == Success && nitems > 0) - { - state = *(long *)data; - XFree (data); - } - - return state; -} - -static void -move_window (rp_window *win) -{ - rp_frame *frame; - - if (win->frame_number == EMPTY) - return; - - frame = win_get_frame (win); - - /* X coord. */ - switch (win->gravity) - { - case NorthWestGravity: - case WestGravity: - case SouthWestGravity: - win->x = frame->x; - break; - case NorthGravity: - case CenterGravity: - case SouthGravity: - win->x = frame->x + (frame->width - win->border * 2) / 2 - win->width / 2; - break; - case NorthEastGravity: - case EastGravity: - case SouthEastGravity: - win->x = frame->x + frame->width - win->width - win->border; - break; - } - - /* Y coord. */ - switch (win->gravity) - { - case NorthEastGravity: - case NorthGravity: - case NorthWestGravity: - win->y = frame->y; - break; - case EastGravity: - case CenterGravity: - case WestGravity: - win->y = frame->y + (frame->height - win->border * 2) / 2 - win->height / 2; - break; - case SouthEastGravity: - case SouthGravity: - case SouthWestGravity: - win->y = frame->y + frame->height - win->height - win->border; - break; - } -} - -/* Set a transient window's x,y,width,height fields to maximize the - window. */ -static void -maximize_transient (rp_window *win) -{ - rp_frame *frame; - int maxx, maxy; - - frame = win_get_frame (win); - - /* We can't maximize a window if it has no frame. */ - if (frame == NULL) - return; - - /* Set the window's border */ - win->border = defaults.window_border_width; - - /* Always use the window's current width and height for - transients. */ - maxx = win->width; - maxy = win->height; - - /* Fit the window inside its frame (if it has one) */ - if (frame) - { - PRINT_DEBUG (("frame width=%d height=%d\n", - frame->width, frame->height)); - - if (maxx + win->border * 2 > frame->width) maxx = frame->width - win->border * 2; - if (maxy + win->border * 2 > frame->height) maxy = frame->height - win->border * 2; - } - - /* Make sure we maximize to the nearest Resize Increment specified - by the window */ - if (win->hints->flags & PResizeInc) - { - int amount; - int delta; - - /* Avoid a divide by zero if width/height_inc is 0. */ - if (win->hints->width_inc) - { - amount = maxx - win->width; - delta = amount % win->hints->width_inc; - amount -= delta; - if (amount < 0 && delta) amount -= win->hints->width_inc; - maxx = amount + win->width; - } - - if (win->hints->height_inc) - { - amount = maxy - win->height; - delta = amount % win->hints->height_inc; - amount -= delta; - if (amount < 0 && delta) amount -= win->hints->height_inc; - maxy = amount + win->height; - } - } - - PRINT_DEBUG (("maxsize: %d %d\n", maxx, maxy)); - - win->width = maxx; - win->height = maxy; -} - -/* set a good standard window's x,y,width,height fields to maximize - the window. */ -static void -maximize_normal (rp_window *win) -{ - rp_frame *frame; - int maxx, maxy; - - frame = win_get_frame (win); - - /* We can't maximize a window if it has no frame. */ - if (frame == NULL) - return; - - /* Set the window's border */ - win->border = defaults.window_border_width; - - /* Honour the window's maximum size */ - if (win->hints->flags & PMaxSize) - { - maxx = win->hints->max_width; - maxy = win->hints->max_height; - } - else - { - maxx = frame->width - win->border * 2; - maxy = frame->height - win->border * 2; - } - - /* Honour the window's aspect ratio. */ - PRINT_DEBUG (("aspect: %ld\n", win->hints->flags & PAspect)); - if (win->hints->flags & PAspect) - { - float ratio = (float)maxx / maxy; - float min_ratio = (float)win->hints->min_aspect.x / win->hints->min_aspect.y; - float max_ratio = (float)win->hints->max_aspect.x / win->hints->max_aspect.y; - PRINT_DEBUG (("ratio=%f min_ratio=%f max_ratio=%f\n", - ratio,min_ratio,max_ratio)); - if (ratio < min_ratio) - { - maxy = (int) (maxx / min_ratio); - } - else if (ratio > max_ratio) - { - maxx = (int) (maxy * max_ratio); - } - } - - /* Fit the window inside its frame (if it has one) */ - if (frame) - { - PRINT_DEBUG (("frame width=%d height=%d\n", - frame->width, frame->height)); - - if (maxx > frame->width) maxx = frame->width - win->border * 2; - if (maxy > frame->height) maxy = frame->height - win->border * 2; - } - - /* Make sure we maximize to the nearest Resize Increment specified - by the window */ - if (win->hints->flags & PResizeInc) - { - int amount; - int delta; - - if (win->hints->width_inc) - { - amount = maxx - win->width; - delta = amount % win->hints->width_inc; - if (amount < 0 && delta) amount -= win->hints->width_inc; - amount -= delta; - maxx = amount + win->width; - } - - if (win->hints->height_inc) - { - amount = maxy - win->height; - delta = amount % win->hints->height_inc; - if (amount < 0 && delta) amount -= win->hints->height_inc; - amount -= delta; - maxy = amount + win->height; - } - } - - PRINT_DEBUG (("maxsize: %d %d\n", maxx, maxy)); - - win->width = maxx; - win->height = maxy; -} - -/* Maximize the current window if data = 0, otherwise assume it is a - pointer to a window that should be maximized */ -void -maximize (rp_window *win) -{ - if (!win) win = current_window(); - if (!win) return; - - /* Handle maximizing transient windows differently. */ - if (win->transient) - maximize_transient (win); - else - maximize_normal (win); - - /* Reposition the window. */ - move_window (win); - - PRINT_DEBUG (("Resizing window '%s' to x:%d y:%d w:%d h:%d\n", window_name (win), - win->x, win->y, win->width, win->height)); - - - /* Actually do the maximizing. */ - XMoveResizeWindow (dpy, win->w, win->scr->left + win->x, win->scr->top + win->y, win->width, win->height); - XSetWindowBorderWidth (dpy, win->w, win->border); - - XSync (dpy, False); -} - -/* Maximize the current window but don't treat transient windows - differently. */ -void -force_maximize (rp_window *win) -{ - if (!win) win = current_window(); - if (!win) return; - - maximize_normal(win); - - /* Reposition the window. */ - move_window (win); - - /* This little dance is to force a maximize event. If the window is - already "maximized" X11 will optimize away the event since to - geometry changes were made. This initial resize solves the - problem. */ - if (win->hints->flags & PResizeInc) - { - XMoveResizeWindow (dpy, win->w, win->scr->left + win->x, win->scr->top + win->y, - win->width + win->hints->width_inc, - win->height + win->hints->height_inc); - } - else - { - XResizeWindow (dpy, win->w, win->width + 1, win->height + 1); - } - - XSync (dpy, False); - - /* Resize the window to its proper maximum size. */ - XMoveResizeWindow (dpy, win->w, win->scr->left + win->x, win->scr->top + win->y, win->width, win->height); - XSetWindowBorderWidth (dpy, win->w, win->border); - - XSync (dpy, False); -} - -/* map the unmapped window win */ -void -map_window (rp_window *win) -{ - PRINT_DEBUG (("Mapping the unmapped window %s\n", window_name (win))); - - /* Fill in the necessary data about the window */ - update_window_information (win); - win->number = numset_request (rp_window_numset); - grab_top_level_keys (win->w); - - /* Put win in the mapped window list */ - list_del (&win->node); - insert_into_list (win, &rp_mapped_window); - - /* Update all groups. */ - groups_map_window (win); - - /* The window has never been accessed since it was brought back from - the Withdrawn state. */ - win->last_access = 0; - - /* It is now considered iconic and set_active_window can handle the rest. */ - set_state (win, IconicState); - - /* Depending on the rudeness level, actually map the window. */ - if ((rp_honour_transient_map && win->transient) - || (rp_honour_normal_map && !win->transient)) - set_active_window (win); - else - show_rudeness_msg (win, 0); - - hook_run (&rp_new_window_hook); -} - -void -hide_window (rp_window *win) -{ - if (win == NULL) return; - - /* An unmapped window is not inside a frame. */ - win->frame_number = EMPTY; - - /* Ignore the unmap_notify event. */ - XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask)); - XUnmapWindow (dpy, win->w); - XSelectInput (dpy, win->w, WIN_EVENTS); - /* Ensure that the window doesn't have the focused border - color. This is needed by remove_frame and possibly others. */ - XSetWindowBorder (dpy, win->w, win->scr->bw_color); - set_state (win, IconicState); -} - -void -unhide_window (rp_window *win) -{ - if (win == NULL) return; - - /* Always raise the window. */ - XRaiseWindow (dpy, win->w); - - if (win->state != IconicState) return; - - XMapWindow (dpy, win->w); - set_state (win, NormalState); -} - -void -unhide_all_windows (void) -{ - struct list_head *tmp, *iter; - rp_window *win; - - list_for_each_safe_entry (win, iter, tmp, &rp_mapped_window, node) - unhide_window (win); -} - -/* same as unhide_window except that it makes sure the window is mapped - on the bottom of the window stack. */ -void -unhide_window_below (rp_window *win) -{ - if (win == NULL) return; - - /* Always lower the window, but if its not iconic we don't need to - map it since it already is mapped. */ - XLowerWindow (dpy, win->w); - - if (win->state != IconicState) return; - - XMapWindow (dpy, win->w); - set_state (win, NormalState); -} - -void -withdraw_window (rp_window *win) -{ - if (win == NULL) return; - - PRINT_DEBUG (("withdraw_window on '%s'\n", window_name (win))); - - /* Give back the window number. the window will get another one, - if it is remapped. */ - if (win->number == -1) - PRINT_ERROR(("Attempting to withdraw '%s' with number -1!\n", window_name(win))); - - numset_release (rp_window_numset, win->number); - win->number = -1; - - list_move_tail(&win->node, &rp_unmapped_window); - - /* Update the groups. */ - groups_unmap_window (win); - - ignore_badwindow++; - - XRemoveFromSaveSet (dpy, win->w); - set_state (win, WithdrawnState); - XSync (dpy, False); - - ignore_badwindow--; - - /* Call our hook */ - hook_run (&rp_delete_window_hook); -} - -/* Hide all other mapped windows except for win in win's frame. */ -void -hide_others (rp_window *win) -{ - rp_frame *frame; - rp_window *cur; - - if (win == NULL) return; - frame = find_windows_frame (win); - if (frame == NULL) return; - - list_for_each_entry (cur, &rp_mapped_window, node) - { - if (find_windows_frame (cur) - || cur->state != NormalState - || cur->frame_number != frame->number) - continue; - - hide_window (cur); - } -} diff --git a/src/manage.h b/src/manage.h deleted file mode 100644 index 6d5f1f5..0000000 --- a/src/manage.h +++ /dev/null @@ -1,60 +0,0 @@ -/* manage.h - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_MANAGE_H -#define _RATPOISON_MANAGE_H 1 - -#include "data.h" - -void clear_unmanaged_list (void); -char *list_unmanaged_windows (void); -void add_unmanaged_window (char *name); -int unmanaged_window (Window w); -rp_screen* current_screen (void); -void scanwins(rp_screen *s); -void unmanage (rp_window *w); -int update_window_name (rp_window *win); -void update_normal_hints (rp_window *win); -void rename_current_window (void); -void send_configure (Window w, int x, int y, int width, int height, int border); -void set_state (rp_window *win, int state); -long get_state (rp_window *win); - -int window_is_transient (rp_window *win); -void update_window_information (rp_window *win); -void map_window (rp_window *win); - -void maximize (rp_window *win); -void force_maximize (rp_window *win); - -void grab_top_level_keys (Window w); -void ungrab_top_level_keys (Window w); -void ungrab_keys_all_wins (void); -void grab_keys_all_wins (void); - -void hide_window (rp_window *win); -void unhide_window (rp_window *win); -void unhide_all_windows (void); -void unhide_window_below (rp_window *win); -void withdraw_window (rp_window *win); -void hide_others (rp_window *win); - -#endif /* ! _RATPOISION_MANAGE_H */ diff --git a/src/messages.h b/src/messages.h deleted file mode 100644 index 47f2563..0000000 --- a/src/messages.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Ratpoison messages. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_MESSAGES_H -#define _RATPOISON_MESSAGES_H 1 - -#include "config.h" - -#define MESSAGE_NO_OTHER_WINDOW "No other window" -#define MESSAGE_NO_OTHER_FRAME "No other frame" -#define MESSAGE_NO_MANAGED_WINDOWS "No managed windows" -#define MESSAGE_UNKNOWN_COMMAND ": unknown command '%s'" -#define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)" - -#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)" -#define MESSAGE_RAISE_WINDOW "Raise request from window %d (%s)" -#define MESSAGE_RAISE_TRANSIENT_GROUP "Raise request from transient window %d (%s) in group %s" -#define MESSAGE_RAISE_WINDOW_GROUP "Raise request from window %d (%s) in group %s" -#define MESSAGE_MAP_TRANSIENT "New transient window %d (%s)" -#define MESSAGE_MAP_WINDOW "New window %d (%s)" -#define MESSAGE_MAP_TRANSIENT_GROUP "New transient window %d (%s) in group %s" -#define MESSAGE_MAP_WINDOW_GROUP "New window %d (%s) in group %s" - -#define MESSAGE_PROMPT_SWITCH_TO_WINDOW "Switch to window: " -#define MESSAGE_PROMPT_NEW_WINDOW_NAME "Set window's title to: " -#define MESSAGE_PROMPT_SHELL_COMMAND "/bin/sh -c " -#define MESSAGE_PROMPT_COMMAND ":" -#define MESSAGE_PROMPT_SWITCH_WM "Switch to wm: " -#define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e " -#define MESSAGE_PROMPT_SWITCH_TO_GROUP "Switch to group: " -#define MESSAGE_PROMPT_SELECT_VAR "Variable: " -#define MESSAGE_PROMPT_VAR_VALUE "Value: " - -#define MESSAGE_WELCOME "Welcome to ratpoison! Hit `%s %s' for help." - -#define EMPTY_FRAME_MESSAGE "Current Frame" - -#endif /* ! _RATPOISON_MESSAGES_H */ diff --git a/src/number.c b/src/number.c deleted file mode 100644 index 332fb06..0000000 --- a/src/number.c +++ /dev/null @@ -1,149 +0,0 @@ -/* handles the handing out of and uniqueness of window numbers. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <stdlib.h> -#include <stdio.h> - -#include "ratpoison.h" - -/* Initialize a numset structure. */ -static void -numset_init (struct numset *ns) -{ - ns->max_taken = 10; - ns->num_taken = 0; - - ns->numbers_taken = xmalloc (ns->max_taken * sizeof (int)); -} - -static int -numset_num_is_taken (struct numset *ns, int n) -{ - int i; - - for (i=0; i<ns->num_taken; i++) - { - if (ns->numbers_taken[i] == n) return 1; - } - return 0; -} - -/* returns index into numbers_taken that can be used. */ -static int -numset_find_empty_cell (struct numset *ns) -{ - int i; - - for (i=0; i<ns->num_taken; i++) - { - if (ns->numbers_taken[i] == -1) return i; - } - - /* no vacant ones, so grow the array. */ - if (ns->num_taken >= ns->max_taken) - { - ns->max_taken *= 2; - ns->numbers_taken = xrealloc (ns->numbers_taken, sizeof (int) * ns->max_taken); - } - ns->num_taken++; - - return ns->num_taken-1; -} - -int -numset_add_num (struct numset *ns, int n) -{ - int ec; - - PRINT_DEBUG(("ns=%p add_num %d\n", ns, n)); - - if (numset_num_is_taken (ns, n)) - return 0; /* failed. */ - /* numset_find_empty_cell calls realloc on numbers_taken. So store - the ret val in ec then use ec as an index into the array. */ - ec = numset_find_empty_cell(ns); - ns->numbers_taken[ec] = n; - return 1; /* success! */ -} - -/* returns a unique number that can be used as the window number in - the program bar. */ -int -numset_request (struct numset *ns) -{ - int i; - - /* look for a unique number, and add it to the list of taken - numbers. */ - i = 0; - while (!numset_add_num (ns, i)) i++; - - PRINT_DEBUG(("ns=%p request got %d\n", ns, i)); - - return i; -} - -/* When a window is destroyed, it gives back its window number with - this function. */ -void -numset_release (struct numset *ns, int n) -{ - int i; - - PRINT_DEBUG(("ns=%p release %d\n", ns, n)); - - if (n < 0) - PRINT_ERROR(("ns=%p Attempt to release %d!\n", ns, n)); - - for (i=0; i<ns->num_taken; i++) - { - if (ns->numbers_taken[i] == n) - { - ns->numbers_taken[i] = -1; - return; - } - } -} - -/* Create a new numset and return a pointer to it. */ -struct numset * -numset_new (void) -{ - struct numset *ns; - - ns = (struct numset *)xmalloc (sizeof (struct numset)); - numset_init (ns); - return ns; -} - -/* Free a numset structure and it's internal data. */ -void -numset_free (struct numset *ns) -{ - free (ns->numbers_taken); - free (ns); -} - -void -numset_clear (struct numset *ns) -{ - ns->num_taken = 0; -} diff --git a/src/number.h b/src/number.h deleted file mode 100644 index d379aa2..0000000 --- a/src/number.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Function prototypes. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_NUMBER_H -#define _RATPOISON_NUMBER_H 1 - -/* Keep track of a set of numbers. For frames and windows. */ -struct numset -{ - /* A list of the numbers taken. */ - int *numbers_taken; - -/* the number of numbers currently stored in the numbers_taken - array. */ - int num_taken; - -/* the size of the numbers_taken array. */ - int max_taken; -}; - -struct numset *numset_new (void); -void numset_free (struct numset *ns); -void numset_release (struct numset *ns, int n); -int numset_request (struct numset *ns); -int numset_add_num (struct numset *ns, int n); -void numset_clear (struct numset *ns); - -#endif /* ! _RATPOISON_NUMBER_H */ diff --git a/src/ratpoison.h b/src/ratpoison.h deleted file mode 100644 index c307619..0000000 --- a/src/ratpoison.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Standard header for ratpoison. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_H -#define _RATPOISON_H 1 - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif /* HAVE_CONFIG_H */ - -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <string.h> -#include <X11/Xlib.h> -#include <X11/Xatom.h> -#include <X11/Xlocale.h> -#include <fcntl.h> - -/* Some systems don't define the close-on-exec flag in fcntl.h */ -#ifndef FD_CLOEXEC -# define FD_CLOEXEC 1 -#endif - -/* Helper macro for error and debug reporting. */ -#define PRINT_LINE(type) printf (PACKAGE ":%s:%d: %s: ",__FILE__, __LINE__, #type) - -/* Error and debug reporting macros. */ -#define PRINT_ERROR(fmt) \ -do { \ - PRINT_LINE (error); \ - printf fmt; \ - fflush (stdout); \ -} while (0) - -#ifdef DEBUG -#define PRINT_DEBUG(fmt) \ -do { \ - PRINT_LINE (debug); \ - printf fmt; \ - fflush (stdout); \ -} while (0) -#else -#define PRINT_DEBUG(fmt) do {} while (0) -#endif /* DEBUG */ - -extern XGCValues gv; - -#include "conf.h" - -#include "data.h" -#include "globals.h" -#include "manage.h" -#include "window.h" -#include "bar.h" -#include "events.h" -#include "number.h" -#include "input.h" -#include "messages.h" -#include "communications.h" -#include "sbuf.h" -#include "split.h" -#include "frame.h" -#include "screen.h" -#include "group.h" -#include "editor.h" -#include "history.h" -#include "completions.h" -#include "hook.h" -#include "xinerama.h" -#include "format.h" - -void clean_up (void); -rp_screen *find_screen (Window w); - -void set_close_on_exec (FILE *fd); -void read_rc_file (FILE *file); - -void fatal (const char *msg); -void *xmalloc (size_t size); -void *xrealloc (void *ptr, size_t size); -char *xstrdup (const char *s); -char *xsprintf (char *fmt, ...); -char *xvsprintf (char *fmt, va_list ap); -int str_comp (char *s1, char *s2, int len); -char *strtok_ws (char *s); -/* Needed in cmd_tmpwm */ -void check_child_procs (void); -void chld_handler (int signum); -void set_sig_handler (int sig, void (*action)(int)); -/* Font functions. */ -void set_extents_of_fontset (XFontSet font); -XFontSet load_query_font_set (Display *disp, const char *fontset_name); - -#endif /* ! _RATPOISON_H */ diff --git a/src/sbuf.c b/src/sbuf.c deleted file mode 100644 index 8e4556d..0000000 --- a/src/sbuf.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Functions for handling string buffers. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include <string.h> - -#include "ratpoison.h" -#include "sbuf.h" - -struct sbuf * -sbuf_new (size_t initsz) -{ - struct sbuf *b = (struct sbuf*) xmalloc (sizeof (struct sbuf)); - - if (initsz < 1) - initsz = 1; - - b->data = (char*) xmalloc (initsz); - b->maxsz = initsz; - - b->data[0] = '\0'; - b->len = 0; - - return b; -} - -void -sbuf_free (struct sbuf *b) -{ - if (b != NULL) - { - if (b->data != NULL) - free (b->data); - - free (b); - } -} - -/* Free the structure but return the string. */ -char * -sbuf_free_struct (struct sbuf *b) -{ - if (b != NULL) - { - char *tmp; - tmp = b->data; - free (b); - return tmp; - } - - return NULL; -} - -char * -sbuf_nconcat (struct sbuf *b, const char *str, int len) -{ - size_t minsz = b->len + len + 1; - - if (b->maxsz < minsz) - { - b->data = (char*) xrealloc (b->data, minsz); - b->maxsz = minsz; - } - - memcpy (b->data + b->len, str, minsz - b->len - 1); - b->len = minsz - 1; - *(b->data + b->len) = 0; - - return b->data; -} - - -char * -sbuf_concat (struct sbuf *b, const char *str) -{ - return sbuf_nconcat (b, str, strlen (str)); -} - -char * -sbuf_copy (struct sbuf *b, const char *str) -{ - b->len = 0; - return sbuf_concat (b, str); -} - -char * -sbuf_clear (struct sbuf *b) -{ - b->len = 0; - b->data[0] = '\0'; - return b->data; -} - -char * -sbuf_get (struct sbuf *b) -{ - return b->data; -} - -char * -sbuf_printf (struct sbuf *b, char *fmt, ...) -{ - va_list ap; - - free (b->data); - - va_start (ap, fmt); - b->data = xvsprintf (fmt, ap); - va_end (ap); - - return b->data; -} - -char * -sbuf_printf_concat (struct sbuf *b, char *fmt, ...) -{ - char *buffer; - va_list ap; - - va_start (ap, fmt); - buffer = xvsprintf (fmt, ap); - va_end (ap); - - sbuf_concat (b, buffer); - free (buffer); - - return b->data; -} diff --git a/src/sbuf.h b/src/sbuf.h deleted file mode 100644 index ae4ea9c..0000000 --- a/src/sbuf.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Function prototypes for handling string buffers. - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_SBUF_H -#define _RATPOISON_SBUF_H 1 - -#include <stdlib.h> - -struct -sbuf -{ - char *data; - size_t len; - size_t maxsz; - - /* sbuf can exist in a list. */ - struct list_head node; -}; - -struct sbuf *sbuf_new (size_t initsz); -void sbuf_free (struct sbuf *b); -char *sbuf_free_struct (struct sbuf *b); -char *sbuf_concat (struct sbuf *b, const char *str); -char *sbuf_nconcat (struct sbuf *b, const char *str, int len); -char *sbuf_copy (struct sbuf *b, const char *str); -char *sbuf_clear (struct sbuf *b); -char *sbuf_get (struct sbuf *b); -char *sbuf_printf (struct sbuf *b, char *fmt, ...); -char *sbuf_printf_concat (struct sbuf *b, char *fmt, ...); - -#endif /* ! _RATPOISON_SBUF_H */ diff --git a/src/screen.c b/src/screen.c deleted file mode 100644 index d843c04..0000000 --- a/src/screen.c +++ /dev/null @@ -1,497 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include "ratpoison.h" -#include <string.h> -#include <X11/cursorfont.h> - -static void init_screen (rp_screen *s, int screen_num); - -int -screen_width (rp_screen *s) -{ - return s->width - defaults.padding_right - defaults.padding_left; -} - -int -screen_height (rp_screen *s) -{ - return s->height - defaults.padding_bottom - defaults.padding_top; -} - -int -screen_left (rp_screen *s) -{ - return s->left + defaults.padding_left; -} - -int -screen_right (rp_screen *s) -{ - return screen_left (s) + screen_width (s); -} - -int -screen_top (rp_screen *s) -{ - return s->top + defaults.padding_top; -} - -int -screen_bottom (rp_screen *s) -{ - return screen_top (s) + screen_height (s); -} - -/* Returns a pointer to a list of frames. */ -struct list_head * -screen_copy_frameset (rp_screen *s) -{ - struct list_head *head; - rp_frame *cur; - - /* Init our new list. */ - head = xmalloc (sizeof (struct list_head)); - INIT_LIST_HEAD (head); - - /* Copy each frame to our new list. */ - list_for_each_entry (cur, &s->frames, node) - { - list_add_tail (&(frame_copy (cur))->node, head); - } - - return head; -} - -/* Set head as the frameset, deleting the existing one. */ -void -screen_restore_frameset (rp_screen *s, struct list_head *head) -{ - frameset_free (&s->frames); - INIT_LIST_HEAD (&s->frames); - - /* Hook in our new frameset. */ - list_splice (head, &s->frames); -} - - -/* Given a screen, free the frames' numbers from the numset. */ -void -screen_free_nums (rp_screen *s) -{ - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - numset_release (s->frames_numset, cur->number); - } -} - -/* Given a list of frames, free them, but don't remove their numbers - from the numset. */ -void -frameset_free (struct list_head *head) -{ - rp_frame *frame; - struct list_head *iter, *tmp; - - list_for_each_safe_entry (frame, iter, tmp, head, node) - { - /* FIXME: what if frames has memory inside its struct - that needs to be freed? */ - free (frame); - } -} - -rp_frame * -screen_get_frame (rp_screen *s, int frame_num) -{ - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - if (cur->number == frame_num) - return cur; - } - - return NULL; -} - -rp_frame * -screen_find_frame_by_frame (rp_screen *s, rp_frame *f) -{ - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - PRINT_DEBUG (("cur=%p f=%p\n", cur, f)); - if (cur == f) - return cur; - } - - return NULL; -} - -/* Given a root window, return the rp_screen struct */ -rp_screen * -find_screen (Window w) -{ - int i; - - for (i=0; i<num_screens; i++) - if (screens[i].root == w) return &screens[i]; - - return NULL; - } - -/* Return 1 if w is a root window of any of the screens. */ -int -is_a_root_window (unsigned int w) -{ - int i; - for (i=0; i<num_screens; i++) - if (screens[i].root == w) return 1; - - return 0; -} - -void -init_screens (int screen_arg, int screen_num) -{ - int i; - - /* Get the number of screens */ - if (rp_have_xinerama) - num_screens = xine_screen_count; - else - num_screens = ScreenCount (dpy); - - /* make sure the screen specified is valid. */ - if (screen_arg) - { - /* Using just a single Xinerama screen doesn't really make sense. So we - * disable Xinerama in this case. - */ - if (rp_have_xinerama) - { - fprintf (stderr, "Warning: selecting a specific Xinerama screen is not implemented.\n"); - rp_have_xinerama = 0; - screen_num = 0; - num_screens = ScreenCount(dpy); - } - - if (screen_num < 0 || screen_num >= num_screens) - { - fprintf (stderr, "%d is an invalid screen for the display\n", screen_num); - exit (EXIT_FAILURE); - } - - /* we're only going to use one screen. */ - num_screens = 1; - } - - /* Create our global frame numset */ - rp_frame_numset = numset_new(); - - /* Initialize the screens */ - screens = (rp_screen *)xmalloc (sizeof (rp_screen) * num_screens); - PRINT_DEBUG (("%d screens.\n", num_screens)); - - if (screen_arg) - { - init_screen (&screens[0], screen_num); - } - else - { - for (i=0; i<num_screens; i++) - { - init_screen (&screens[i], i); - } - } - -} - -static void -init_rat_cursor (rp_screen *s) -{ - s->rat = XCreateFontCursor( dpy, XC_icon ); -} - -static void -init_screen (rp_screen *s, int screen_num) -{ - XGCValues gcv; - int xine_screen_num; - char *colon; - - /* We use screen_num below to refer to the real X screen number, but - * if we're using Xinerama, it will only be the Xinerama logical screen - * number. So we shuffle it away and replace it with the real one now, - * to cause confusion. -- CP - */ - if (rp_have_xinerama) - { - xine_screen_num = screen_num; - screen_num = DefaultScreen(dpy); - xinerama_get_screen_info(xine_screen_num, - &s->left, &s->top, &s->width, &s->height); - } - else - { - xine_screen_num = screen_num; - s->left = 0; - s->top = 0; - s->width = DisplayWidth(dpy, screen_num); - s->height = DisplayHeight(dpy, screen_num); - } - - /* Select on some events on the root window, if this fails, then - there is already a WM running and the X Error handler will catch - it, terminating ratpoison. */ - XSelectInput(dpy, RootWindow (dpy, screen_num), - PropertyChangeMask | ColormapChangeMask - | SubstructureRedirectMask | SubstructureNotifyMask - | StructureNotifyMask); - XSync (dpy, False); - - /* Set the numset for the frames to our global numset. */ - s->frames_numset = rp_frame_numset; - - /* Build the display string for each screen */ - s->display_string = xmalloc (strlen(DisplayString (dpy)) + 21); - sprintf (s->display_string, "DISPLAY=%s", DisplayString (dpy)); - colon = strrchr (DisplayString (dpy), ':'); - if (colon) - { - char *dot; - - dot = strrchr(s->display_string, '.'); - if (!dot || (strlen(dot) > strlen (colon)) ) - { - /* no dot was found or it belongs to fqdn - append screen_num - to the end */ - dot = s->display_string + strlen (s->display_string); - } - sprintf(dot, ".%i", screen_num); - } - - PRINT_DEBUG (("display string: %s\n", s->display_string)); - - s->screen_num = screen_num; - s->xine_screen_num = xine_screen_num; - s->root = RootWindow (dpy, screen_num); - s->def_cmap = DefaultColormap (dpy, screen_num); - - init_rat_cursor (s); - - s->fg_color = BlackPixel (dpy, s->screen_num); - s->bg_color = WhitePixel (dpy, s->screen_num); - s->fw_color = BlackPixel (dpy, s->screen_num); - s->bw_color = BlackPixel (dpy, s->screen_num); - - /* Setup the GC for drawing the font. */ - gcv.foreground = s->fg_color; - gcv.background = s->bg_color; - gcv.function = GXcopy; - gcv.line_width = 1; - gcv.subwindow_mode = IncludeInferiors; - s->normal_gc = XCreateGC(dpy, s->root, - GCForeground | GCBackground | GCFunction - | GCLineWidth | GCSubwindowMode, - &gcv); - gcv.foreground = s->bg_color; - gcv.background = s->fg_color; - s->inverse_gc = XCreateGC(dpy, s->root, - GCForeground | GCBackground | GCFunction - | GCLineWidth | GCSubwindowMode, - &gcv); - - /* Create the program bar window. */ - s->bar_is_raised = 0; - s->bar_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, - defaults.bar_border_width, - s->fg_color, s->bg_color); - - /* Setup the window that will receive all keystrokes once the prefix - key has been pressed. */ - s->key_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, 0, - WhitePixel (dpy, s->screen_num), - BlackPixel (dpy, s->screen_num)); - XSelectInput (dpy, s->key_window, KeyPressMask | KeyReleaseMask); - - /* Create the input window. */ - s->input_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, - defaults.bar_border_width, - s->fg_color, s->bg_color); - XSelectInput (dpy, s->input_window, KeyPressMask | KeyReleaseMask); - - /* Create the frame indicator window */ - s->frame_window = XCreateSimpleWindow (dpy, s->root, 1, 1, 1, 1, defaults.bar_border_width, - s->fg_color, s->bg_color); - - /* Create the help window */ - s->help_window = XCreateSimpleWindow (dpy, s->root, s->left, s->top, s->width, - s->height, 0, s->fg_color, s->bg_color); - XSelectInput (dpy, s->help_window, KeyPressMask); - - activate_screen(s); - - XSync (dpy, 0); - -#ifdef USE_XFT_FONT - { - s->xft_font = XftFontOpenName (dpy, screen_num, DEFAULT_XFT_FONT); - if (!s->xft_font) - { - PRINT_ERROR(("Failed to open font\n")); - } - else - { - if (!XftColorAllocName (dpy, DefaultVisual (dpy, screen_num), - DefaultColormap (dpy, screen_num), - defaults.fgcolor_string, &s->xft_fg_color)) - { - PRINT_ERROR(("Failed to allocate font fg color\n")); - XftFontClose (dpy, s->xft_font); - s->xft_font = NULL; - } - if (!XftColorAllocName (dpy, DefaultVisual (dpy, screen_num), - DefaultColormap (dpy, screen_num), - defaults.bgcolor_string, &s->xft_bg_color)) - { - PRINT_ERROR(("Failed to allocate font fg color\n")); - XftFontClose (dpy, s->xft_font); - s->xft_font = NULL; - } - } - } -#endif -} - -void -activate_screen (rp_screen *s) -{ - /* Add netwm support. FIXME: I think this is busted. */ - XChangeProperty (dpy, RootWindow (dpy, s->screen_num), - _net_supported, XA_ATOM, 32, PropModeReplace, - (unsigned char*)&_net_wm_pid, 1); - - /* set window manager name */ - XChangeProperty (dpy, RootWindow (dpy, s->screen_num), - _net_wm_name, xa_utf8_string, 8, PropModeReplace, - (unsigned char*)"ratpoison", 9); - XMapWindow (dpy, s->key_window); -} - -void -deactivate_screen (rp_screen *s) -{ - /* Unmap its key window */ - XUnmapWindow (dpy, s->key_window); - - /* delete everything so noone sees them while we are not there */ - XDeleteProperty (dpy, RootWindow (dpy, s->screen_num), - _net_supported); - XDeleteProperty (dpy, RootWindow (dpy, s->screen_num), - _net_wm_name); -} - -static int -is_rp_window_for_given_screen (Window w, rp_screen *s) -{ - if (w != s->key_window && - w != s->bar_window && - w != s->input_window && - w != s->frame_window && - w != s->help_window) - return 0; - return 1; -} - -int -is_rp_window_for_screen(Window w, rp_screen *s) -{ - int i; - - if (rp_have_xinerama) - { - for (i=0; i<num_screens; i++) - if (is_rp_window_for_given_screen(w, &screens[i])) return 1; - return 0; - } - else - { - return is_rp_window_for_given_screen(w, s); - } -} - -char * -screen_dump (rp_screen *screen) -{ - char *tmp; - struct sbuf *s; - - s = sbuf_new (0); - sbuf_printf (s, "%d %d %d %d %d %d", - (rp_have_xinerama)?screen->xine_screen_num:screen->screen_num, - screen->left, - screen->top, - screen->width, - screen->height, - (current_screen() == screen)?1:0 /* is current? */ - ); - - /* Extract the string and return it, and don't forget to free s. */ - tmp = sbuf_get (s); - free (s); - return tmp; -} - -void -screen_update (rp_screen *s, int width, int height) -{ - rp_frame *f; - int oldwidth,oldheight; - - PRINT_DEBUG (("screen_update(%d,%d)\n", width, height)); - if (rp_have_xinerama) - { - /* TODO: how to do this with xinerama? */ - return; - } - - if (s->width == width && s->height == height) - /* nothing to do */ - return; - - oldwidth = s->width; oldheight = s->height; - s->width = width; s->height = height; - - XResizeWindow (dpy, s->help_window, width, height); - - list_for_each_entry (f, &s->frames, node) - { - f->x = (f->x*width)/oldwidth; - f->width = (f->width*width)/oldwidth; - f->y = (f->y*height)/oldheight; - f->height = (f->height*height)/oldheight; - maximize_all_windows_in_frame (f); - } -} diff --git a/src/screen.h b/src/screen.h deleted file mode 100644 index 6bad555..0000000 --- a/src/screen.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef SCREEN_H -#define SCREEN_H - -int screen_bottom (rp_screen *s); -int screen_top (rp_screen *s); -int screen_right (rp_screen *s); -int screen_left (rp_screen *s); -int screen_height (rp_screen *s); -int screen_width (rp_screen *s); - -struct list_head *screen_copy_frameset (rp_screen *s); -void screen_restore_frameset (rp_screen *s, struct list_head *head); -void screen_free_nums (rp_screen *s); -void frameset_free (struct list_head *head); -rp_frame *screen_get_frame (rp_screen *s, int frame_num); -rp_frame *screen_find_frame_by_frame (rp_screen *s, rp_frame *f); - -void init_screens (int screen_arg, int screen_num); -void activate_screen (rp_screen *s); -void deactivate_screen (rp_screen *s); - -int is_rp_window_for_screen (Window w, rp_screen *s); -int is_a_root_window (unsigned int w); - -char *screen_dump (rp_screen *screen); - -void screen_update (rp_screen *s, int width, int height); -#endif diff --git a/src/split.c b/src/split.c deleted file mode 100644 index b36b99e..0000000 --- a/src/split.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - * - * - * Functions for handling window splitting and tiling. - */ - -#include <unistd.h> -#include <string.h> - -#include "ratpoison.h" - -#define VERTICALLY 0 -#define HORIZONTALLY 1 - -static void -update_last_access (rp_frame *frame) -{ - static int counter = 0; - - frame->last_access = counter; - counter++; -} - -rp_frame * -current_frame (void) -{ - rp_screen *s = current_screen(); - return screen_get_frame (s, s->current_frame); -} - -int -num_frames (rp_screen *s) -{ - int count = 0; - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - count++; - } - - return count; -} - -void -cleanup_frame (rp_frame *frame) -{ - rp_window *win; - rp_screen *screen; - screen = frames_screen(frame); - - win = find_window_other (screen); - if (win == NULL) - { - set_frames_window (frame, NULL); - return; - } - - set_frames_window (frame, win); - - maximize (win); - unhide_window (win); - - - if (!window_is_transient (win)) - hide_others (win); -} - -rp_window * -set_frames_window (rp_frame *frame, rp_window *win) -{ - int last_win; - - last_win = frame->win_number; - if (win) - { - frame->win_number = win->number; - win->frame_number = frame->number; - - /* We need to make sure that win and frame are on the same screen, - * since with Xinerama, windows can move from one screen to another. - */ - win->scr = frames_screen(frame); - } - else - { - frame->win_number = EMPTY; - } - - return find_window_number (last_win); -} - -rp_screen * -frames_screen (rp_frame *frame) -{ - int i; - rp_frame *cur; - - for (i=0; i<num_screens; i++) - list_for_each_entry (cur, &screens[i].frames, node) - { - if (frame == cur) - return &screens[i]; - } - - /* This SHOULD be impossible to get to. FIXME: It'll crash higher up if we - return NULL. */ - return NULL; -} - -void -maximize_all_windows_in_frame (rp_frame *frame) -{ - rp_window *win; - - list_for_each_entry (win, &rp_mapped_window, node) - { - if (win->frame_number == frame->number) - { - maximize (win); - } - } -} - -/* Make the frame occupy the entire screen */ -static void -maximize_frame (rp_frame *frame) -{ - rp_screen *s = frames_screen (frame); - - frame->x = defaults.padding_left; - frame->y = defaults.padding_top; - - frame->width = screen_width (s); - frame->height = screen_height (s); -} - -/* Create a full screen frame */ -static void -create_initial_frame (rp_screen *screen) -{ - rp_frame *frame; - - frame = frame_new (screen); - screen->current_frame = frame->number; - list_add_tail (&frame->node, &screen->frames); - - update_last_access (frame); - - maximize_frame (frame); - set_frames_window (frame, NULL); -} - -void -init_frame_lists (void) -{ - int i; - - for (i=0; i<num_screens; i++) - init_frame_list (&screens[i]); -} - -void -init_frame_list (rp_screen *screen) -{ - INIT_LIST_HEAD (&screen->frames); - - create_initial_frame(screen); -} - -rp_frame * -find_last_frame (void) -{ - rp_frame *cur, *last = NULL; - int last_access = -1; - int i; - - for (i=0; i<num_screens; i++) - { - rp_screen *s = &screens[i]; - - list_for_each_entry (cur, &s->frames, node) - { - if (cur->number != current_screen()->current_frame - && cur->last_access > last_access) - { - last_access = cur->last_access; - last = cur; - } - } - } - - return last; -} - -/* Return the frame that contains the window. */ -rp_frame * -find_windows_frame (rp_window *win) -{ - rp_screen *s; - rp_frame *cur; - - s = win->scr; - - list_for_each_entry (cur, &s->frames, node) - { - if (cur->win_number == win->number) return cur; - } - - return NULL; -} - -rp_frame * -find_frame_next (rp_frame *frame) -{ - if (frame == NULL) return NULL; - return list_next_entry (frame, &frames_screen (frame)->frames, node); -} - -rp_frame * -find_frame_prev (rp_frame *frame) -{ - if (frame == NULL) return NULL; - return list_prev_entry (frame, &frames_screen (frame)->frames, node); -} - -rp_window * -current_window (void) -{ - return find_window_number (current_frame()->win_number); -} - -static int -window_fits_in_frame (rp_window *win, rp_frame *frame) -{ - /* If the window has minimum size hints, make sure they are smaller - than the frame. */ - if (win->hints->flags & PMinSize) - { - if (win->hints->min_width > frame->width - || - win->hints->min_height > frame->height) - { - return 0; - } - } - - return 1; -} - -/* Search the list of mapped windows for a window that will fit in the - specified frame. */ -rp_window * -find_window_for_frame (rp_frame *frame) -{ - rp_screen *s = frames_screen (frame); - int last_access = 0; - rp_window_elem *most_recent = NULL; - rp_window_elem *cur; - - list_for_each_entry (cur, &rp_current_group->mapped_windows, node) - { - if ((cur->win->scr == s || rp_have_xinerama) - && cur->win != current_window() - && !find_windows_frame (cur->win) - && cur->win->last_access >= last_access - && window_fits_in_frame (cur->win, frame) - && cur->win->frame_number == EMPTY) - { - most_recent = cur; - last_access = cur->win->last_access; - } - } - - if (most_recent) - return most_recent->win; - - return NULL; -} - -/* Splits the frame in 2. if way is 0 then split vertically otherwise - split it horizontally. */ -static void -split_frame (rp_frame *frame, int way, int pixels) -{ - rp_screen *s; - rp_window *win; - rp_frame *new_frame; - - s = frames_screen (frame); - - /* Make our new frame. */ - new_frame = frame_new (s); - - /* Add the frame to the frameset. */ - list_add (&new_frame->node, ¤t_frame()->node); - - set_frames_window (new_frame, NULL); - - if (way == HORIZONTALLY) - { - new_frame->x = frame->x; - new_frame->y = frame->y + pixels; - new_frame->width = frame->width; - new_frame->height = frame->height - pixels; - - frame->height = pixels; - } - else - { - new_frame->x = frame->x + pixels; - new_frame->y = frame->y; - new_frame->width = frame->width - pixels; - new_frame->height = frame->height; - - frame->width = pixels; - } - - win = find_window_for_frame (new_frame); - if (win) - { - PRINT_DEBUG (("Found a window for the frame!\n")); - - set_frames_window (new_frame, win); - - maximize (win); - unhide_window (win); - XRaiseWindow (dpy, win->w); - } - else - { - PRINT_DEBUG (("No window fits the frame.\n")); - - set_frames_window (new_frame, NULL); - } - - /* resize the existing frame */ - if (frame->win_number != EMPTY) - { - maximize_all_windows_in_frame (frame); - XRaiseWindow (dpy, find_window_number (frame->win_number)->w); - } - - update_bar (s); - show_frame_indicator(0); -} - -/* Splits the window vertically leaving the original with 'pixels' - pixels . */ -void -v_split_frame (rp_frame *frame, int pixels) -{ - split_frame (frame, VERTICALLY, pixels); -} - -/* Splits the frame horizontally leaving the original with 'pixels' - pixels . */ -void -h_split_frame (rp_frame *frame, int pixels) -{ - split_frame (frame, HORIZONTALLY, pixels); -} - -void -remove_all_splits (void) -{ - struct list_head *tmp, *iter; - rp_screen *s = current_screen(); - rp_frame *frame; - rp_window *win; - - /* Hide all the windows not in the current frame. */ - list_for_each_entry (win, &rp_mapped_window, node) - { - if (win->frame_number != s->current_frame && win->scr == s) - hide_window (win); - } - - /* Delete all the frames except the current one. */ - list_for_each_safe_entry (frame, iter, tmp, &s->frames, node) - { - if (frame->number != s->current_frame) - { - list_del (&frame->node); - frame_free (s, frame); - } - } - - /* Maximize the frame and the windows in the frame. */ - maximize_frame (current_frame()); - maximize_all_windows_in_frame (current_frame()); -} - -/* Shrink the size of the frame to fit it's current window. */ -void -resize_shrink_to_window (rp_frame *frame) -{ - rp_window *win; - - if (frame->win_number == EMPTY) return; - - win = find_window_number (frame->win_number); - - resize_frame_horizontally (frame, win->width + win->border*2 - frame->width); - resize_frame_vertically (frame, win->height + win->border*2 - frame->height); -} - -/* resize_frame is a generic frame resizer that can resize vertically, - horizontally, to the right, to the left, etc. It all depends on the - functions passed to it. Returns -1 if the resize failed, 0 for - success. */ -static int -resize_frame (rp_frame *frame, rp_frame *pusher, int diff, - int (*c1)(rp_frame *), int (c2)(rp_frame *), - int (*c3)(rp_frame *), int (c4)(rp_frame *), - void (*resize1)(rp_frame *, int), - void (*resize2)(rp_frame *, int), - int (*resize3)(rp_frame *, rp_frame *, int)) -{ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - - /* Loop through the frames and determine which ones are affected by - resizing frame. */ - list_for_each_entry (cur, &s->frames, node) - { - if (cur == frame || cur == pusher) continue; - /* If cur is touching frame along the axis that is being - moved then this frame is affected by the resize. */ - if ((*c1)(cur) == (*c3)(frame)) - { - /* If the frame can't get any smaller, then fail. */ - if (diff > 0 - && abs ((*c3)(cur) - (*c1)(cur)) - diff <= defaults.window_border_width * 2) - return -1; - /* Test for this circumstance: - --+ - | |+-+ - |f||c| - | |+-+ - --+ - - In this case, resizing cur will not affect any other - frames, so just do the resize. - */ - if (((*c2)(cur) >= (*c2)(frame)) - && (*c4)(cur) <= (*c4)(frame)) - { - (*resize2)(cur, -diff); - maximize_all_windows_in_frame (cur); - } - /* Otherwise, cur's corners are either strictly outside - frame's corners, or one of them is inside and the other - isn't. In either of these cases, resizing cur will affect - other adjacent frames, so find them and resize them first - (recursive step) and then resize cur. */ - else if (((*c2)(cur) < (*c2)(frame) - && (*c4)(cur) > (*c4)(frame)) - || ((*c2)(cur) >= (*c2)(frame) - && (*c2)(cur) < (*c4)(frame)) - || ((*c4)(cur) > (*c2)(frame) - && (*c4)(cur) <= (*c4)(frame))) - { - /* Attempt to resize cur. */ - if (resize3 (cur, frame, -diff) == -1) - return -1; - } - } - } - - /* Finally, resize the frame and the windows inside. */ - (*resize1) (frame, diff); - maximize_all_windows_in_frame (frame); - - return 0; -} - -static int resize_frame_bottom (rp_frame *frame, rp_frame *pusher, int diff); -static int resize_frame_top (rp_frame *frame, rp_frame *pusher, int diff); -static int resize_frame_left (rp_frame *frame, rp_frame *pusher, int diff); -static int resize_frame_right (rp_frame *frame, rp_frame *pusher, int diff); - -/* Resize frame by moving it's right side. */ -static int -resize_frame_right (rp_frame *frame, rp_frame *pusher, int diff) -{ - return resize_frame (frame, pusher, diff, - frame_left, frame_top, frame_right, frame_bottom, - frame_resize_right, frame_resize_left, resize_frame_left); -} - -/* Resize frame by moving it's left side. */ -static int -resize_frame_left (rp_frame *frame, rp_frame *pusher, int diff) -{ - return resize_frame (frame, pusher, diff, - frame_right, frame_top, frame_left, frame_bottom, - frame_resize_left, frame_resize_right, resize_frame_right); -} - -/* Resize frame by moving it's top side. */ -static int -resize_frame_top (rp_frame *frame, rp_frame *pusher, int diff) -{ - return resize_frame (frame, pusher, diff, - frame_bottom, frame_left, frame_top, frame_right, - frame_resize_up, frame_resize_down, resize_frame_bottom); -} - -/* Resize frame by moving it's bottom side. */ -static int -resize_frame_bottom (rp_frame *frame, rp_frame *pusher, int diff) -{ - return resize_frame (frame, pusher, diff, - frame_top, frame_left, frame_bottom, frame_right, - frame_resize_down, frame_resize_up, resize_frame_top); -} - -/* Resize frame diff pixels by expanding it to the right. If the frame - is against the right side of the screen, expand it to the left. */ -void -resize_frame_horizontally (rp_frame *frame, int diff) -{ - int (*resize_fn)(rp_frame *, rp_frame*, int); - struct list_head *l; - rp_screen *s = frames_screen (frame); - - if (num_frames (s) < 2 || diff == 0) - return; - - if (frame_width (frame) + diff <= defaults.window_border_width * 2) - return; - - /* Find out which resize function to use. */ - if (frame_right (frame) < screen_right (s)) - { - resize_fn = resize_frame_right; - } - else if (frame_left (frame) > screen_left (s)) - { - resize_fn = resize_frame_left; - } - else - { - return; - } - - /* Copy the frameset. If the resize fails, then we restore the - original one. */ - l = screen_copy_frameset (s); - - if ((*resize_fn) (frame, NULL, diff) == -1) - { - screen_restore_frameset (s, l); - } - else - { - frameset_free (l); - } - - /* It's our responsibility to free this. */ - free (l); -} - -/* Resize frame diff pixels by expanding it down. If the frame is - against the bottom of the screen, expand it up. */ -void -resize_frame_vertically (rp_frame *frame, int diff) -{ - int (*resize_fn)(rp_frame *, rp_frame*, int); - struct list_head *l; - rp_screen *s = frames_screen (frame); - - if (num_frames (s) < 2 || diff == 0) - return; - - if (frame_height (frame) + diff <= defaults.window_border_width * 2) - return; - - /* Find out which resize function to use. */ - if (frame_bottom (frame) < screen_bottom (s)) - { - resize_fn = resize_frame_bottom; - } - else if (frame_top (frame) > screen_top (s)) - { - resize_fn = resize_frame_top; - } - else - { - return; - } - - /* Copy the frameset. If the resize fails, then we restore the - original one. */ - l = screen_copy_frameset (s); - - if ((*resize_fn) (frame, NULL, diff) == -1) - { - screen_restore_frameset (s, l); - } - else - { - frameset_free (l); - } - - /* It's our responsibility to free this. */ - free (l); -} - -static int -frame_is_below (rp_frame *src, rp_frame *frame) -{ - if (frame->y > src->y) return 1; - return 0; -} - -static int -frame_is_above (rp_frame *src, rp_frame *frame) -{ - if (frame->y < src->y) return 1; - return 0; -} - -static int -frame_is_left (rp_frame *src, rp_frame *frame) -{ - if (frame->x < src->x) return 1; - return 0; -} - -static int -frame_is_right (rp_frame *src, rp_frame *frame) -{ - if (frame->x > src->x) return 1; - return 0; -} - -static int -total_frame_area (rp_screen *s) -{ - int area = 0; - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - area += cur->width * cur->height; - } - - return area; -} - -/* Return 1 if frames f1 and f2 overlap */ -static int -frames_overlap (rp_frame *f1, rp_frame *f2) -{ - if (f1->x >= f2->x + f2->width - || f1->y >= f2->y + f2->height - || f2->x >= f1->x + f1->width - || f2->y >= f1->y + f1->height) - { - return 0; - } - return 1; -} - -/* Return 1 if w's frame overlaps any other window's frame */ -static int -frame_overlaps (rp_frame *frame) -{ - rp_screen *s; - rp_frame *cur; - - s = frames_screen (frame); - - list_for_each_entry (cur, &s->frames, node) - { - if (cur != frame && frames_overlap (cur, frame)) - { - return 1; - } - } - return 0; -} - -void -remove_frame (rp_frame *frame) -{ - rp_screen *s; - int area; - rp_frame *cur; - rp_window *win; - - if (frame == NULL) return; - - s = frames_screen (frame); - - area = total_frame_area(s); - PRINT_DEBUG (("Total Area: %d\n", area)); - - list_del (&frame->node); - win = find_window_number (frame->win_number); - hide_window (win); - hide_others (win); - - list_for_each_entry (cur, &s->frames, node) - { - rp_frame tmp_frame; - int fits = 0; - -/* if (cur->win_number != EMPTY) */ -/* { */ -/* PRINT_DEBUG (("Trying frame containing window '%s'\n", window_name (cur->win))); */ -/* } */ -/* else */ -/* { */ -/* PRINT_DEBUG (("Trying some empty frame\n")); */ -/* } */ - - /* Backup the frame */ - memcpy (&tmp_frame, cur, sizeof (rp_frame)); - - if (frame_is_below (frame, cur) - || frame_is_above (frame, cur)) - { - if (frame_is_below (frame, cur)) - cur->y = frame->y; - cur->height += frame->height; - } - - PRINT_DEBUG (("Attempting vertical Frame y=%d height=%d\n", cur->y, cur->height)); - PRINT_DEBUG (("New Total Area: %d\n", total_frame_area(s))); - - /* If the area is bigger than before, the frame takes up too - much space. If the current frame and the deleted frame DON'T - overlap then the current window took up just the right amount - of space but didn't take up the space left behind by the - deleted window. If any active frames overlap, it could have - taken up the right amount of space, overlaps with the deleted - frame but obviously didn't fit. */ - if (total_frame_area(s) > area || !frames_overlap (cur, frame) || frame_overlaps (cur)) - { - PRINT_DEBUG (("Didn't fit vertically\n")); - - /* Restore the current window's frame */ - memcpy (cur, &tmp_frame, sizeof (rp_frame)); - } - else - { - PRINT_DEBUG (("It fit vertically!!\n")); - - /* update the frame backup */ - memcpy (&tmp_frame, cur, sizeof (rp_frame)); - fits = 1; - } - - if (frame_is_left (frame, cur) - || frame_is_right (frame, cur)) - { - if (frame_is_right (frame, cur)) - cur->x = frame->x; - cur->width += frame->width; - } - - PRINT_DEBUG (("Attempting horizontal Frame x=%d width=%d\n", cur->x, cur->width)); - PRINT_DEBUG (("New Total Area: %d\n", total_frame_area(s))); - - /* Same test as the vertical test, above. */ - if (total_frame_area(s) > area || !frames_overlap (cur, frame) || frame_overlaps (cur)) - { - PRINT_DEBUG (("Didn't fit horizontally\n")); - - /* Restore the current window's frame */ - memcpy (cur, &tmp_frame, sizeof (rp_frame)); - } - else - { - PRINT_DEBUG (("It fit horizontally!!\n")); - fits = 1; - } - - if (fits) - { - /* The current frame fits into the new space so keep its - new frame parameters and maximize the window to fit - the new frame size. */ - if (cur->win_number != EMPTY) - { - rp_window *new = find_window_number (cur->win_number); - maximize_all_windows_in_frame (cur); - XRaiseWindow (dpy, new->w); - } - } - else - { - memcpy (cur, &tmp_frame, sizeof (rp_frame)); - } - } - - frame_free (s, frame); -} - -/* Switch the input focus to another frame, and therefore a different - window. */ -void -set_active_frame (rp_frame *frame, int force_indicator) -{ - rp_screen *old_s = current_screen(); - rp_screen *s = frames_screen (frame); - int old = current_screen()->current_frame; - rp_window *win, *old_win; - rp_frame *old_frame; - - win = find_window_number (frame->win_number); - old_frame = current_frame(); - if (old_frame) - { - old_win = find_window_number (old_frame->win_number); - } - else - { - old_win = NULL; - } - - /* Make the switch */ - give_window_focus (win, old_win); - update_last_access (frame); - s->current_frame = frame->number; - - /* If frame->win == NULL, then rp_current_screen is not updated. */ - rp_current_screen = s->xine_screen_num; - - update_bar (s); - - /* Possibly show the frame indicator. */ - if ((old != s->current_frame && num_frames(s) > 1) - || s != old_s) - { - show_frame_indicator(force_indicator); - - /* run the frame switch hook. We call it in here because this is - when a frame switch ACTUALLY (for sure) happens. */ - hook_run (&rp_switch_frame_hook); - } - - /* If the frame has no window to give focus to, give the key window - focus. */ - if(frame->win_number == EMPTY) - { - set_window_focus (s->key_window); - } - - /* Call the switchscreen hook, when appropriate. */ - if (s != old_s) - hook_run (&rp_switch_screen_hook); -} - -void -exchange_with_frame (rp_frame *cur, rp_frame *frame) -{ - rp_window *win,*last_win; - - if (frame == NULL || frame == cur) return; - - /* Exchange the windows in the frames */ - win = find_window_number (cur->win_number); - last_win = set_frames_window (frame, win); - set_frames_window (cur, last_win); - - /* Make sure the windows comes up full screen */ - if (last_win) - maximize (last_win); - if (win) - { - maximize (win); - /* Make sure the program bar is always on the top */ - update_window_names (win->scr, defaults.window_fmt); - } - - /* Make the switch */ - update_last_access (frame); - - set_active_frame(frame, 0); -} - - -void -blank_frame (rp_frame *frame) -{ - rp_screen *s; - rp_window *win; - - if (frame->win_number == EMPTY) return; - - s = frames_screen (frame); - - win = find_window_number (frame->win_number); - hide_window (win); - hide_others (win); - - set_frames_window (frame, NULL); - - update_bar (s); - - /* Give the key window focus. */ - set_window_focus (frames_screen(frame)->key_window); -} - -void -hide_frame_indicator (void) -{ - int i; - for (i=0; i<num_screens; i++) - XUnmapWindow (dpy, screens[i].frame_window); -} - -void -show_frame_indicator (int force) -{ - if (num_frames (current_screen()) > 1 || force) - { - hide_frame_indicator (); - show_frame_message (defaults.frame_fmt); - alarm (defaults.frame_indicator_timeout); - } -} - -void -show_frame_message (char *msg) -{ - rp_screen *s = current_screen (); - int width, height; - rp_frame *frame; - rp_window *win; - rp_window_elem *elem = NULL; - struct sbuf *msgbuf; - - frame = current_frame(); - win = current_window (); - if (win) - { - rp_group *g; - - g = groups_find_group_by_window (win); - elem = group_find_window (&g->mapped_windows, win); - } - - /* A frame doesn't always contain a window. */ - msgbuf = sbuf_new (0); - if (elem) - format_string (msg, elem, msgbuf); - else - { - sbuf_concat (msgbuf, EMPTY_FRAME_MESSAGE); - } - - width = defaults.bar_x_padding * 2 - + rp_text_width (s, msgbuf->data, msgbuf->len); - height = (FONT_HEIGHT (s) + defaults.bar_y_padding * 2); - - /* We don't want another frame indicator to be displayed on another - * screen at the same time, so we hide it before bringing it back again. - */ - hide_frame_indicator (); - - XMoveResizeWindow (dpy, s->frame_window, - s->left + frame->x + frame->width / 2 - width / 2, - s->top + frame->y + frame->height / 2 - height / 2, - width, height); - - XMapRaised (dpy, s->frame_window); - XClearWindow (dpy, s->frame_window); - XSync (dpy, False); - - rp_draw_string (s, s->frame_window, STYLE_NORMAL, - defaults.bar_x_padding, - defaults.bar_y_padding + FONT_ASCENT(s), - msgbuf->data, msgbuf->len); - - sbuf_free (msgbuf); -} - -rp_frame * -find_frame_up (rp_frame *frame) -{ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - if (frame->y == cur->y + cur->height) - { - if (frame->x >= cur->x && frame->x < cur->x + cur->width) - return cur; - } - } - - return NULL; -} - -rp_frame * -find_frame_down (rp_frame *frame) -{ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - if (frame->y + frame->height == cur->y) - { - if (frame->x >= cur->x && frame->x < cur->x + cur->width) - return cur; - } - } - - return NULL; -} - -rp_frame * -find_frame_left (rp_frame *frame) -{ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - if (frame->x == cur->x + cur->width) - { - if (frame->y >= cur->y && frame->y < cur->y + cur->height) - return cur; - } - } - - return NULL; -} - -rp_frame * -find_frame_right (rp_frame *frame) -{ - rp_screen *s = frames_screen (frame); - rp_frame *cur; - - list_for_each_entry (cur, &s->frames, node) - { - if (frame->x + frame->width == cur->x) - { - if (frame->y >= cur->y && frame->y < cur->y + cur->height) - return cur; - } - } - - return NULL; -} - -rp_frame * -find_frame_number (int num) -{ - int i; - rp_frame *cur; - - for (i=0; i<num_screens; i++) - { - rp_screen *s = &screens[i]; - - list_for_each_entry (cur, &s->frames, node) - { - if (cur->number == num) - return cur; - } - } - - return NULL; -} diff --git a/src/split.h b/src/split.h deleted file mode 100644 index 87bb660..0000000 --- a/src/split.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - * - */ - -#ifndef SPLIT_H -#define SPLIT_H - -int num_frames (rp_screen *s); -rp_window *set_frames_window (rp_frame *frame, rp_window *win); -void cleanup_frame (rp_frame *frame); -void maximize_all_windows_in_frame (rp_frame *frame); -void h_split_frame (rp_frame *frame, int pixels); -void v_split_frame (rp_frame *frame, int pixels); -void remove_all_splits (void); -void resize_shrink_to_window (rp_frame *frame); -void resize_frame_horizontally (rp_frame *frame, int diff); -void resize_frame_vertically (rp_frame *frame, int diff); -void remove_frame (rp_frame *frame); -rp_window *find_window_for_frame (rp_frame *frame); -rp_frame *find_windows_frame (rp_window *win); -rp_frame *find_frame_next (rp_frame *frame); -rp_frame *find_frame_prev (rp_frame *frame); -rp_window *current_window (void); -void init_frame_lists (void); -void init_frame_list (rp_screen *screen); -void set_active_frame (rp_frame *frame, int force_indicator); -void exchange_with_frame (rp_frame *cur, rp_frame *frame); -void blank_frame (rp_frame *frame); -void show_frame_indicator (int force); -void hide_frame_indicator (void); - -void show_frame_message (char *msg); - -rp_frame *find_frame_right (rp_frame *frame); -rp_frame *find_frame_left (rp_frame *frame); -rp_frame *find_frame_down (rp_frame *frame); -rp_frame *find_frame_up (rp_frame *frame); -rp_frame *find_last_frame (void); -rp_frame * find_frame_number (int num); - -rp_frame *current_frame (void); - -#endif diff --git a/src/window.c b/src/window.c deleted file mode 100644 index 15024f6..0000000 --- a/src/window.c +++ /dev/null @@ -1,820 +0,0 @@ -/* functions for handling the window list - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -/* Citing getsid(2) here: - To get the prototype under glibc, define both _XOPEN_SOURCE and - _XOPEN_SOURCE_EXTENDED, or use "#define _XOPEN_SOURCE n" for some - integer n larger than or equal to 500. */ -#define _XOPEN_SOURCE 500 -#include <unistd.h> /* for getsid */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "ratpoison.h" - -LIST_HEAD(rp_unmapped_window); -LIST_HEAD(rp_mapped_window); - -struct numset *rp_window_numset; - -/* Get the mouse position relative to the the specified window */ -static void -get_mouse_position (rp_window *win, int *mouse_x, int *mouse_y) -{ - Window root_win, child_win; - int root_x, root_y; - unsigned int mask; - - XQueryPointer (dpy, win->scr->root, &root_win, &child_win, mouse_x, mouse_y, &root_x, &root_y, &mask); -} - -void -free_window (rp_window *w) -{ - if (w == NULL) return; - - free (w->user_name); - free (w->res_name); - free (w->res_class); - free (w->wm_name); - - XFree (w->hints); - - free (w); -} - -void -update_window_gravity (rp_window *win) -{ -/* if (win->hints->win_gravity == ForgetGravity) */ -/* { */ - if (win->transient) - win->gravity = defaults.trans_gravity; - else if (win->hints->flags & PMaxSize || win->hints->flags & PAspect) - win->gravity = defaults.maxsize_gravity; - else - win->gravity = defaults.win_gravity; -/* } */ -/* else */ -/* { */ -/* win->gravity = win->hints->win_gravity; */ -/* } */ -} - -char * -window_name (rp_window *win) -{ - if (win == NULL) return NULL; - - if (win->named) - return win->user_name; - - switch (defaults.win_name) - { - case WIN_NAME_RES_NAME: - if (win->res_name) - return win->res_name; - else return win->user_name; - - case WIN_NAME_RES_CLASS: - if (win->res_class) - return win->res_class; - else return win->user_name; - - /* if we're not looking for the res name or res class, then - we're looking for the window title. */ - default: - if (win->wm_name) - return win->wm_name; - else return win->user_name; - } - - return NULL; -} - -/* FIXME: we need to verify that the window is running on the same - host as something. otherwise there could be overlapping PIDs. */ -struct rp_child_info * -get_child_info (Window w) -{ - rp_child_info *cur; - int status; - int pid; - Atom type_ret; - int format_ret; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *req; - pid_t sid; - - status = XGetWindowProperty (dpy, w, _net_wm_pid, - 0, 0, False, XA_CARDINAL, - &type_ret, &format_ret, &nitems, &bytes_after, &req); - - if (status != Success || req == NULL) - { - PRINT_DEBUG (("Couldn't get _NET_WM_PID Property\n")); - return NULL; - } - - /* XGetWindowProperty always allocates one extra byte even if - the property is zero length. */ - XFree (req); - - status = XGetWindowProperty (dpy, w, _net_wm_pid, - 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0), - False, XA_CARDINAL, &type_ret, &format_ret, &nitems, - &bytes_after, &req); - - if (status != Success || req == NULL) - { - PRINT_DEBUG (("Couldn't get _NET_WM_PID Property\n")); - return NULL; - } - - pid = *((int *)req); - XFree(req); - - PRINT_DEBUG(("pid: %d\n", pid)); - - /* The pids will hopefully be in the same session. */ - sid = getsid (pid); - list_for_each_entry (cur, &rp_children, node) - { - PRINT_DEBUG(("cur->pid=%d sid=%d\n", cur->pid, getsid (cur->pid))); - if (sid == getsid (cur->pid)) - return cur; - } - - return NULL; -} - -/* Allocate a new window and add it to the list of managed windows */ -rp_window * -add_to_window_list (rp_screen *s, Window w) -{ - struct rp_child_info *child_info; - rp_window *new_window; - rp_group *group = NULL; - int frame_num = -1; - - new_window = xmalloc (sizeof (rp_window)); - - new_window->w = w; - new_window->scr = s; - new_window->last_access = 0; - new_window->state = WithdrawnState; - new_window->number = -1; - new_window->frame_number = EMPTY; - new_window->intended_frame_number = -1; - new_window->named = 0; - new_window->hints = XAllocSizeHints (); - new_window->colormap = DefaultColormap (dpy, s->screen_num); - new_window->transient = XGetTransientForHint (dpy, new_window->w, &new_window->transient_for); - PRINT_DEBUG (("transient %d\n", new_window->transient)); - - update_window_gravity (new_window); - - get_mouse_position (new_window, &new_window->mouse_x, &new_window->mouse_y); - - XSelectInput (dpy, new_window->w, WIN_EVENTS); - - new_window->user_name = xstrdup ("Unnamed"); - - new_window->wm_name = NULL; - new_window->res_name = NULL; - new_window->res_class = NULL; - - /* Add the window to the end of the unmapped list. */ - list_add_tail (&new_window->node, &rp_unmapped_window); - - child_info = get_child_info (w); - - if (child_info && !child_info->window_mapped) { - rp_frame *frame = screen_find_frame_by_frame (child_info->screen, child_info->frame); - - PRINT_DEBUG(("frame=%p\n", frame)); - group = groups_find_group_by_group (child_info->group); - if (frame) - frame_num = frame->number; - /* Only map the first window in the launch frame. */ - child_info->window_mapped = 1; - } - - /* Add the window to the group it's pid was launched in or the - current one. */ - if (group) - group_add_window (group, new_window); - else - group_add_window (rp_current_group, new_window); - - PRINT_DEBUG(("frame_num: %d\n", frame_num)); - if (frame_num >= 0) - new_window->intended_frame_number = frame_num; - - return new_window; -} - -/* Check to see if the window is in the list of windows. */ -rp_window * -find_window_in_list (Window w, struct list_head *list) -{ - rp_window *cur; - - list_for_each_entry (cur, list, node) - { - if (cur->w == w) return cur; - } - - return NULL; -} - -/* Check to see if the window is in any of the lists of windows. */ -rp_window * -find_window (Window w) -{ - rp_window *win = NULL; - - - win = find_window_in_list (w, &rp_mapped_window); - - if (!win) - { - win = find_window_in_list (w, &rp_unmapped_window); - if (win) - PRINT_DEBUG (("Window found in unmapped window list\n")); - else - PRINT_DEBUG (("Window not found.\n")); - } - else - { - PRINT_DEBUG (("Window found in mapped window list.\n")); - } - - return win; -} - -void -set_current_window (rp_window *win) -{ - set_frames_window (current_frame(), win); -} - -rp_window * -find_window_number (int n) -{ - rp_window *cur; - - list_for_each_entry (cur,&rp_mapped_window,node) - { -/* if (cur->state == STATE_UNMAPPED) continue; */ - - if (n == cur->number) return cur; - } - - return NULL; -} - -rp_window * -find_window_name (char *name) -{ - rp_window_elem *cur; - - list_for_each_entry (cur, &rp_current_group->mapped_windows, node) - { - if (str_comp (name, window_name (cur->win), strlen (name))) - return cur->win; - } - - /* didn't find it */ - return NULL; -} - -/* Return the previous window in the list. Assumes window is in the - mapped window list. */ -rp_window* -find_window_prev (rp_window *w) -{ - rp_window *cur; - - if (!w) return NULL; - - for (cur = list_prev_entry (w, &rp_mapped_window, node); - cur != w; - cur = list_prev_entry (cur, &rp_mapped_window, node)) - { - if (!find_windows_frame (cur)) - { - return cur; - } - } - - return NULL; -} - -/* Return the next window in the list. Assumes window is in the mapped - window list. */ -rp_window* -find_window_next (rp_window *w) -{ - rp_window *cur; - - if (!w) return NULL; - - for (cur = list_next_entry (w, &rp_mapped_window, node); - cur != w; - cur = list_next_entry (cur, &rp_mapped_window, node)) - { - if (!find_windows_frame (cur)) - { - return cur; - } - } - - return NULL; -} - -rp_window * -find_window_other (rp_screen *screen) -{ - return group_last_window (rp_current_group, screen); -} - - - -/* Assumes the list is sorted by increasing number. Inserts win into - to Right place to keep the list sorted. */ -void -insert_into_list (rp_window *win, struct list_head *list) -{ - rp_window *cur; - - list_for_each_entry (cur, list, node) - { - if (cur->number > win->number) - { - list_add_tail (&win->node, &cur->node); - return; - } - } - - list_add_tail(&win->node, list); -} - -static void -save_mouse_position (rp_window *win) -{ - Window root_win, child_win; - int root_x, root_y; - unsigned int mask; - - /* In the case the XQueryPointer raises a BadWindow error, the - window is not mapped or has been destroyed so it doesn't matter - what we store in mouse_x and mouse_y since they will never be - used again. */ - - ignore_badwindow++; - - XQueryPointer (dpy, win->w, &root_win, &child_win, - &root_x, &root_y, &win->mouse_x, &win->mouse_y, &mask); - - ignore_badwindow--; -} - -/* Takes focus away from last_win and gives focus to win */ -void -give_window_focus (rp_window *win, rp_window *last_win) -{ - /* counter increments every time this function is called. This way - we can track which window was last accessed. */ - static int counter = 1; - - /* Warp the cursor to the window's saved position if last_win and - win are different windows. */ - if (last_win != NULL && win != last_win) - { - save_mouse_position (last_win); - XSetWindowBorder (dpy, last_win->w, last_win->scr->bw_color); - } - - if (win == NULL) return; - - counter++; - win->last_access = counter; - unhide_window (win); - - if (defaults.warp) - { - PRINT_DEBUG (("Warp pointer\n")); - XWarpPointer (dpy, None, win->w, - 0, 0, 0, 0, win->mouse_x, win->mouse_y); - } - - /* Swap colormaps */ - if (last_win != NULL) XUninstallColormap (dpy, last_win->colormap); - XInstallColormap (dpy, win->colormap); - - XSetWindowBorder (dpy, win->w, win->scr->fw_color); - - /* Finally, give the window focus */ - rp_current_screen = win->scr->xine_screen_num; - set_rp_window_focus (win); - - XSync (dpy, False); -} - -#if 0 -void -unhide_transient_for (rp_window *win) -{ - rp_frame *frame; - rp_window *transient_for; - - if (win == NULL) return; - if (!win->transient) return; - frame = find_windows_frame (win); - - transient_for = find_window (win->transient_for); - if (transient_for == NULL) - { - PRINT_DEBUG (("Can't find transient_for for '%s'\n", win->name )); - return; - } - - if (find_windows_frame (transient_for) == NULL) - { - set_frames_window (frame, transient_for); - maximize (transient_for); - - PRINT_DEBUG (("unhide transient window: %s\n", transient_for->name)); - - unhide_window_below (transient_for); - - if (transient_for->transient) - { - unhide_transient_for (transient_for); - } - - set_frames_window (frame, win); - } - else if (transient_for->transient) - { - unhide_transient_for (transient_for); - } -} -#endif - -#if 0 -/* Hide all transient windows for win until we get to last. */ -void -hide_transient_for_between (rp_window *win, rp_window *last) -{ - rp_window *transient_for; - - if (win == NULL) return; - if (!win->transient) return; - - transient_for = find_window (win->transient_for); - if (transient_for == last) - { - PRINT_DEBUG (("Can't find transient_for for '%s'\n", win->name )); - return; - } - - if (find_windows_frame (transient_for) == NULL) - { - PRINT_DEBUG (("hide transient window: %s\n", transient_for->name)); - hide_window (transient_for); - } - - if (transient_for->transient) - { - hide_transient_for (transient_for); - } -} -#endif - -#if 0 -void -hide_transient_for (rp_window *win) -{ - /* Hide ALL the transient windows for win. */ - hide_transient_for_between (win, NULL); -} -#endif - -#if 0 -/* return 1 if transient_for is a transient window for win or one of - win's transient_for ancestors. */ -int -is_transient_ancestor (rp_window *win, rp_window *transient_for) -{ - rp_window *tmp; - - if (win == NULL) return 0; - if (!win->transient) return 0; - if (transient_for == NULL) return 0; - - tmp = win; - - do - { - tmp = find_window (tmp->transient_for); - if (tmp == transient_for) - return 1; - } while (tmp && tmp->transient); - - return 0; -} -#endif - -/* Gets frame from window -- helper to set_active_window_body - * - * While this fct returns a value, it also modifies a param, last_frame, - * which is ugly... but since this is trying to fix ugly code I guess it - * can be a little ugly. - */ -static rp_frame* -get_frame(rp_window *win, rp_frame *last_frame) -{ - rp_frame* frame=NULL; - - /* use the intended frame if we can. */ - if (win->intended_frame_number >= 0) - { - /* With Xinerama, we can move a window over to the current screen; otherwise - * we have to switch to the screen that the window belongs to. - */ - if (rp_have_xinerama) - frame = screen_get_frame (current_screen(), win->intended_frame_number); - else - frame = screen_get_frame (win->scr, win->intended_frame_number); - - win->intended_frame_number = -1; - if (frame != current_frame()) - last_frame = current_frame(); - } - - if (!frame) - { - if (rp_have_xinerama) - frame = screen_get_frame (current_screen(), current_screen()->current_frame); - else - frame = screen_get_frame (win->scr, win->scr->current_frame); - } - - return frame; -} - -/* Finds a non-dedicated frame -- helper to set_active_window_body */ -static void -find_non_dedicated_frame(rp_window *win, rp_frame *frame, rp_frame *last_frame) -{ - /* Try to find a non-dedicated frame. */ - rp_frame *cur; - rp_screen *scr; - int done; - - scr = (rp_have_xinerama)?&screens[rp_current_screen]:win->scr; - done = 0; - - /* Try the only / current screen... */ - for (cur = list_next_entry (frame, &scr->frames, node); - cur != frame; - cur = list_next_entry (cur, &scr->frames, node)) - { - if (!cur->dedicated) - { - set_active_frame (cur, 0); - last_frame = frame; - frame = cur; - break; - } - } - - /* If we have Xinerama, we can check *all* screens... */ - /* TODO: could this be put into yet another function? */ - if (rp_have_xinerama && !done) - { - int i; - - for (i=0; i<num_screens && !done; i++) - { - if (scr == &screens[i]) continue; - list_for_each_entry (cur,&screens[i].frames,node) - { - if (!cur->dedicated) - { - set_active_frame (cur, 0); - last_frame = frame; - frame = cur; - - /* Good case for a goto here? */ - done = 1; /* Break outer loop. */ - break; /* Break inner loop. */ - } - } - } - } -} - -/* In the current frame, set the active window to win. win will have focus. */ -void set_active_window (rp_window *win) -{ - set_active_window_body(win, 0); -} - -void set_active_window_force (rp_window *win) -{ - set_active_window_body(win, 1); -} - -void -set_active_window_body (rp_window *win, int force) -{ - rp_window *last_win; - rp_frame *frame = NULL, *last_frame = NULL; - - if (win == NULL) return; - - PRINT_DEBUG (("intended_frame_number: %d\n", win->intended_frame_number)); - - frame = get_frame(win, last_frame); - - if (frame->dedicated && !force) - find_non_dedicated_frame(win, frame, last_frame); - - last_win = set_frames_window (frame, win); - - if (last_win) PRINT_DEBUG (("last window: %s\n", window_name (last_win))); - PRINT_DEBUG (("new window: %s\n", window_name (win))); - - /* Make sure the window comes up full screen */ - maximize (win); - - /* Focus the window. */ - give_window_focus (win, last_win); - - /* The other windows in the frame will be hidden if this window - doesn't qualify as a transient window (ie dialog box. */ - if (!window_is_transient (win)) - hide_others(win); - - /* Make sure the program bar is always on the top */ - update_window_names (win->scr, defaults.window_fmt); - - XSync (dpy, False); - - /* If we switched frame, go back to the old one. */ - if (last_frame) - set_active_frame (last_frame, 0); - - /* Call the switch window hook */ - hook_run (&rp_switch_win_hook); -} - -/* Go to the window, switching frames if the window is already in a - frame. */ -void -goto_window (rp_window *win) -{ - rp_frame *frame; - - /* There is nothing to do if it is already the current window. */ - if (current_window() == win) - return; - - frame = find_windows_frame (win); - if (frame) - { - set_active_frame (frame, 0); - } - else - { - set_active_window (win); - } -} - -void -print_window_information (rp_group *group, rp_window *win) -{ - rp_window_elem *win_elem; - /* Display the window's number in group. This gives the possibility - of windows existing in multiple groups. */ - win_elem = group_find_window (&group->mapped_windows, win); - if (win_elem) - marked_message_printf (0, 0, MESSAGE_WINDOW_INFORMATION, - win_elem->number, window_name (win)); - else - marked_message_printf (0, 0, "%s doesn't exist in group %d\n", - window_name(win), group->number); -} - -/* get the window list and store it in buffer delimiting each window - with delim. mark_start and mark_end will be filled with the text - positions for the start and end of the current window. */ -void -get_window_list (char *fmt, char *delim, struct sbuf *buffer, - int *mark_start, int *mark_end) -{ - rp_window_elem *we; - - if (buffer == NULL) return; - - sbuf_clear (buffer); - find_window_other (current_screen()); - - /* We only loop through the current group to look for windows. */ - list_for_each_entry (we,&rp_current_group->mapped_windows,node) - { - PRINT_DEBUG (("%d-%s\n", we->number, window_name (we->win))); - - if (we->win == current_window()) - *mark_start = strlen (sbuf_get (buffer)); - - /* A hack, pad the window with a space at the beginning and end - if there is no delimiter. */ - if (!delim) - sbuf_concat (buffer, " "); - - format_string (fmt, we, buffer); - - /* A hack, pad the window with a space at the beginning and end - if there is no delimiter. */ - if (!delim) - sbuf_concat (buffer, " "); - - /* Only put the delimiter between the windows, and not after the the last - window. */ - if (delim && we->node.next != &rp_current_group->mapped_windows) - sbuf_concat (buffer, delim); - - if (we->win == current_window()) - { - *mark_end = strlen (sbuf_get (buffer)); - } - } - - if (!strcmp (sbuf_get (buffer), "")) - { - sbuf_copy (buffer, MESSAGE_NO_MANAGED_WINDOWS); - } -} - -void -init_window_stuff (void) -{ - rp_window_numset = numset_new (); -} - -void -free_window_stuff (void) -{ - rp_window *cur; - struct list_head *tmp, *iter; - - list_for_each_safe_entry (cur, iter, tmp, &rp_unmapped_window, node) - { - list_del (&cur->node); - groups_del_window (cur); - free_window (cur); - } - - list_for_each_safe_entry (cur, iter, tmp, &rp_mapped_window, node) - { - list_del (&cur->node); - groups_unmap_window (cur); - groups_del_window (cur); - free_window (cur); - } - - numset_free (rp_window_numset); -} - -rp_frame * -win_get_frame (rp_window *win) -{ - if (win->frame_number != EMPTY) - return screen_get_frame (win->scr, win->frame_number); - else - return NULL; -} diff --git a/src/window.h b/src/window.h deleted file mode 100644 index 922200b..0000000 --- a/src/window.h +++ /dev/null @@ -1,73 +0,0 @@ -/* functions for managing the window list - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef _RATPOISON_LIST_H -#define _RATPOISON_LIST_H 1 - -#include "sbuf.h" - -void free_window (rp_window *w); -rp_window *add_to_window_list (rp_screen *s, Window w); -void last_window (void); -rp_window *find_window_in_list (Window w, struct list_head *list); -rp_window *find_window (Window w); -void maximize_current_window (void); -void give_window_focus (rp_window *win, rp_window *last_win); -void set_active_window (rp_window *win); -void goto_window (rp_window *win); -void set_current_window (rp_window *win); -void update_window_gravity (rp_window *win); -char *window_name (rp_window *win); - -#if 0 -void unhide_transient_for (rp_window *win); -void hide_transient_for (rp_window *win); -void hide_transient_for_between (rp_window *win, rp_window *last); -int is_transient_ancestor (rp_window *win, rp_window *transient_for); -#endif - -/* int goto_window_name (char *name); */ -rp_window *find_window_other (rp_screen *screen); -rp_window *find_window_by_number (int n); -rp_window *find_window_name (char *name); -rp_window *find_window_prev (rp_window *w); -rp_window *find_window_prev_with_frame (rp_window *w); -rp_window *find_window_next (rp_window *w); -rp_window *find_window_next_with_frame (rp_window *w); -rp_window *find_window_number (int n); -void sort_window_list_by_number (void); - -void insert_into_list (rp_window *win, struct list_head *list); - -void print_window_information (rp_group *group, rp_window *win); -void get_window_list (char *fmt, char *delim, struct sbuf *buffer, - int *mark_start, int *mark_end); -void init_window_stuff (void); -void free_window_stuff (void); - -rp_frame *win_get_frame (rp_window *win); - -void set_active_window_force (rp_window *win); -void set_active_window_body (rp_window *win, int force); - -struct rp_child_info *get_child_info (Window w); - -#endif /* ! _RATPOISON_LIST_H */ diff --git a/src/xinerama.c b/src/xinerama.c deleted file mode 100644 index 51d51b3..0000000 --- a/src/xinerama.c +++ /dev/null @@ -1,99 +0,0 @@ -/* functions for grabbing information about Xinerama screens - * Copyright (C) 2003 Cameron Patrick - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#include "ratpoison.h" - -#ifdef HAVE_X11_EXTENSIONS_XINERAMA_H -# include <X11/extensions/Xinerama.h> -# define XINERAMA -#endif - -int rp_have_xinerama = 0; -int xine_screen_count; - -#ifdef XINERAMA -static XineramaScreenInfo *xine_screens = NULL; -#endif - -void -init_xinerama(void) -{ -#ifdef XINERAMA - int evbase, errbase, major, minor; - - rp_have_xinerama = 0; - - if (xine_screens) XFree(xine_screens); - - if (!XineramaQueryExtension(dpy, &evbase, &errbase)) { - return; - } - - if (!XineramaQueryVersion(dpy, &major, &minor) != Success) { - return; - } - - if (major != 1) { - fprintf (stderr, "Warning: Xinerama version %d.%d not supported\n", major, minor); - return; - } - - if (!XineramaIsActive(dpy)) { - return; - } - - xine_screens = XineramaQueryScreens(dpy, &xine_screen_count); - if ((xine_screens == NULL) || (xine_screen_count < 2)) { - return; - } - - rp_have_xinerama = 1; -#else - rp_have_xinerama = 0; -#endif -} - -#ifdef XINERAMA -void xinerama_get_screen_info(int sc, int *x, int *y, int *w, int *h) -{ - if ((sc < xine_screen_count) && (sc >= 0)) { - *x = xine_screens[sc].x_org; - *y = xine_screens[sc].y_org; - *w = xine_screens[sc].width; - *h = xine_screens[sc].height; - } -} -#else -void xinerama_get_screen_info(int sc UNUSED, int *x UNUSED, int *y UNUSED, int *w UNUSED, int *h UNUSED) -{ -} -#endif - -void -free_xinerama(void) -{ -#ifdef XINERAMA - if (xine_screens) { - XFree(xine_screens); - } - rp_have_xinerama = 0; -#endif -} diff --git a/src/xinerama.h b/src/xinerama.h deleted file mode 100644 index 233ec46..0000000 --- a/src/xinerama.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2003 Cameron Patrick - * - * This file is part of ratpoison. - * - * ratpoison 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, or (at your option) - * any later version. - * - * ratpoison 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ - -#ifndef XINERAMA_H -#define XINERAMA_H - -void init_xinerama(void); -void free_xinerama(void); -void xinerama_get_screen_info(int sc, int *x, int *y, int *w, int *h); - -#endif |